RK DSA Studio

Binary search on answers

Find the smallest capacity that ships ordered, indivisible packages within a day limit by binary searching a monotone feasibility predicate.

Remember: Can do it? Try smaller. Cannot? Try larger.

Example: [1,2,3,4,5], 3 days → capacity 6.

Time: O(n log S). Auxiliary space: O(1).

Formula: Feasible(capacity): greedy packing needs ≤ D days; find first feasible capacity

Enter 1–15 positive package weights and 1–15 days. Packages cannot split or change order. Bounds: maximum weight to total weight S. At most D days; extra empty days are allowed. Feasibility is monotone.

Complexities describe the underlying algorithm; tutorial snapshots and rendering can use additional resources.

The interactive workspace loads here when JavaScript is available. You can still browse the learning notes and links above without it.