Amazon Interview Question

Explain this piece of code efficiently

Glassdoor | Glassdoor