Given an array nums containing only 0,
1, and 2, sort the array in-place so that
all 0s come first, followed by 1s, then 2s.
Input: [2,0,2,1,1,0]
Output: [0,0,1,1,2,2]
Input: [2,0,1]
Output: [0,1,2]
Runner expects a single line JSON array and prints the sorted array.
No submissions yet.
Discuss counting vs Dutch National Flag algorithm.