jumps (all distinct), and each length can be used any number of times.
A **route** is a sequence of jump lengths that lands the grasshopper exactly on point total. Routes made of the same jumps in a different order count as **different** routes.
Return the number of routes. The answer can be very large; return it exactly.jumps=[1, 2], total=4 → 5
Five routes: 1+1+1+1, 1+1+2, 1+2+1, 2+1+1 and 2+2. The routes 1+1+2 and 2+1+1 are different, because the order of jumps matters.
jumps=[3, 5], total=8 → 2
Both 3 + 5 and 5 + 3 work, so there are two routes.
jumps=[4, 6], total=7 → 0
Both jumps are even and 7 is odd, so the goal cannot be hit exactly.
jumps ≤ 200jumps[i] ≤ 1000jumps are distincttotal ≤ 1000jumps=[1, 2], total=4
5
Run checks the first 3 tests in your browser. Submit checks all 113 tests on the server, hidden ones included.