Weedmaps interview question

General sorting algorithm with a simple caveat. Do not remember the specific question at this time.