Skip to content

Commit 9368388

Browse files
committed
1720
1 parent 6394da0 commit 9368388

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

E_1720_DecodeXORedArray.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
public int[] decode(int[] encoded, int first) {
2+
int[] sonuc = new int[encoded.length+1];
3+
4+
sonuc[0] = first;
5+
6+
7+
for (int i = 1; i <= encoded.length; i++) {
8+
9+
for (int j=0; j<=Math.pow(10,5); j++) {
10+
if((sonuc[i-1]^j)==encoded[i-1]){
11+
sonuc[i]=j;
12+
break;
13+
}
14+
}
15+
}return sonuc;
16+
}

0 commit comments

Comments
 (0)