We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2d6102a commit f484e81Copy full SHA for f484e81
scripts/algorithms/X/XOR Operation in an Array/XOR Operation in an Array.cpp
@@ -1,13 +1,14 @@
1
+// Runtime: 3 ms (Top 38.21%) | Memory: 6 MB (Top 42.79%)
2
class Solution {
3
public:
- int xorOperation(int n, int start) {
4
+ int xorOperation(int n, int start) {
5
- int res = start;
6
+ int res = start;
7
- for(int i=1 ; i<n ; i++){
8
- res = res ^ (start + 2 * i);
9
- }
+ for(int i=1 ; i<n ; i++){
+ res = res ^ (start + 2 * i);
10
+ }
11
- return res;
12
13
-};
+ return res;
14
+};
0 commit comments