Booking.com | Phone Codind | Top K Hotels
Anonymous User
2978

Find the top K closest hotels within a price range. In the input grid 0 means a blocker which you can't pass through, 1 means road which you can use to navigate, any value above 1 is the price of the hotel located at x,y. You will be given this grid, price range and origin coordinates. You should return K hotels within price range and closest to the given origin.

Input:
[[1,2,0,1],
[1,3,0,1],
[0,2,5,1]
]

Any Idea how to approach this question?

Anyone got same question in their interview with booking.com?

Comments (2)