일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
Tags
- 715. Range Module
- 프로그래머스
- kaggle
- Decorator
- data science
- Substring with Concatenation of All Words
- Python Code
- 운영체제
- Regular Expression
- t1
- 밴픽
- 30. Substring with Concatenation of All Words
- Generator
- 컴퓨터의 구조
- Class
- concurrency
- attribute
- 109. Convert Sorted List to Binary Search Tree
- Protocol
- DWG
- 315. Count of Smaller Numbers After Self
- Convert Sorted List to Binary Search Tree
- Python Implementation
- LeetCode
- Python
- 43. Multiply Strings
- 파이썬
- 시바견
- shiba
- iterator
Archives
- Today
- Total
Scribbling
LeetCode: 26. Remove Duplicates from Sorted Array 본문
Computer Science/Coding Test
LeetCode: 26. Remove Duplicates from Sorted Array
focalpoint 2021. 8. 27. 18:19
class Solution:
def removeDuplicates(self, nums: List[int]) -> int:
prev = None
i = 0
for num in nums:
if num != prev:
nums[i] = num
prev = num
i += 1
return i
'Computer Science > Coding Test' 카테고리의 다른 글
LeetCode: 50. Pow(x, n) (0) | 2021.09.02 |
---|---|
LeetCode: 30. Substring with Concatenation of All Words (0) | 2021.08.29 |
LeetCode: 24. Swap Nodes in Pairs (0) | 2021.08.26 |
LeetCode: 25. Reverse Nodes in k-Group (0) | 2021.08.25 |
LeetCode: 22. Generate Parentheses (0) | 2021.08.24 |