C Solution from Editorial
//Solution taken from Editorial\n\n#define MOD 1000000007\nint solve(int *locations, int locationsSize, int start, int finish, int fuel, int **memo){\n    if(fu
//Solution taken from Editorial\n```\n#define MOD 1000000007\nint solve(int *locations, int locationsSize, int start, int finish, int fuel, int **memo){\n    if(fuel < 0){\n        return 0;\n    }\n    if(memo[start][fuel] != -1){\n        return memo[start][fuel];\n    }\n    int ans = start == finish ? 1 : 0;\n    for(int i = 0; i < locationsSize; i++){\n        if(i != start){\n            ans = (ans + solve(locations, locationsSize, i, finish, fuel - abs(locations[i] - locations[start]), memo)) % MOD;\n        }\n    }\n    return memo[start][fuel] = ans;\n}\n\nint countRoutes(int* locations, int locationsSize, int start, int finish, int fuel){\n    int ans = 0;\n    int **memo = (int **)malloc(sizeof(int *) * locationsSize);\n    for(int i = 0; i < locationsSize; i++){\n        memo[i] = (int *)malloc(sizeof(int) * (fuel + 1));\n        for(int j = 0; j <= fuel; j++){\n            memo[i][j] = -1;\n        }\n    }\n    return solve(locations, locationsSize, start, finish, fuel, memo);\n}\n\n```
['C']