Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Number of Ways to Arrive at Destination #58

Open
Chaitralikore opened this issue Oct 25, 2023 · 2 comments
Open

Number of Ways to Arrive at Destination #58

Chaitralikore opened this issue Oct 25, 2023 · 2 comments

Comments

@Chaitralikore
Copy link

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:

  • 0 6
  • 0 4 6
  • 0 1 2 5 6
  • 0 1 3 5 6
@bargeshreeya
Copy link
Contributor

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

@ManasiGDeshmukh
Copy link
Contributor

@bargeshreeya Happy Coding!!

bargeshreeya added a commit to bargeshreeya/CompetitiveProgramming-HacktoberFest23 that referenced this issue Oct 28, 2023
ManasiGDeshmukh added a commit that referenced this issue Oct 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants