Flipkart interview question

SQL self join question, window function (lead lag)