โ† Amazon questions

Sort tags in O(n)

Filed under Amazon

Given an array of elements where each element has an associated tag from 0 to K-1 (where K is large, e.g., 10,000), sort the array in O(n) time to group elements by their tags in ascending order.

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.