SORT-COLORS problem with one-pass solution