FRND Interview Question

windows function and basic group by