Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 1203. Sort Items by Groups Respecting Dependencies
Order n items subject to precedence constraints while ensuring all items of the same group appear consecutively. The core challenge is to perform topological sorting (with cycle detection) on both item and group dependency graphs—after assigning unique groups to ungrouped items—to produce a valid grouped ordering or return empty if impossible.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.