package leetcode;

import java.util.Arrays;

/**
 * https://leetcode.com/problems/sort-array-by-parity/
 */
public class Problem905 {
    public int[] sortArrayByParity(int[] A) {
        // TODO
        return null;
    }

    public static void main(String[] args) {
        Problem905 prob = new Problem905();
        System.out.println(Arrays.toString(prob.sortArrayByParity(new int[]{3, 1, 2, 4}))); // [2,4,3,1]
    }
}

@@ -16,34 +16,8 @@
 e;%0A%0A
-import java.util.Arrays;%0A%0A
 /**%0A
@@ -159,237 +159,365 @@
     
-// TODO%0A        return null
+int%5B%5D result = new int%5BA.length%5D;%0A        int idx = 0
 ;%0A    
-%7D%0A%0A
     
-public static void main(String%5B%5D args) %7B%0A        Problem905 prob = new Problem905();%0A        System.out.println(Arrays.toString(prob.sortArrayByParity(new int%5B%5D%7B3, 1, 2, 4%7D))); // %5B2,4,3,1%5D
+for (int i = 0; i %3C A.length; i++) %7B%0A            if (A%5Bi%5D %25 2 == 0) %7B%0A                result%5Bidx++%5D = A%5Bi%5D;%0A            %7D%0A        %7D%0A        for (int i = 0; i %3C A.length; i++) %7B%0A            if (A%5Bi%5D %25 2 != 0) %7B%0A                result%5Bidx++%5D = A%5Bi%5D;%0A            %7D%0A        %7D%0A        return result;
 %0A   

Solve problem 905