TikTok Interview Question

Traversing a Graph and using other data structures