Zupee interview question

Data frame question with some group by strategies and window function .