Search⌘ K
AI Features

Put Marbles in Bags

Put Marbles in Bags divides a weights array into k nonempty contiguous groups. Each group's cost is the sum of its endpoint weights; return the difference between the largest and smallest total scores.

Statement

You are given k bags and a 0-indexed integer array, weights, where weights[i] represents the weight of the ...