Ship capacity
Your task
A conveyor belt has packages that must ship within days days. weights[i] is the i-th package's weight; packages must be loaded in given order. Each day you load the ship with packages (in order) without exceeding its capacity. Return the least weight capacity of the ship that allows all packages to ship within days days. 1 <= days <= len(weights) <= 5e4.
Examples
ship_within_days(weights: list[int], days: int) -> intExample 1
Input
ship_within_days([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 5)Output
15