Question: In a small building people are queued up in front of the elevator. Every person weighs a certain amount of kilograms and needs a lift
# [100, 160, 150, 30, 70, 200], [2, 4, 2, 6, 5, 3], 2, 250 # 11 # # [70, 80, 100], [2, 3, 5], 2, 150 # 5 # # [100, 70, 80], [3, 2, 2], 2, 150 # 4 # # [10, 20, 100, 20, 200, 30, 70], [2, 3, 4, 5, 6, 7, 8], 2, 200 # 11 #
def elevator_task(people, floors, max_ppl, max_kg):
In a small building people are queued up in front of the elevator. Every person weighs a certain amount of kilograms and needs a lift to a specific floor within the building. Calculate how many courses we would need to transfer all the people to their desired floors while keeping within the elevator restrictions for weight and max people allowed inside and without breaking queue order. Moving from one floor to another counts as a course. Going back to ground floor is one course as well. # [100, 160, 150, 30, 70, 2001, 12, 4, 2, 6, 5, 3], 2, 250 #11 # # [70, 80, 100], [2, 3, 51, 2, 150 #5 # # [100, 70, 801, 13, 2, 2, 2, 150 # #4 # # [10, 20, 100, 20, 200, 30, 701, 12, 3, 4, 5, 6, 7, 81, 2, 200 #11 # def elevator_task(people, floors, max_ppl, max_kg)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
