75. Sort Colors
public class Solution { public void sortColors(int[] nums) { int lo=0; int hi=nums.length-1; int idx=0; while(idx<=hi) { if(nums[idx]==0) { nums[idx]=nums[lo]; nums[lo]=0; lo++; } else if(nums[idx]==2) { nums[idx]=nums[hi]; nums[hi]=2; hi--; idx--; } idx++; } } }