C++ Solution : 4Sum || Two Pointer Approach || Using Two Sum || O(N^3)
1. Two Pointer Approach\n Pre-requisites - Two Sum , 3Sum (For better understanding)\n Time Complexity - O(N^3)\n\nclass Solution {\npublic:\n    vector<vector<
**1. Two Pointer Approach**\n* Pre-requisites - [Two Sum](https://leetcode.com/problems/two-sum/) , [3Sum](https://leetcode.com/problems/3sum//) (For better understanding)\n* Time Complexity - O(N^3)\n```\nclass Solution {\npublic:\n    vector<vector<int>> fourSum(vector<int>& nums, int target) {\n        int n = nums.size();\n        //start & end pointers\n        int s, e;\n        //initializing answer vector\n        vector<vector<int>> ans;\n        //initializing set\n        set<vector<int>> st;\n        sort(nums.begin(), nums.end());\n        \n        //Edge Case\n        if(n < 4){\n            return ans;\n        }\n        \n        // fixing first element of quadruplets \n        for(int i = 0; i < n; i++){\n            // fixing second element of quadruplets \n            for(int j = i+1; j < n; j++){\n                // now we are left with 2SUM problem\n                //intializing start and end\n                s = j + 1;\n                e = n - 1;\n                \n                while(s < e){\n                    \n                    if((long) nums[i] + nums[j] + nums[s] + nums[e] == target){\n                        st.insert({nums[i], nums[j], nums[s], nums[e]});\n                        s++, e--;\n                    }\n                    else if((long) nums[i] + nums[j] + nums[s] + nums[e] > target){\n                        e--;\n                    }\n                    else{\n                        s++;\n                    }\n                }\n            }\n        }\n        \n        // storing elements of set into ans\n        for(auto i: st)\n            ans.push_back(i);\n        \n        return ans;\n    }\n};\n```\n\nPlease Upvote if is helps :)
['Two Pointers', 'C++']