Solve Shortest Paths and Rental Allocation | Google Interview Question