Mozilla-Campus-Club-Cummins / CompetitiveProgramming-HacktoberFest23

1 stars 25 forks source link

Number of Ways to Arrive at Destination #58

Open Chaitralikore opened 8 months ago

Chaitralikore commented 8 months ago

You are in a city that consists of n intersections numbered from 0 to n - 1 with bi-directional roads between some intersections. The inputs are generated such that you can reach any intersection from any other intersection and that there is at most one road between any two intersections.

You are given an integer n and a 2D integer array roads where roads[i] = [ui, vi, timei] means that there is a road between intersections ui and vi that takes timei minutes to travel. You want to know in how many ways you can travel from intersection 0 to intersection n - 1 in the shortest amount of time.

Return the number of ways you can arrive at your destination in the shortest amount of time. Since the answer may be large, return it modulo 109 + 7.

Example 1:

Input: n=7, m=10 edges= [[0,6,7],[0,1,2],[1,2,3],[1,3,3],[6,3,3],[3,5,1],[6,5,1],[2,5,1],[0,4,5],[4,6,2]]

Output: 4 Explaination:

The four ways to get there in 7 minutes are:

bargeshreeya commented 8 months ago

I would like to work on this issue . Shreeya TY IT UIT2021810

ManasiGDeshmukh commented 8 months ago

@bargeshreeya Happy Coding!!