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