일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- Regular Expression
- 컴퓨터의 구조
- Python Code
- concurrency
- Generator
- shiba
- DWG
- 43. Multiply Strings
- 30. Substring with Concatenation of All Words
- 운영체제
- Substring with Concatenation of All Words
- Class
- t1
- attribute
- data science
- Decorator
- Python Implementation
- 109. Convert Sorted List to Binary Search Tree
- Protocol
- 파이썬
- Python
- LeetCode
- 프로그래머스
- iterator
- 밴픽
- 시바견
- Convert Sorted List to Binary Search Tree
- 715. Range Module
- 315. Count of Smaller Numbers After Self
- kaggle
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 |