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