일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- Convert Sorted List to Binary Search Tree
- 43. Multiply Strings
- Generator
- 30. Substring with Concatenation of All Words
- 컴퓨터의 구조
- t1
- 파이썬
- 운영체제
- Python Code
- Regular Expression
- data science
- DWG
- Substring with Concatenation of All Words
- Python
- Decorator
- 315. Count of Smaller Numbers After Self
- 109. Convert Sorted List to Binary Search Tree
- 715. Range Module
- kaggle
- concurrency
- 프로그래머스
- shiba
- 시바견
- Python Implementation
- 밴픽
- Class
- Protocol
- attribute
- LeetCode
Archives
- Today
- Total
Scribbling
LeetCode: 283. Move Zeroes 본문
Using two pointers.
class Solution:
def moveZeroes(self, nums: List[int]) -> None:
"""
Do not return anything, modify nums in-place instead.
"""
j = 0
for i, num in enumerate(nums):
if num != 0:
nums[j] = num
j += 1
for k in range(j, len(nums)):
nums[k] = 0
'Computer Science > Coding Test' 카테고리의 다른 글
LeetCode: 279. Perfect Squares (0) | 2021.12.27 |
---|---|
LeetCode: 240. Search a 2D Matrix II (0) | 2021.12.27 |
LeetCode: 234. Palindrome Linked List (0) | 2021.12.24 |
LeetCode: 239. Sliding Window Maximum (0) | 2021.12.23 |
LeetCode: 218. The Skyline Problem (0) | 2021.12.22 |