Skip to content

Commit 8be85f2

Browse files
Create xor-op-in-array.java
1 parent e87abfe commit 8be85f2

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Java/xor-op-in-array.java

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class Solution {
2+
public int xorOperation(int n, int start) {
3+
int xor = start;
4+
5+
for(int i=1; i<n; i++){
6+
xor ^= start + 2 * i;
7+
}
8+
9+
return xor;
10+
}
11+
}

0 commit comments

Comments
 (0)