package leetcode;

import java.util.Arrays;

/**
 * https://leetcode.com/problems/decode-xored-array/
 */
public class Problem1720 {
    public int[] decode(int[] encoded, int first) {
        // TODO
        return null;
    }

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

@@ -16,34 +16,8 @@
 e;%0A%0A
-import java.util.Arrays;%0A%0A
 /**%0A
@@ -164,322 +164,214 @@
     
-// TODO%0A        return null
+int%5B%5D answer = new int%5Bencoded.length + 1%5D
 ;%0A    
-%7D%0A%0A
     
-public static void main(String%5B%5D args) %7B%0A        Problem1720 prob = new Problem1720();%0A        System.out.println(Arrays.toString(prob.decode(new int%5B%5D%7B1,2,3%7D, 1))); // %5B1,0,2,1%5D%0A        System.out.println(Arrays.toString(prob.decode(new int%5B%5D%7B6,2,7,3%7D, 4))); // %5B4,2,0,7,4%5D
+answer%5B0%5D = first;%0A        for (int i = 0; i %3C encoded.length; i++) %7B%0A            answer%5Bi + 1%5D = answer%5Bi%5D %5E encoded%5Bi%5D;%0A        %7D%0A        return answer;
 %0A   

Solve problem 1720