package leetcode;

import java.util.List;

/**
 * https://leetcode.com/problems/array-transformation/
 */
public class Problem1243 {
    public List<Integer> transformArray(int[] arr) {
        // TODO
        return null;
    }

    public static void main(String[] args) {
        Problem1243 prob = new Problem1243();
        System.out.println(prob.transformArray(new int[]{6,2,3,4})); // [6,3,3,4]
        System.out.println(prob.transformArray(new int[]{1,6,3,4,3,5})); // [1,4,4,4,4,5]
    }
}

@@ -12,16 +12,44 @@
 tcode;%0A%0A
+import java.util.ArrayList;%0A
 import j
@@ -63,16 +63,16 @@
 l.List;%0A
-
 %0A/**%0A * 
@@ -219,35 +219,621 @@
     
-// TODO%0A        return null
+while (true) %7B%0A            boolean found = false;%0A            for (int i = 1; i %3C arr.length - 2; i++) %7B%0A                if (arr%5Bi - 1%5D %3C arr%5Bi%5D && arr%5Bi%5D %3E arr%5Bi + 1%5D) %7B%0A                    found = true;%0A                    arr%5Bi%5D--;%0A                %7D else if (arr%5Bi - 1%5D %3E arr%5Bi%5D && arr%5Bi%5D %3C arr%5Bi + 1%5D) %7B%0A                    found = true;%0A                    arr%5Bi%5D++;%0A                %7D%0A            %7D%0A            if (!found) %7B%0A                break;%0A            %7D%0A        %7D%0A        List%3CInteger%3E answer = new ArrayList%3C%3E();%0A        for (int a : arr) %7B%0A            answer.add(a);%0A        %7D%0A        return answer
 ;%0A  

Update problem 1243