| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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
- Algorithm
- ProblemSoving
- MySQL
- ProblemSolving
- First Unique Character in a String
- hackerrank
- 하늘과 바람과 별과 시
- LEVEL 2
- 하늘과 바람과 별과 詩
- 3D PRINTING
- 2022
- 리트코드
- 프로그래머스
- C++
- 파이썬
- swift
- Code Jam 2022
- 알고리즘
- Qualification Round
- leetcode
- Kubernetes
- Count Monobit Integers
- 문제해결
- Code Jam
- GitLab
- Python
- 해커랭크
- 코딩테스트
- K8S
Archives
- Today
- Total
목록Move Zeroes (1)
공대생의 비망록
[LeetCode][Easy] Move Zeroes 문제 Python 풀이
멍청한 풀이: 시간복잡도 O(n^2)class Solution: def moveZeroes(self, nums: List[int]) -> None: """ Do not return anything, modify nums in-place instead. """ i = len(nums) - 1; j = 0; zeros = 0; moved = 0 while i >= 0: if nums[i] != 0: zeros += 1 i -= 1 else: if zeros == 0: # if there's 0 at the end of th..
Programming Language/Python
2026. 2. 8. 01:13