image_2021-10-26_12-58-50.png
26.5 KB
#N1720. Decode XORed Array
problem link=>https://leetcode.com/problems/decode-xored-array/
#solution
problem link=>https://leetcode.com/problems/decode-xored-array/
#solution
class Solution {
public int[] decode(int[] encoded, int first) {
int[] arr=new int[encoded.length+1];
arr[0]=first;
for(int i=0; i<encoded.length; i++){
arr[i+1]=arr[i]^encoded[i];
}
return arr;
}
}