We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e87abfe commit 8be85f2Copy full SHA for 8be85f2
Java/xor-op-in-array.java
@@ -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