Skip to content

Commit 35c6582

Browse files
author
rkayan
committed
File(s) modified:1011-capacity-to-ship-packages-within-d-days.java
Launguage(s) Used: java Submission URL:https://leetcode.com/problems/capacity-to-ship-packages-within-d-days/submissions/1049659159/
1 parent 3cdfb1f commit 35c6582

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

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)