일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- shiba
- Python Code
- Protocol
- 파이썬
- data science
- iterator
- Class
- 시바견
- Decorator
- Generator
- concurrency
- Convert Sorted List to Binary Search Tree
- LeetCode
- 43. Multiply Strings
- 밴픽
- kaggle
- Python
- 715. Range Module
- Regular Expression
- 프로그래머스
- 315. Count of Smaller Numbers After Self
- DWG
- 운영체제
- attribute
- 109. Convert Sorted List to Binary Search Tree
- t1
- Substring with Concatenation of All Words
- 30. Substring with Concatenation of All Words
- Python Implementation
- 컴퓨터의 구조
Archives
- Today
- Total
목록LeetCode 238. Product of Array Except Self (1)
Scribbling
[C++] LeetCode 238. Product of Array Except Self
https://leetcode.com/problems/product-of-array-except-self/ class Solution { public: vector productExceptSelf(vector& nums) { vector zero_idx; int zero_cnt = 0; vector dp1(nums.size()); vector dp2(nums.size()); int prod = 1; for (int i = 0; i < nums.size(); i++) { int num = nums[i]; if (num == 0) { zero_idx.push_back(i); zero_cnt++; } else { prod *= num; dp1[i] = prod; } } prod = 1; for (int i =..
Computer Science/C++
2023. 8. 18. 06:09