Array - Sort Array By Parity
참고 https://leetcode.com/explore/learn/card/fun-with-arrays/511/in-place-operations/3260/ 문제풀기 class Solution: def sortArrayByParity(self, nums: List[int]) -> List[int]: for i in range(len(nums)-1, -1, -1): if nums[i] % 2 != 0: nums.append(nums.pop(i)) i += 1 return nums
Array - Replace Elements with Greatest Element on Right Side
참고 https://leetcode.com/explore/learn/card/fun-with-arrays/511/in-place-operations/3259/ 문제풀기 In-Place 알고리즘 사용 Two pointers 알고리즘 사용 리스트에 순차적으로 접근해야 할 때 두 개의 점의 위치를 기록하면서 처리하는 알고리즘 정렬되어있는 두 리스트의 합집합에도 사용됨. 병합정렬(merge sort)의 counquer...
Array - Remove Element
참고 https://leetcode.com/explore/learn/card/fun-with-arrays/511/in-place-operations/3575/ 문제풀기 class Solution: def removeElement(self, nums: List[int], val: int) -> int: while nums.count(val): nums.remove(val) return len(nums)
Array - Remove Duplicates from Sorted Array
참고 https://leetcode.com/explore/learn/card/fun-with-arrays/511/in-place-operations/3258/ 문제풀기 In-Place 알고리즘 사용 Two pointers 알고리즘 사용 리스트에 순차적으로 접근해야 할 때 두 개의 점의 위치를 기록하면서 처리하는 알고리즘 정렬되어있는 두 리스트의 합집합에도 사용됨. 병합정렬(merge sort)의 counquer...
Array - Move Zeros
참고 https://leetcode.com/explore/learn/card/fun-with-arrays/511/in-place-operations/3157/ 문제풀기 In-Place 알고리즘 사용 Two pointers 알고리즘 사용 리스트에 순차적으로 접근해야 할 때 두 개의 점의 위치를 기록하면서 처리하는 알고리즘 정렬되어있는 두 리스트의 합집합에도 사용됨. 병합정렬(merge sort)의 counquer...