일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- 43. Multiply Strings
- Regular Expression
- Decorator
- Python Implementation
- 715. Range Module
- kaggle
- attribute
- 파이썬
- data science
- Protocol
- 315. Count of Smaller Numbers After Self
- Python
- concurrency
- 컴퓨터의 구조
- 109. Convert Sorted List to Binary Search Tree
- DWG
- 프로그래머스
- Class
- 30. Substring with Concatenation of All Words
- 밴픽
- 시바견
- Substring with Concatenation of All Words
- LeetCode
- Generator
- shiba
- Convert Sorted List to Binary Search Tree
- 운영체제
- Python Code
- t1
- iterator
Archives
- Today
- Total
목록238. Product of Array Except Self (1)
Scribbling
LeetCode: 238. Product of Array Except Self
Relatively straightforward solution, O(N) time O(1) Memory. class Solution: def productExceptSelf(self, nums: List[int]) -> List[int]: numZero, prod, zeroidx = 0, 1, 0 for i, num in enumerate(nums): if num == 0: numZero += 1 zeroidx = i else: prod *= num if numZero >= 2: return [0] * len(nums) if numZero == 1: ret = [0] * len(nums) ret[zeroidx] = prod return ret # backward pass ret = [0] * len(n..
Computer Science/Coding Test
2021. 11. 25. 11:14