Simple Hashmap Implementation || C++|| Intution Explained
Intution : We take a unorederd map and then calculate 2 sum of all the possiblities of i and j pair and store it in the map besides there indexes and then we ru
Intution : We take a unorederd map and then calculate 2 sum of all the possiblities of i and j pair and store it in the map besides there indexes and then we run a loop and for every i and j we do target - arr[i]-arr[j] and then try to find it in the map if it exists that means this is a possible answer qudraplet .\n\n```\nclass Solution {\npublic:\n    vector<vector<int>> fourSum(vector<int>& nums, int target) {\n        vector<vector<int>> ans;\n        int n=nums.size();\n        if(n<4) return ans;\n        sort(nums.begin(),nums.end());\n        unordered_map<int,vector<pair<int,int>>> mp;\n        for(int i=0;i<n-1;i++)\n        {\n            for(int j=i+1;j<n;j++)\n            {\n                mp[nums[i]+nums[j]].push_back({i,j});//making 2 sum map\n            }\n        }\n        for(int i=0;i<n-1;i++)\n        {\n               if(i>0 and nums[i]==nums[i-1])  continue;\n            for(int j=i+1;j<n;j++)\n            {\n                if(j>i+1 and nums[j]==nums[j-1])  continue;\n                int sum=target-nums[i]-nums[j];\n                if(mp.find(sum)!=mp.end())\n                {\n                    for(auto it : mp[sum])\n                    {\n                        int k=it.first;\n                        int l=it.second;\n                        if(k>j){\n                            if(!ans.empty()&& ans.back()[0]==nums[i]&&ans.back()[1]==nums[j]&&ans.back()[2]==nums[k]&&ans.back()[3]==nums[l]) continue;\n                            vector<int> temp={nums[i],nums[j],nums[k],nums[l]};\n                            ans.push_back(temp);\n                        }\n                    }\n                }\n            }\n        }\n        \n        return ans;\n    }\n};\n```\n**Up Vote this pls if you understood**
['C', 'C++']