🔥🔥🔥C++ | super easy | memoization | 2d DP | easy to grasp🔥🔥🔥
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nconst int mod = 1e9+7;\nclass Solution {\nprivate:\n    int n;\n    int solver(vector<int>& locations, int start, int finish, int fuel, vector<vector<int>>& dp){\n        if(fuel < 0) return 0;\n        if(dp[start][fuel]!=-1) return dp[start][fuel];\n        int ans = start==finish;\n        for(int i=0; i<n; i++){\n            if(i != start){\n                int req = abs(locations[i] - locations[start]);\n                ans = (ans%mod + solver(locations,i,finish,fuel-req,dp)%mod)%mod;\n                ans = ans%mod;\n            }\n        }\n        return dp[start][fuel] = ans; \n    }\npublic:\n    int countRoutes(vector<int>& locations, int start, int finish, int fuel) {\n        n = locations.size();\n        vector<vector<int>> dp(n,vector<int>(fuel+1,-1));\n        return solver(locations,start,finish,fuel,dp);\n    }\n};\n```
['Array', 'Dynamic Programming', 'Memoization', 'C++']