Skip to content

Latest commit

 

History

History
14 lines (9 loc) · 261 Bytes

README.md

File metadata and controls

14 lines (9 loc) · 261 Bytes

Sorting a list with 3 unique numbers

This problem was asked by Google.

Description

Given a list of numbers with only 3 unique numbers (1, 2, 3), sort the list in O(n) time.

Example

Input: [3, 3, 2, 1, 3, 2, 1]
Output: [1, 1, 2, 2, 3, 3, 3]