Java || 3 approaches || Recursion, Memoization, Tabulation || Easy Understanding
```\n//RECURSIVE SOLUTION\nclass Solution {\n    public int minScoreTriangulation(int[] values) {\n        int n = values.length;\n        return recursion(valu
```\n//RECURSIVE SOLUTION\nclass Solution {\n    public int minScoreTriangulation(int[] values) {\n        int n = values.length;\n        return recursion(values,0,n-1);\n    }\n    public int recursion(int[] v,int i,int j)\n    {\n        if(i+1==j)          //if only two vertices are present\n            return 0;\n        int min = Integer.MAX_VALUE;\n        for(int k=i+1;k<j;k++)        //we iterate from >i to <j\n        {\n            min = Math.min(min,v[i]*v[j]*v[k]+recursion(v,i,k)+recursion(v,k,j));\n        }\n        return min;\n    }\n}\n//how do we figure out whether it is a 2D matrix or 1D matrix, check the number of variables changing \n//RECURSION => TABULATION\n\nclass Solution {\n    public int minScoreTriangulation(int[] values) {\n        int n = values.length;\n        int[][] dp = new int[n][n];\n        for(int[] row:dp)\n            Arrays.fill(row,-1);\n        return memoization(values,0,n-1,dp);\n    }\n    public int memoization(int[] v,int i,int j,int[][] dp)\n    {\n        if(i+1==j)                    //if only two vertices are present\n            return 0;\n        if(dp[i][j]!=-1)\n            return dp[i][j];\n        int min = Integer.MAX_VALUE;\n        for(int k=i+1;k<j;k++)        //we iterate from >i to <j\n        {\n            min = Math.min(min,v[i]*v[j]*v[k]+memoization(v,i,k,dp)+memoization(v,k,j,dp));\n        }\n        dp[i][j]=min;\n        return dp[i][j];\n    }\n}\n\n//TABULATION - it is the exact opposite of Top Down approach(MEMOIZATION)\nclass Solution {\n    public int minScoreTriangulation(int[] values) {\n        return tabulation(values);\n    }\n    public int tabulation(int[] v)\n    {   \n        int n=v.length;\n        int[][] dp = new int[n][n];\n        //In Top-Down dp we were starting i,j with 0 and n-1 but in Bottom up we are doing a bit different we start i from n-1;\n        for(int i=n-1;i>=0;i--)\n        {\n            for(int j=i+2;j<n;j++)   \n//if we start j=i it will be a single pointer and wont form a triangle\n//if we start from j=i+1 it will meet the base condition in memoization and recursion and return 0 so we start from i+2 and iterate till n \n            {\n                int min = Integer.MAX_VALUE;\n                for(int k=i+1;k<j;k++)        //we iterate from >i to <j\n                {\n                    min = Math.min(min,(v[i]*v[j]*v[k]+dp[i][k]+dp[k][j]));\n                }\n                dp[i][j]=min; \n            }      \n        }\n        return dp[0][n-1];          //as it bottom up, it is the reverse of top down\n    }\n}
['Dynamic Programming', 'Recursion', 'Memoization', 'Java']