TikTok Interview Question

A graph problem 30 30 30