Leetcode Writeup 3010. Divide an Array Into Subarrays With Minimum Cost I
Feb 4 · 1 min read · Problem Description The cost of the partition [0…i-1][i…j-1][j…n-1] is nums[0]+nums[i]+nums[j]. To obtain minimum cost, two “separator “ nums[i] and nums[j] are the smallest and the second-smallest element. Algorithm Use two variables min1 and min2 t...
Join discussion