Amazon interview question

Multiple tasks handling