Skip to content

Commit da10cef

Browse files
authored
Create maximum-xor-after-operations.cpp
1 parent 603af80 commit da10cef

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

C++/maximum-xor-after-operations.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Time: O(n)
2+
// Space: O(1)
3+
4+
// bit manipulation
5+
class Solution {
6+
public:
7+
int maximumXOR(vector<int>& nums) {
8+
return accumulate(cbegin(nums), cend(nums), 0,
9+
[](const auto& a, const auto& b) {
10+
return a | b;
11+
});
12+
}
13+
};

0 commit comments

Comments
 (0)