Pergunta de entrevista da empresa OYO

One tricky question based on WINDOW functions - LEAD & LAG.