C++ || simple Straight forward approach
\nclass Solution {\npublic:\n    int mod = 1e9+7;\n    int countRoutes(vector<int>& locations, int start, int finish, int fuel) {\n        int n = locations.siz
```\nclass Solution {\npublic:\n    int mod = 1e9+7;\n    int countRoutes(vector<int>& locations, int start, int finish, int fuel) {\n        int n = locations.size();\n        vector<vector<int>> dp(n, vector<int> (fuel+1,-1));\n        return solve(locations, start, finish, fuel, dp);\n    }\n    \n    int solve(vector<int>& locations, int start, int finish, int fuel, vector<vector<int>> &dp){\n        if(fuel < 0)\n            return 0;\n        if(dp[start][fuel] != -1)\n            return dp[start][fuel];\n        int ans = 0;\n        if(start == finish)\n            ans++;\n        for(int i=0;i<locations.size();i++){\n            if(i == start || abs(locations[start] - locations[i]) > fuel)\n                continue;\n            \n            ans += solve(locations, i, finish, fuel - abs(locations[start] - locations[i]), dp);\n            ans %= mod;\n        }\n        \n        return dp[start][fuel] = ans%mod;\n    }\n};\n```\n\n![image](https://assets.leetcode.com/users/images/39451a8b-4887-46f6-9b8f-b994e2e40253_1687453528.6643982.jpeg)\n\n**please upvote!! if you like.**\ncomment below\uD83D\uDC47
['Dynamic Programming', 'C']