Flipkart Interview Question for SDE-2s
- 1of 1 vote
An extension of Dijkstra's algorithm:- poorna.chandra.akp April 28, 2014 in United States
In a graph each vertex represents a city.
And each edge defines the connectivity between two vertices.
Each edge has two more information
1) the distance between the two vertices
2) A Boolean flag indicating if the destination is uphill or downhill to the source.
One constraint: you can change the path from uphill to downhill or downhill to uphill only once.
E.g: initially if you are going up the hill and at some point choosed to go down the hill, you can not change to take a path which is uphill again..
Similarly you are going down the hill and at some point choosed to go up the hill, you can not change to take a path which is down hill again..
O/P: find the shortest path between source to destination.
| Report Duplicate | Flag | PURGE
Interview Type: In-Person
Open Chat in New Window