Minimum Cost to Merge Stones

Help needed in this question : (variation of Matrix Chain Multiplication)

https://leetcode.com/problems/minimum-cost-to-merge-stones/

I read the solutions and watched videos still didn’t get it and all of them explained it in bottom up manner,

please tell how to solve this in top-down manner