package com.fishercoder.solutions;

/** Given an unsorted array nums, reorder it in-place such that nums[0] <= nums[1] >= nums[2] <= nums[3]....
For example, given nums = [3, 5, 2, 1, 6, 4], one possible answer is [1, 6, 2, 5, 3, 4]*/
public class _280 {
    public void wiggleSort(int[] nums) {
        for (int i = 1; i < nums.length; i++) {
            if ((i % 2 == 0 && nums[i] > nums[i - 1]) || (i % 2 == 1 && nums[i] < nums[i - 1])) {
                swap(nums, i);
            }
        }
    }

    void swap(int[] nums, int i) {
        int temp = nums[i - 1];
        nums[i - 1] = nums[i];
        nums[i] = temp;
    }
}

@@ -32,16 +32,19 @@
 ns;%0A%0A/**
+%0A *
  Given a
@@ -251,16 +251,56 @@
  _280 %7B%0A
+    public static class Solution1 %7B%0A    
     publ
@@ -328,24 +328,28 @@
 t%5B%5D nums) %7B%0A
+    
         for 
@@ -396,16 +396,20 @@
         
+ 
+   
 if ((i %25
@@ -502,16 +502,20 @@
         
+    
 swap(num
@@ -537,18 +537,24 @@
     
-%7D%0A
+    %7D%0A  
         
 %7D%0A  
@@ -553,17 +553,27 @@
     
-%7D%0A
+  %7D%0A   
     
+ 
 %7D%0A%0A
+    
     
@@ -611,16 +611,20 @@
         
+    
 int temp
@@ -643,24 +643,28 @@
 1%5D;%0A        
+  
+  
 nums%5Bi - 1%5D 
@@ -678,24 +678,28 @@
 i%5D;%0A        
+   
+ 
 nums%5Bi%5D = te
@@ -702,16 +702,26 @@
 = temp;%0A
+        %7D%0A
     %7D%0A%7D%0A

refactor 280