ZS Associates interview question

Design an elevator algorithm