Apple interview question

Dutch flag algorithm related problem