g2601_2700.s2683_neighboring_bitwise_xor.Solution Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of leetcode-in-java Show documentation
Show all versions of leetcode-in-java Show documentation
Java-based LeetCode algorithm problem solutions, regularly updated
package g2601_2700.s2683_neighboring_bitwise_xor;
// #Medium #Array #Bit_Manipulation #2023_09_12_Time_2_ms_(100.00%)_Space_59.9_MB_(62.03%)
public class Solution {
public boolean doesValidArrayExist(int[] derived) {
int xor = 0;
for (int j : derived) {
xor = xor ^ j;
}
return xor == 0;
}
}