Google | Final Interview | Elevator Question DP
Anonymous User
1268

Hey i got a dp question for google today and couldn't solve it,
So this is a elevator themed problem and everyone has a weight and a target floor.

Ex)
Weight =[5,1,6,2] target floor=[2,6,3,5]

So the first person has a weight of 5 and is trying to go to the 2nd floor and the second person has a weight of 1 and is trying to go to floor 6 and so on.
We have a weight limit of let’s say 7. Then using dp, we have to figure out the least number of floors(moves) that the elevator can make given the weight limit.
(Also for example, if a person going to floor 5 and floor 3 get on the same elevator, the elevator makes one trip to the 5th floor and back)

Comments (5)