You are given an array of distinct positive integers locations where locations[i] represents the coordinate of city i. You are also given integers start, finish, and fuel, representing the starting city, the destination city, and the initial amount of fuel you have available.
At each step, if you are currently at city i, you may choose any city j such that j \neq i and move to it. Moving from city i to city j consumes locations[i] locations[j]
You are permitted to visit any city multiple times, including start and finish.
Return the total number of possible routes from start to finish. Since the answer may be very large, return it modulo
Constraints:
locations.length
locations[i]
All integers in locations are distinct.
start, finish locations.length
fuel
You are given an array of distinct positive integers locations where locations[i] represents the coordinate of city i. You are also given integers start, finish, and fuel, representing the starting city, the destination city, and the initial amount of fuel you have available.
At each step, if you are currently at city i, you may choose any city j such that j \neq i and move to it. Moving from city i to city j consumes locations[i] locations[j]
You are permitted to visit any city multiple times, including start and finish.
Return the total number of possible routes from start to finish. Since the answer may be very large, return it modulo
Constraints:
locations.length
locations[i]
All integers in locations are distinct.
start, finish locations.length
fuel