Z01

Cargo Weight Split Distribution

Staff / Principal Engineer
Target Time: 40 - 50 Minutes
Type: NUMERIC

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) -> int

Input & 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^4

Example 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: 18

Example Test Scenarios (3)

Example 1
Input:[[7,2,5,10,8],2]
Expected Output:18
Example 2: 5 Yük 2 Bölüm (9 Kapasite)
Input:[[1,2,3,4,5],2]
Expected Output:9
Example 3: k=n (Maksimum Eleman 30)
Input:[[10,20,30],3]
Expected Output:30
Loading Python Editor...
Input Parameters
[
  [
    7,
    2,
    5,
    10,
    8
  ],
  2
]
Expected Output
18