Skip to content

Commit 0d82f2d

Browse files
committed
Time: 1 ms (100.00%), Space: 39.7 MB (89.12%) - LeetHub
1 parent b830e8b commit 0d82f2d

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*
2+
I: int[], int
3+
O: int[]
4+
C
5+
E
6+
Solution
7+
*/
8+
class Solution {
9+
public int[] decode(int[] encoded, int first) {
10+
int[] res = new int[encoded.length+1];
11+
res[0] = first;
12+
for(int i=0; i < encoded.length; i++){
13+
res[i+1] = encoded[i] ^ res[i];
14+
}
15+
return res;
16+
}
17+
}

0 commit comments

Comments
 (0)