ZS Associates interview question

Window function, subquery, SQL , Excel