Product of Array Except Self
I learned that instead of multiplying everything each time, we split it into left and right products.
What I understood:
My mistake I first tried brute😭 force instead of thinking in prefix/suffix way
👉 Use left and right products to solve in O(n) time.
I learned that instead of multiplying everything each time, we split it into left and right products.
What I understood:
* Left = product of elements before index
* Right = product of elements after index
* Answer = left × right
My mistake I first tried brute😭 force instead of thinking in prefix/suffix way
👉 Use left and right products to solve in O(n) time.