TikTok Interview Question

Implement topological sort given transitions