leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE

commit fb34762967dd0c38ec9f9c7ca6a99a4603bf9163
parent a81939f28326b175efee5134855171369447d4d6
author Dimitrije Dobrota <mail@dimitrijedobrota.com>
date Thu, 26 Dec 2024 14:20:51 +0100

1 Random Problem

Diffstat:
A Problems/1835.cpp | +++++++++
M README.md | +

2 files changed, 10 insertions(+), 0 deletions(-)


diff --git a/ Problems/1835.cpp b/ Problems/1835.cpp

@@ -0,0 +1,9 @@
class Solution {
public:
int getXORSum(const vector<int> &arr1, const vector<int> &arr2) const {
static const auto count = [](const auto &arr) {
return accumulate(begin(arr), end(arr), 0, bit_xor());
};
return count(arr1) & count(arr2);
}
};

diff --git a/ README.md b/ README.md

@@ -1112,6 +1112,7 @@ reference and a base for solving problems. | 1829 | Medium | [Maximum XOR for Each Query](Problems/1829.cpp) | | 1833 | Medium | [Maximum Ice Cream Bars](Problems/1833.cpp) | | 1834 | Medium | [Single-Threaded CPU](Problems/1834.cpp) |
| 1835 | Hard | [Find XOR Sum of All Pairs Bitwise AND](Problems/1835.cpp) |
| 1838 | Medium | [Frequency of the Most Frequent Element](Problems/1838.cpp) | | 1839 | Medium | [Longest Substring Of All Vowels in Order](Problems/1839.cpp) | | 1845 | Medium | [Seat Reservation Manager](Problems/1845.cpp) |