leetcode

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

commit d1a29b04a40e7bb92438c36a1f5388ba506e182d
parent bbb2aa0798c50becb077e9f7be3322515800451e
Author: Dimitrije Dobrota <mail@dimitrijedobrota.com>
Date:   Thu, 21 Dec 2023 21:24:38 +0000

1 Random Problem

Diffstat:
AProblems/2425.cpp | 11+++++++++++
MREADME.md | 1+
2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/Problems/2425.cpp b/Problems/2425.cpp @@ -0,0 +1,11 @@ +class Solution { + public: + int xorAllNums(const vector<int> &nums1, const vector<int> &nums2) const { + int a = 0, b = 0; + for (const int n : nums1) + a ^= n; + for (const int n : nums2) + b ^= n; + return (nums2.size() % 2 * a) ^ (nums1.size() % 2 * b); + } +}; diff --git a/README.md b/README.md @@ -963,6 +963,7 @@ for solving problems. | 2415 | Medium | [Reverse Odd Levels of Binary Tree](Problems/2415.cpp) | | 2421 | Medium | [Number of Good Paths](Problems/2421.cpp) | | 2423 | Easy | [Remove Letter To Equalize Frequency](Problems/2423.cpp) | +| 2425 | Medium | [Bitwise XOR of All Pairings](Problems/2425.cpp) | | 2428 | Medium | [Maximum Sum of an Hourglass](Problems/2428.cpp) | | 2433 | Medium | [Find The Original Array of Prefix Xor](Problems/2433.cpp) | | 2439 | Medium | [Minimize Maximum of Array](Problems/2439.cpp) |