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