As reported: Confluent online assessment (2026):
getClusteringCost.
A hard disk has n sectors in a row; sector i has cost sectorCost[i]. Divide the disk into exactly clusterCount clusters. Every cluster is a non-empty run of consecutive sectors, and every sector belongs to exactly one cluster. The cost of a cluster from sector x to sector y is sectorCost[x] + sectorCost[y] (a one-sector cluster costs twice that sector). The cost of a division is the sum of its clusters' costs.
Return [minimum cost, maximum cost] over all possible divisions.
Example
sectorCost = [1, 2, 3, 2, 5], clusterCount = 3
Output: [14, 18]
Minimum: [1] [2] [3, 2, 5] -> (1+1) + (2+2) + (3+5) = 14
Maximum: [1, 2, 3] [2] [5] -> (1+3) + (2+2) + (5+5) = 18
Constraints: 1 ≤ clusterCount ≤ n ≤ 10^5, 1 ≤ sectorCost[i] ≤ 10^9. Totals can exceed 32 bits.
Code runner format: two JSON values, one per line: sectorCost and clusterCount. Implement getClusteringCost(sectorCost, clusterCount) and return the two totals as 64-bit integers.
A close relative is LeetCode 2551 — Put Marbles in Bags, which asks for the difference of the two totals. Our write-up: /put-marbles-in-bags.