Fundamentals
/
Partition array into N subsets with balanced sum
⏸
00:00
↻
← Prev
Next →
▶
Question
Given a sorted array, please place them into N buckets, ensuring we get N subarrays with approximately equal weights.
Example 1
Input
arr = [1, 2, 3, 4, 5], N = 3
Output
[[5],[1,4],[2,3]]
▶
My Code
▶
Reference Solution