Mutiny interview question

It was a typical coding interview question