two pointer approach || easy c++ solution || beats 100%
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    vector<vector<int>> fourSum(vector<int>& nums, int target) {\n        vector<vector<int>>v;\n        sort(nums.begin(),nums.end());\n        int n=nums.size();\n        for(int i=0;i<n;i++)\n        {\n            if(i>0&& nums[i]==nums[i-1])continue;\n            for(int j=i+1;j<n;j++)\n            {\n                if(j!=(i+1) && nums[j]==nums[j-1])continue;\n                int k=j+1;\n                int l=n-1;\n                while(k<l)\n                {\n                    long long  sum=nums[i];\n                    sum+=nums[j];\n                    sum+=nums[k];\n                    sum+=nums[l];\n                    if(sum==target)\n                    {\n                    vector<int> temp={nums[i],nums[j],nums[k],nums[l]};\n                    v.push_back(temp);\n                    k=k+1;\n                    l=l-1;\n                    while(k<l && nums[k]==nums[k-1])k=k+1;\n                    while(k<l && nums[l]==nums[l+1])l=l-1;\n                    }\n                    else if(sum<target)\n                    {\n                        k++;\n                    }\n                    else{l--;}\n                }\n            }\n        } \n        return v;\n    }\n};\n```
['C++']