We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 57efc15 commit a771fb3Copy full SHA for a771fb3
README.md
@@ -6,7 +6,7 @@
6
7
| Current Status| Stats |
8
| :------------: | :----------: |
9
-| Total Problems | 164 |
+| Total Problems | 165 |
10
11
</center>
12
leet_code_problems/product_except_self.cpp
@@ -9,6 +9,14 @@
#include <iostream>
#include <vector>
+
13
+/*
14
+ * Idea is to maintain two product variables, one from beginning and
15
+ * one from the end.
16
+ * Each result variable in result array
17
+ * would be touched twice, one from the left to right
18
+ * and other right to left, thus producing desired result.
19
+ */
20
std::vector<int> product_except_self(const std::vector<int>& nums)
21
{
22
int product_from_beginning = 1;
0 commit comments