diff --git a/238. Product of Array Except Self b/238. Product of Array Except Self new file mode 100644 index 0000000..c438ae6 --- /dev/null +++ b/238. Product of Array Except Self @@ -0,0 +1,24 @@ +class Solution { +public: + void print(vector& a, int n){ + for(int i=0; i productExceptSelf(vector& nums) { + int n=nums.size(); + vector a(n, 1); + //a[i]=product of nums[k] over k>i + for(int i=n-2; i>=0; i--){ + a[i]=nums[i+1]*a[i+1]; + } + //b=product of nums[k] over k