From 8cb8552d41fffad8573f2fc7beceb236fc9fb59e Mon Sep 17 00:00:00 2001 From: chayan das <110921638+Chayandas07@users.noreply.github.com> Date: Thu, 16 Jan 2025 22:39:38 +0530 Subject: [PATCH] Create 2425. Bitwise XOR of All Pairings --- 2425. Bitwise XOR of All Pairings | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 2425. Bitwise XOR of All Pairings diff --git a/2425. Bitwise XOR of All Pairings b/2425. Bitwise XOR of All Pairings new file mode 100644 index 0000000..8849748 --- /dev/null +++ b/2425. Bitwise XOR of All Pairings @@ -0,0 +1,14 @@ +class Solution { +public: + int xorAllNums(vector& nums1, vector& nums2) { + int n1=nums1.size(), n2=nums2.size(); + unordered_mapfreq; + for(int n:nums1) freq[n]+=n2; + for(int n:nums2) freq[n]+=n1; + int res=0; + for(auto& [n,c]:freq){ + if(c%2==1) res^=n; + } + return res; + } +};