AnalystPath

YouTube Most-Flagged Videos (Approved Only)

PandasMediumMid levelYouTube~15 min

Problem

**[Asked at YouTube]**

Find the videos that were flagged by the **most distinct users**, considering
only flags where `is_approved = 1`.

If multiple videos tie at the maximum, return all of them.

Return `title` and `flag_count`, ordered by title.

Input data

Example rows — the live problem includes the full dataset.

flags
flag_iduser_idvideo_idis_approved
110111
210211
310311
410111
510121
videos
video_idtitle
1Cat Compilation
2Dance Tutorial
3Cooking Show
4Travel Vlog

Expected output

Your answer should return 1 row with the columns title, flag_count.

Starter code (Pandas (Python))

import pandas as pd

def most_flagged_videos(flags: pd.DataFrame, videos: pd.DataFrame) -> pd.DataFrame:
    # Your code here
    return flags

Solve this Pandas question free

Write Pandas (Python) and run it instantly in your browser — even on your phone. No signup needed to try.

Solution & explanation

Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.

Sign up free to unlock

Related Pandas questions