3010. Divide an Array Into Subarrays With Minimum Cost I
You are given an array of integers
nums
of lengthn
.The cost of an array is the value of its first element. For example, the cost of
[1,2,3]
is1
while the cost of[3,4,1]
is3
.You need to divide
nums
into3
disjoint contiguous subarrays.Return the minimum possible sum of the cost of these subarrays.
1 | class Solution { |