Amazon interview question

Organized the tasks given in simulation