Easy Recursive DP Solution ( C++ ). O( N*N*FUEL )
Self Explanatory Code ( Recursive DP )\nTime Complexity O ( N x N x FUEL )  \n\nget(i,j) or dp[i][j] --> gives the totalWays to reach "finish" city when we star
**Self Explanatory Code ( Recursive DP )**\nTime Complexity O ( N x N x FUEL )  \n```\nget(i,j) or dp[i][j] --> gives the totalWays to reach "finish" city when we start from ith city with fuel = j.\n```\n\nCode C++\n```\nvector<int> loc;\nint n, finish, dp[104][204];\nint get(int id, int fuel)\n{\n      int &totalWays = dp[id][fuel];\n      if ( totalWays != -1 ) return totalWays;\n\n      totalWays = 0;\n      if ( id == finish ) totalWays = 1;              // Reached "finish" city, Add 1 to answer\n\n      for (int j = 0; j < n; j++)\n      {\n            if ( j == id ) continue;              // Cannot move to the current city\n            int req = abs(loc[j] - loc[id]);     // Fuel that is required to jth city\n            \n            if ( fuel >= req )              // Check whether we have enough fuel\n            {\n                  totalWays += get(j, fuel - req);    //  Move to the jth city\n                  totalWays %= 1000000007;\n            }\n      }\n\n      return totalWays;\n}\n\nint countRoutes(vector<int>& location, int start, int f, int fuel) {\n      finish = f; loc = location;\n      n = loc.size();\n      memset(dp, -1, sizeof dp);\n      return get(start, fuel);\n}\n\n```
[]