标签:style blog color io for div sp log on
public class Solution { public void sortColors(int[] A) { for (int i=0,j=0,k=A.length-1; j<=k; ) { if (A[j] == 0) { int tmp = A[i]; A[i] = A[j]; A[j] = tmp; i++; j++; } else if (A[j] == 2) { int tmp = A[k]; A[k] = A[j]; A[j] = tmp; k--; } else if (A[j] == 1) { j++; } } } }
标签:style blog color io for div sp log on
原文地址:http://www.cnblogs.com/yuhaos/p/3955080.html