🔥Simple and Intuitive approach using DP
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$$O(n^3)$$\n\n- Space complexity:\n $$O(n^2)$$\n\n# Code\n```\nclass Solution {\npublic:\n\n    int mod=1e9+7;\n\n    int func(vector<int>& v, vector<vector<int>>&dp,int f, int fuel, int ind){\n        int n=v.size();\n        if(ind>=n) return 0;\n        if(fuel<0) return 0;\n        if(dp[ind][fuel]!=-1) return dp[ind][fuel];\n\n        int ans = (ind == f) ? 1 : 0;\n        for(int i=0; i<n; i++){\n            if(i!=ind and abs(v[i]-v[ind]<=fuel)) ans=(ans+func(v,dp,f,fuel-abs(v[i]-v[ind]),i))%mod;\n        }\n\n        return dp[ind][fuel]=ans;\n    }\n\n    int countRoutes(vector<int>& v, int s, int f, int fuel) {\n        int n=v.size();\n        vector<vector<int>>dp(n+1,vector<int>(fuel+1,-1));\n        return func(v,dp,f,fuel,s);\n        \n\n\n    }\n};\n```
['Dynamic Programming', 'Memoization', 'C++']