private boolean bt(int[] nums, int idx) {
	        // termination
	        if (idx == nums.length)
	            return true;
	        for (int j = idx; j < nums.length; j++) {
	            if (idx - 1 >= 0 && ((idx%2 == 0 && nums[j] >= nums[idx-1]) || (idx%2 == 1 && nums[j] <= nums[idx-1])))
	                continue;
	            swap(nums, idx, j); // modify
	            if (bt(nums, idx+1))
	                return true;
	            swap(nums, idx, j); // restore
	        }
	        return false;
	    }