Leetcode in Java && Oracle
421 subscribers
8 photos
397 files
400 links
Second channel: @codeforces_java

Let's Develop Together!
Download Telegram
image_2021-11-01_04-03-50.png
26.6 KB
#N1486. XOR Operation in an Array
problem link=>https://leetcode.com/problems/xor-operation-in-an-array/

#solution
class Solution {
public int xorOperation(int n, int start) {
int ans=0;

while(n-- > 0){
ans ^= start;
start+=2;
}

return ans;
}
}