Here's a brain teaser that's been on my mind for a few days.
We have a sequence S of n elements. Each element is an integer in the range [0, n^2-1]. Describe a simple method for sorting S in O(n) time.
Probably something obvious that I am just missing, but I'd appreciate any insight.