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