Google Meet screen - Round-1 (45 mins):
Consider a matrix of m*n size, where each point denotes a mountain.
You will be given co-cordinates for villages in this town.
Consider during rainy season if water falls from highest mountain to lowest mountain, search for the highest mountain with minimum steps required to reach all the villages for the supply of water.
Find the time complexity too for above problem.
Ex:
7,1,2,4,5
6,4,6,3,2
5,2,2i,1,9
6,6,4,2,3
2,1i,3,4,6
Villages: (2,2), (4,1) - VIllages are marked as i for simplicity.
Restrictions - You can go from a High Mountain to Lower mountain only. Since water will flow from High to Low.
Village point should also be considered in the water flow.
Sample Ans - (3,1) (Multiple ans are possible, but find the mountain with minimum distance only)
Tried best to remember the question. There was some more complexity also given but that I would leave for next question if anyone finds soln. for above.