Python in 6 very short lines, clean and readable
We always get plus 1 if we\'re on the finish, because we have the option of never moving again.\n\ndef countRoutes(self, locations: List[int], start: int, finis
We always get plus 1 if we\'re on the finish, because we have the option of never moving again.\n```\ndef countRoutes(self, locations: List[int], start: int, finish: int, fuel: int) -> int:\n\tcost = lambda i,j: abs(locations[i]-locations[j])\n\t@lru_cache(None)\n\tdef dfs(i, f):\n\t\tif f<0: return 0 \n\t\treturn sum([dfs(j,f-cost(i,j)) for j in range(len(locations)) if j != i]) + (i==finish)\n\treturn dfs(start, fuel) % (10**9+7)\n```
[]