@@ -0,0 +1,678 @@
+package problems;%0A%0Aimport java.util.Arrays;%0A%0A/**%0A * Leetcode: Wiggle Sort II%0A * Created by alan on 2/25/2016.%0A */%0Apublic class WiggleSort2 %7B%0A    public void wiggleSort(int%5B%5D nums) %7B%0A        int n = nums.length;%0A        Arrays.sort(nums);%0A        int%5B%5D temp = new int%5Bn%5D;%0A        int l = (n - 1) / 2, r = n - 1;%0A        for (int i = 0; i %3C n; i++)%0A            temp%5Bi%5D = (i %25 2) == 0 ? nums%5Bl--%5D : nums%5Br--%5D;%0A%0A        System.arraycopy(temp, 0, nums, 0, n);%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        WiggleSort2 ws = new WiggleSort2();%0A        int%5B%5D nums = %7B1,1,2,1,2,2,1%7D;%0A%0A        ws.wiggleSort(nums);%0A        System.out.println(Arrays.toString(nums));%0A    %7D%0A%7D%0A

Add Wiggle Sort II