Amazon interview question

Explain this piece of code efficiently