Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit e901b74

Browse files
add 1720
1 parent c365dec commit e901b74

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ _If you like this project, please leave me a star._ ★
88

99
| # | Title | Solutions | Video | Difficulty | Tag
1010
|-----|----------------|---------------|--------|-------------|-------------
11+
|1720|[Decode XORed Array](https://leetcode.com/problems/decode-xored-array/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1720.java) ||Easy|Bit Manipulation|
1112
|1718|[Construct the Lexicographically Largest Valid Sequence](https://leetcode.com/problems/construct-the-lexicographically-largest-valid-sequence/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1718.java) ||Medium|Backtracking, Recursion|
1213
|1716|[Calculate Money in Leetcode Bank](https://leetcode.com/problems/calculate-money-in-leetcode-bank/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1716.java) ||Easy|Math, Greedy|
1314
|1711|[Count Good Meals](https://leetcode.com/problems/count-good-meals/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1711.java) ||Medium|Array, HashTable, Two Pointers|
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package com.fishercoder.solutions;
2+
3+
public class _1720 {
4+
public static class Solution1 {
5+
public int[] decode(int[] encoded, int first) {
6+
int[] arr = new int[encoded.length + 1];
7+
arr[0] = first;
8+
for (int i = 0; i < encoded.length; i++) {
9+
arr[i + 1] = encoded[i] ^ arr[i];
10+
}
11+
return arr;
12+
}
13+
}
14+
}

0 commit comments

Comments
 (0)