Sort Colors (Dutch National Flag Problem)
Two Pointers
Problem
Given an array containing 0s, 1s and 2s, sort the array in-place. You should treat numbers of the array as objects, hence, we can’t count 0s, 1s, and 2s to recreate the array.
For example:
Solution
Last updated
Was this helpful?