A nice solution
\n#define LL long long\n\nLL mod = 1e9 + 7;\nLL dp[205][205];\n\nclass Solution {\npublic:\n    int countRoutes(vector<int>& locations, int start, int finish, i
```\n#define LL long long\n\nLL mod = 1e9 + 7;\nLL dp[205][205];\n\nclass Solution {\npublic:\n    int countRoutes(vector<int>& locations, int start, int finish, int fuel) {\n      int n = locations.size();\n      for (int i = 0; i <= fuel; i++) {\n        for (int j = 0; j < n; j++) {\n          dp[i][j] = 0;\n        }\n      }\n      dp[fuel][start] = 1;\n      for (int i = fuel; i > 0; i--) {\n        for (int j = 0; j < n; j++) {\n          for (int k = 0; k < n; k++) {\n            if (j == k) continue;\n            int d = abs(locations[j] - locations[k]);\n            if (d <= i) {\n              dp[i - d][k] += dp[i][j];\n              dp[i - d][k] %= mod;\n            }\n          }\n        }\n      }\n\n      LL ans = 0;\n      for (int i = 0; i <= fuel; i++) {\n        ans += dp[i][finish];\n        ans %= mod;\n      }\n      return ans;\n    }\n};\n\n```
[]