Minimum Cost to Divide Array Into Subarrays - Practice Coding | SlaveCode
0
0123456789
0
0123456789
:
0
0123456789
0
0123456789
3500. Minimum Cost to Divide Array Into Subarrays
Hard
50 Points
Array
Dynamic Programming
Prefix Sum
You are given two integer arrays, nums and cost, of the same size, and an integer k.
You can divide nums into subarrays. The cost of the ith subarray consisting of elements nums[l..r] is:
Note that i represents the order of the subarray: 1 for the first subarray, 2 for the second, and so on.
Return the minimum total cost possible from any valid division.
You are given two integer arrays, nums and cost, of the same size, and an integer k.
You can divide nums into subarrays. The cost of the ith subarray consisting of elements nums[l..r] is:
Note that i represents the order of the subarray: 1 for the first subarray, 2 for the second, and so on.
Return the minimum total cost possible from any valid division.