Given an array nums which consists of non-negative integers and an integer m, you can split the array into m non-empty continuous subarrays.
Write an algorithm to minimize the largest sum among these m subarrays.
- dynamic programming solution
- Time : O(n^2 * m)
- Space : O(nm)
c++
1 | //prefix sum - o(n) - do not need. calculate immediately |
- binary search
- Time : O(nlogn)
- Space : O(1)
c++
1 |
|