LeetCode: https://leetcode.com/problems/sort-colors/
Given an array nums with n objects colored red, white, or blue (0, 1, 2), sort them in-place so that objects of the same color are adjacent.
Use the Dutch National Flag algorithm in one pass.
l
i
2
0
0
1
2
2
1
3
1
4
r
0
5
Step 1 / 7
Step 1:
Initialize three pointers: l (next 0), i (current), r (next 2).
Pointers: i=0, l=0, r=5
Focus: select @ [0, 5]