TikTok Interview Question

SQL question with window function