How would you solve the Dutch national flag algorithm problem?
Given an array containing only 0, 1, and 2, sort it in place so all 0s come first, followed by 1s, then 2s. Return the same array after modification. Aim for one pass, constant extra space, and no built-in sorting.
def sort_colors(nums):