MEMOIZATION SOLUTION IN JAVA
Intuition\n Describe your first thoughts on how to solve this problem. \nTrying out all possible paths using dfs.\n\n# Approach\n Describe your approach to solv
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nTrying out all possible paths using dfs.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\ni did solve this question using dfs due to time constarint it throws TIME LIMIT EXCEEDED error , Then after i have chnaged the dfs solution into Memoization and guess what? it does running fine.\n\n\nHAPPY CODING....\n\n# Complexity\n- Time complexity:   O(N*m)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n   \n\n- Space complexity:  O(N*M)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n\n# Code\n```java []\nclass Solution\n{\n    int help(int[][]path,int n,int m,int dp[][])\n    {\n        if(n<0 || m<0)\n        {\n            return 0;\n        }\n        if(path[n][m]==1)\n        {\n            return 0;\n        }\n        if(n==0 && m==0)\n        {\n            return 1;\n            //basecase\n        }\n        if(dp[n][m]!=-1)return dp[n][m];\n       \n     \n        int up=help(path,n-1,m,dp);\n        int left=help(path,n,m-1,dp);\n        return dp[n][m]=up+left;\n    }\n    public int uniquePathsWithObstacles(int[][] path) \n    {\n        int n=path.length;\n        int m=path[0].length;\n        int dp[][]=new int[n+1][m+1];\n        for(int []arr:dp)\n        {\n            Arrays.fill(arr,-1);\n        }\n        return help(path,n-1,m-1,dp);        \n    }\n}\n```
['Recursion', 'Memoization', 'Java']