Skip to content

Commit f22e6ea

Browse files
committed
Runtime: 295 ms (Top 5.06%) | Memory: 57.9 MB (Top 75.87%)
1 parent 6a28f38 commit f22e6ea

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

scripts/algorithms/M/Maximum Length of Subarray With Positive Product/Maximum Length of Subarray With Positive Product.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Runtime: 295 ms (Top 5.06%) | Memory: 57.9 MB (Top 75.87%)
12
class Solution {
23
public:
34
int getMaxLen(vector<int>& nums) {
@@ -6,7 +7,7 @@ class Solution {
67
int llen = 0, rlen = 0;
78
int n = nums.size();
89
for(int i = 0 ; i < n ; i++){
9-
lprod *= nums[i] != 0 ? nums[i]/abs(nums[i]) : 0;
10+
lprod *= nums[i] != 0 ? nums[i]/abs(nums[i]) : 0;
1011
rprod *= nums[n-1-i] != 0 ? nums[n-1-i]/abs(nums[n-1-i]) : 0;
1112
if(lprod != 0) llen ++;
1213
if(rprod != 0) rlen ++;
@@ -23,4 +24,4 @@ class Solution {
2324
}
2425
return ans;
2526
}
26-
};
27+
};

0 commit comments

Comments
 (0)