C++/Python #mimimalizm
C++\nA usual #minimalizm trick is to add 1 to dp[i][f] to indicate an explored path. This helps saving lines :)\ncpp\nint dp[101][201] = {};\nint countRoutes(ve
**C++**\nA usual #minimalizm trick is to add `1` to `dp[i][f]` to indicate an explored path. This helps saving lines :)\n```cpp\nint dp[101][201] = {};\nint countRoutes(vector<int>& locs, int i, int finish, int f) {\n    if (!dp[i][f]) {\n        dp[i][f] = 1 + (i == finish);\n        for (int j = 0; j < locs.size(); ++j)\n            if (i != j && f >= abs(locs[i] - locs[j]))\n                dp[i][f] = (dp[i][f] + countRoutes(locs, j, finish, f - abs(locs[i] - locs[j]))) % 1000000007;\n    }\n    return dp[i][f] - 1;\n}\n```\n\n**Python**\nJust a few lines in Python... that\'s an animal magnetism!\n```python\ndef countRoutes(self, l: List[int], start: int, fin: int, fuel: int) -> int:\n    @lru_cache(None)\n    def dfs(i: int, f: int) -> int:\n        return 0 if f < 0 else (1 if i == fin else 0) + sum(0 if i == j else dfs(j, f - abs(l[j] - l[i])) for j in range(len(l)))\n    return dfs(start, fuel) % 1000000007\n```
[]