Skip to content

Commit 830c694

Browse files
committed
增加No152
1 parent 1838ca0 commit 830c694

File tree

2 files changed

+52
-24
lines changed

2 files changed

+52
-24
lines changed

.idea/workspace.xml

Lines changed: 29 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Array/No152.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package Array;
2+
3+
/**
4+
* @author tujietg
5+
* @date 5/18/20 9:07 AM
6+
*/
7+
public class No152 {
8+
9+
public static int maxProduct(int[] nums) {
10+
int end = Integer.MIN_VALUE;
11+
for (int i = 0; i < nums.length; i++) {
12+
int mid = 1;
13+
for (int j = i; j < nums.length; j++) {
14+
mid *= nums[j];
15+
if (mid > end) {
16+
end = mid;
17+
}
18+
}
19+
}
20+
return end;
21+
}
22+
23+
}

0 commit comments

Comments
 (0)