Skip to content

Commit 487c019

Browse files
author
Joseph Luce
authored
Update Minimize_road_between_stations.md
1 parent fa01ca2 commit 487c019

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

real_interview_questions/Google/Minimize_road_between_stations.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ The question want us to figure out which sections of roads should we place a new
3030

3131
However, there are a few edge cases to consider. We want to avoid evaluating sections of roads that have no length. Also what happens when we revisit the same section of road? If that happens, we need to restart the process of replacing the stations on that road if there were any. So we need to keep a few key peices of information. The total length of this section of road, the current number of stations on this road and the distance between each station on this road. The distance between each station on this road will be used to sort the max heap.
3232

33+
When I was given this question. I was only given 30 mins. So you can attempt the solution with indexes which is much hard but not necessary to pass the interview.
34+
3335
# SOLUTION 1
3436
```
3537
import heapq

0 commit comments

Comments
 (0)