Peek Interview Question

Explain in detail the code you wrote