/**
* @param {number[]} nums
* @return {void} Do not return anything, modify nums in-place instead.
*/
var sortColors = function(nums) {
// red, white, bluev => 0, 1, 2
// 0
// 1
const len = nums.length;
let offset = 0;
for (let c = 0; c <= 1; c++) {
let temp;
for (let i = 0; i < len; i++) {
if (c === nums[i]) {
temp = nums[offset];
nums[offset] = nums[i];
nums[i] = temp;
offset++;
}
// console.log(nums, offset);
}
}
};