public class Solution { public int GetMoneyAmount(int n) { , n + ]; , n); } int DP(int[,] t, int s, int e) { ; ) return t[s, e]; int res = int.MaxValue; for (int x = s; x <= e; x++) { ), DP(t, x + , e)); res = Math.Min(res, tmp); } t[s, e] = res; ret…