java: add «2683. Neighboring Bitwise XOR»
URL: https://leetcode.com/problems/neighboring-bitwise-xor/ Signed-off-by: Matej Focko <me@mfocko.xyz>
This commit is contained in:
parent
9565215eba
commit
6faa91bc6d
1 changed files with 11 additions and 0 deletions
11
java/neighboring-bitwise-xor.java
Normal file
11
java/neighboring-bitwise-xor.java
Normal file
|
@ -0,0 +1,11 @@
|
|||
class Solution {
|
||||
public boolean doesValidArrayExist(int[] derived) {
|
||||
var cumXor = 0;
|
||||
|
||||
for (var x : derived) {
|
||||
cumXor ^= x;
|
||||
}
|
||||
|
||||
return cumXor == 0;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue