Most Easy Memo in the Universe
I STRONGLY URGE YOU TO SEE THE TABULATION SOLUTION FIRST (IF INDIAN THEN FROM PEPCODING YOUTUBE CHANNEL)\n\n\nclass Solution {\n    public int minScoreTriangula
I STRONGLY URGE YOU TO SEE THE TABULATION SOLUTION FIRST (IF INDIAN THEN FROM PEPCODING YOUTUBE CHANNEL)\n\n```\nclass Solution {\n    public int minScoreTriangulation(int[] arr) {\n      int dp[][]=new int[arr.length][arr.length];\n      for(int i=0;i<arr.length;i++)\n      {\n          Arrays.fill(dp[i],-1);\n      }\n      return solve(arr,0,arr.length-1,dp);\n    }\n    \n    int solve(int arr[],int i,int j,int dp[][])\n    {\n      if(j-i<=1)//\n          return 0;\n        \n       if(dp[i][j]!=-1)\n           return dp[i][j];\n        \n      int min=Integer.MAX_VALUE;\n      for(int k=i+1;k<j;k++)\n      {\n          int cost=arr[i]*arr[k]*arr[j]+solve(arr,i,k,dp)+solve(arr,k,j,dp);\n          \n          min=Math.min(min,cost);  \n      }\n      return dp[i][j]=min;\n    }\n    \n}\n```
['Memoization', 'Java']