You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: solution/2900-2999/2997.Minimum Number of Operations to Make Array XOR Equal to K/README_EN.md
+28-38
Original file line number
Diff line number
Diff line change
@@ -48,36 +48,31 @@ It can be shown that we cannot make the XOR equal to k in less than 2 operations
48
48
49
49
## Solutions
50
50
51
+
**Solution 1: Bit Manipulation**
52
+
53
+
We can perform a bitwise XOR operation on all elements in the array $nums$. The number of bits that differ from the binary representation of $k$ in the result is the minimum number of operations.
54
+
55
+
The time complexity is $O(n)$, where $n$ is the length of the array $nums$. The space complexity is $O(1)$.
0 commit comments