C++ || Easy || DP Solution
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```\nclass Solution {\npublic:\n    int dp[100][201];\n    int f(int prev, vector<int> &locations, int Cfuel, int finish){\n\n        if(dp[prev][Cfuel]!=-1){\n            return dp[prev][Cfuel];\n        }\n\n\n        int ans = 0;\n        if(prev==finish){\n            ans++;\n        }\n        for(int i=0; i<locations.size(); i++){\n            if(i!=prev && abs(locations[prev]-locations[i]) <= Cfuel){\n                ans = (ans + f(i,locations,Cfuel-(abs(locations[prev]-locations[i])), finish))%(int)(1e9+7);\n            }\n        }\n        return dp[prev][Cfuel] = ans;\n    }\n\n\n    int countRoutes(vector<int>& locations, int start, int finish, int fuel) {\n        \n        memset(dp,-1,sizeof(dp));\n        return f(start,locations,fuel, finish);\n    }\n};\n```
['C++']