Given an array that only contains 0s and 1s, rearrange it in place so all the 0s come before all the 1s, in a single pass.
Example 1
Explanation: All three 0s move to the front and all three 1s move to the back; the exact order within each group isn't required.
Example 2
Explanation: The same two-way partition is produced even when the input arrives 1s-first.
Example 3
Explanation: An array of a single repeated value is already segregated.
Code execution is coming soon.