Count the fastest routes
A town has n intersections numbered 0 to n - 1. Each entry of roads is [u, v, minutes]: a two-way road between u and v that takes minutes to drive. Return how many different routes from intersection 0 to intersection n - 1 take the least possible time; two routes differ if their sequences of intersections differ. Return 0 if n - 1 cannot be reached; when n == 1, staying put counts as one route.
Every road takes at least 1 minute, no road joins an intersection to itself, and no two roads join the same pair.
Besides the tests, one large input (61 intersections, 1,048,576 fastest routes) with a ~100 ms limit (scaled to your device's speed): brute force won't pass.
Examples
count_fastest_routes(4, [[0,1,1],[1,3,1],[0,2,1],[2,3,1]])→2count_fastest_routes(5, [[0,1,2],[1,4,3],[0,2,1],[2,4,4],[0,3,4],[3,4,1],[1,2,1]])→4count_fastest_routes(3, [[0,1,5]])→0