FRND interview question

windows function and basic group by