You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// PROBLEM LINK: https://leetcode.com/problems/maximum-product-subarray/
int maxProduct(vector<int>& arr) {
// modified kadane's algorithm
// issue is when we encounter a negative number
// so used two variables to store min and max of the products so that if upcoming number is negative, it can pair up with negative product to give the maximum