| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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
- t1
- kaggle
- attribute
- LeetCode
- Convert Sorted List to Binary Search Tree
- Regular Expression
- 파이썬
- data science
- 715. Range Module
- Decorator
- 시바견
- 109. Convert Sorted List to Binary Search Tree
- Python
- 컴퓨터의 구조
- Protocol
- Python Code
- Python Implementation
- Generator
- concurrency
- 밴픽
- DWG
- iterator
- shiba
- 30. Substring with Concatenation of All Words
- Substring with Concatenation of All Words
- 운영체제
- 프로그래머스
- 43. Multiply Strings
- 315. Count of Smaller Numbers After Self
- Class
Archives
- Today
- Total
Scribbling
LeetCode: 27. Remove Element 본문
class Solution:
def removeElement(self, nums: List[int], val: int) -> int:
length = len(nums)
i = 0
while i <= length - 1:
if nums[i] == val:
nums[i], nums[length-1] = nums[length-1], nums[i]
length -= 1
else:
i += 1
return length'Computer Science > Coding Test' 카테고리의 다른 글
| LeetCode: 65. Valid Number (0) | 2022.01.20 |
|---|---|
| LeetCode: 30. Substring with Concatenation of All Words (0) | 2022.01.17 |
| LeetCode: 454. 4Sum II (0) | 2022.01.16 |
| LeetCode: 395. Longest Substring with At Least K Repeating Characters (0) | 2022.01.16 |
| LeetCode: 384. Shuffle an Array (0) | 2022.01.15 |