Sort Colors
Medium · rating 1250 · Sorting, Two Pointers
The first line has n. The second line has n integers, each 0, 1, or 2. Print them sorted in non-decreasing order, space-separated.
Constraints: 1 ≤ n ≤ 105
Related problems
- Kth Largest Element — Medium
- Two Sum (Sorted) — Medium
- Anagram Check — Medium
- Count Distinct (Sorted) — Medium
- Intersection of Two Arrays — Medium
- K-th Smallest Element — Medium