C++ Solution
Code\n\nclass Solution {\npublic:\n    vector<vector<int>> fourSum(vector<int>& nums, int target) {\n        vector<vector<int>> ans;\n        sort(nums.begin()
# Code\n```\nclass Solution {\npublic:\n    vector<vector<int>> fourSum(vector<int>& nums, int target) {\n        vector<vector<int>> ans;\n        sort(nums.begin(), nums.end());\n        map<vector<int>, int> mp;\n        for(int i=0; i<nums.size()-1; i++) {\n            for(int j=i+1; j<nums.size(); j++) {\n                int l = j + 1, r = nums.size() - 1; \n                while(l < r) {\n                    long long sum = (long long) nums[i] + nums[j] + nums[l] + nums[r];\n                    if(sum == target) {\n                        mp[{nums[i], nums[j], nums[l], nums[r]}]++;\n                        if(mp[{nums[i], nums[j], nums[l], nums[r]}] == 1) ans.push_back({nums[i], nums[j], nums[l], nums[r]});\n                        l++;\n                        r--;\n                    }\n                    else if(sum < target) l++;\n                    else if(sum > target) r--;\n                }\n            }\n        }\n        return ans;\n    }\n};\n```
['C++']