Z01
Cargo Weight Split Distribution
Problem Statement & Objective
Distribute freight shipments evenly across transport vehicles minimizing the maximum payload.
Function Signature (Python)
ship_within_days(weights: list[int], k: int) -> intInput & Output Contract
Output Rule:Minimum olası maksimum dilim toplamı. k > n veya k < 1 ise -1.
System Constraints
1 <= yukler.length <= 10^5
1 <= k <= 10^5 (k > n ise geçersiz -> -1)
1 <= yukler[i] <= 10^4Example Execution Walkthrough
yukler = [7, 2, 5, 10, 8], k = 2
olası 2'li bölmeler:
[7,2,5] | [10,8] -> max(14, 18) = 18 (EN İYİ)
cevap: 18Example Test Scenarios (3)
Example 1
Input:
[[7,2,5,10,8],2]Expected Output:
18Example 2: 5 Yük 2 Bölüm (9 Kapasite)
Input:
[[1,2,3,4,5],2]Expected Output:
9Example 3: k=n (Maksimum Eleman 30)
Input:
[[10,20,30],3]Expected Output:
30