1. Description:
Notes:
2. Examples:
3.Solutions:
1 /** 2 * Created by sheepcore on 2019-02-24 3 */ 4 class Solution { 5 public int[] sortArrayByParityII(int[] A) { 6 int k = 0, j = 1; 7 int[] res = new int[A.length]; 8 for (int i = 0; i < A.length; i++) { 9 if (A[i] % 2 == 0) { 10 res[k] = A[i]; 11 k += 2; 12 } else { 13 res[j] = A[i]; 14 j += 2; 15 } 16 } 17 return res; 18 } 19 }