Topological Sort DSA Problems

36 topological sort problems for coding interviews and campus placements, with hints and company tags. Below are all 36: 0 easy, 15 medium and 21 hard. Practise them free on InternHack and track what you have solved.

Topological Sort problems, easiest first

  1. All Ancestors of a Node in a Directed Acyclic Graph (Medium)
  2. All Paths from Source Lead to Destination (Medium)
  3. Apply Substitutions (Medium)
  4. Course Schedule (Medium)
  5. Course Schedule II (Medium)
  6. Course Schedule IV (Medium)
  7. Find All Possible Recipes from Given Supplies (Medium)
  8. Find Eventual Safe States (Medium)
  9. Loud and Rich (Medium)
  10. Minimum Height Trees (Medium)
  11. Number of Restricted Paths From First to Last Node (Medium)
  12. Number of Ways to Arrive at Destination (Medium)
  13. Parallel Courses (Medium)
  14. Sequence Reconstruction (Medium)
  15. Tree Diameter (Medium)
  16. Alien Dictionary (Hard)
  17. Build a Matrix With Conditions (Hard)
  18. Cat and Mouse (Hard)
  19. Cat and Mouse II (Hard)
  20. Collect Coins in a Tree (Hard)
  21. Count Ways to Build Rooms in an Ant Colony (Hard)
  22. Design Excel Sum Formula (Hard)
  23. Distance to a Cycle in Undirected Graph (Hard)
  24. Frequencies of Shortest Supersequences (Hard)
  25. Largest Color Value in a Directed Graph (Hard)
  26. Longest Cycle in a Graph (Hard)
  27. Longest Increasing Path in a Matrix (Hard)
  28. Longest Path With Different Adjacent Characters (Hard)
  29. Maximum Employees to Be Invited to a Meeting (Hard)
  30. Minimize Maximum Value in a Grid (Hard)
  31. Minimum Runes to Add to Cast Spell (Hard)
  32. Number of Increasing Paths in a Grid (Hard)
  33. Parallel Courses III (Hard)
  34. Rank Transform of a Matrix (Hard)
  35. Sort Items by Groups Respecting Dependencies (Hard)
  36. Strange Printer II (Hard)

Companies that ask topological sort problems

Before your interview

Most resumes are filtered by software before a recruiter reads them. Check your resume ATS score free, no signup needed.

Other DSA topics