전체 글(221)
-
[LeetCode] Sort Array By Parity (Python)
class Solution: def sortArrayByParity(self, nums: List[int]) -> List[int]: return sorted(nums, key=lambda x: x%2)
2024.02.29 -
[LeetCode] Move Zeroes (Python)
class Solution: def moveZeroes(self, nums: List[int]) -> None: """ Do not return anything, modify nums in-place instead. """ zero = 0 for i in range(len(nums)): if nums[i] != 0: nums[i], nums[zero] = nums[zero], nums[i] zero += 1
2024.02.29 -
[LeetCode] Replace Elements with Greatest Element on Right Side (Python)
보호되어 있는 글입니다.
2024.02.29 -
[LeetCode] Valid Mountain Array (Python)
보호되어 있는 글입니다.
2024.02.29 -
[LeetCode] Check If N and Its Double Exist (Python)
class Solution: def checkIfExist(self, arr: List[int]) -> bool: for i in range(len(arr)): for j in range(len(arr)): if i != j: if arr[i] == 2 * arr[j]: return True return False
2024.02.29 -
[LeetCode] Remove Duplicates from Sorted Array (Python)
class Solution: def removeDuplicates(self, nums: List[int]) -> int: if len(nums)==0: return 0 i=0 for j in range(1,len(nums)): if nums[i]!=nums[j]: i+=1 nums[i]=nums[j] return i+1
2024.02.27