Skip to content

Commit e81c649

Browse files
Merge pull request #3007 from rohankayan/main
Added a Java solution for 0162 find-peak-element
2 parents b56cbc8 + 35c6582 commit e81c649

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

java/0162-find-peak-element.java

Whitespace-only changes.

java/1011-capacity-to-ship-packages-within-d-days.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ public int shipWithinDays(int[] weights, int days) {
1717
l = Math.max(l, w);
1818
r += w;
1919
}
20+
//We can improve lower bound by taking max of the average capacity and max weight
21+
l = Math.max(l,r/days);
2022

2123
int res = r;
2224

0 commit comments

Comments
 (0)