Given an array nums with values 0, 1, and 2 representing red, white, and blue, sort them in place so that same colors are adjacent in the order red → white → blue. Do it in one pass without the library sort. Return the sorted array.
Input: one line of space-separated integers (each 0, 1, or 2). Output: the sorted array, space-separated.
2 0 2 1 1 0
0 0 1 1 2 2
2 0 1
0 1 2
Run your code against the sample tests, or Submit to run the full suite.