THIS.<p>However, the criterion you&#x27;re optimizing for is still unclear. Should it be:
a) the total number of steps the elevator takes
b) the average number of steps each user has to wait
c) the maximum number of steps each user has to wait
d) the 90th percentile of user waiting steps<p>Note: here, I&#x27;m counting the steps spent waiting for an elevator as well as the steps spent in the elevator till the destination as the same, but presumably you&#x27;d want to count steps spent inside the elevator as costlier, further complicating matters.<p>And this not even considering what happens if your algorithm answers 20 calls, without going to any destination floors, when the elevator capacity is only 10 people.<p>That&#x27;s what makes this such an interesting problem.