← Amazon questions

Arrangement based on hate relationships

Filed under Amazon

Given n numbers and a set of constraints 'i hates j' (meaning i must appear before j), return a valid ordering of the numbers. If no such ordering exists, return an empty list.

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Amazon questions

Collected from public candidate posts and coding forums. Updated Nov 2026.