Minimum cost merge stone piles
There are n piles of stones in a row; stones[i] is the count in pile i. In one move you merge two ADJACENT piles into one, paying a cost equal to the total stones in the two merged piles. Repeat until one pile remains. Return the minimum total cost. 1 <= n <= 200, 1 <= stones[i] <= 100.
Implement
merge_stones_cost(stones: list[int]) → intExamples
in
[[3,4,3]]out17What a strong answer looks like
State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
0:00 of about 35 min
solution.py
InputExpectedGot
[[3,4,3]]17not run yetsample