Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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, 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):
Test Cases explanation
weight of passengers, floor on elevator the passenger needed to get to, max people, max weight
11 is what the first test case should print
# [100, 160, 150, 30, 70, 200], [2, 4, 2, 6, 5, 3], 2, 250 # 11 Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started