Skip to content

Commit

Permalink
1720
Browse files Browse the repository at this point in the history
  • Loading branch information
isinsuarici committed Jan 6, 2022
1 parent 6394da0 commit 9368388
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions E_1720_DecodeXORedArray.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
public int[] decode(int[] encoded, int first) {
int[] sonuc = new int[encoded.length+1];

sonuc[0] = first;


for (int i = 1; i <= encoded.length; i++) {

for (int j=0; j<=Math.pow(10,5); j++) {
if((sonuc[i-1]^j)==encoded[i-1]){
sonuc[i]=j;
break;
}
}
}return sonuc;
}

0 comments on commit 9368388

Please sign in to comment.