C++ Easy Approach faster than 91% , O(n^3) . Two Pointer Approach
\nvector> fourSum(vector& nums, int target) {\n        \n        vector> ans;\n        int n= nums.size();\n        \n        // If length of array is smaller t
\nvector<vector<int>> fourSum(vector<int>& nums, int target) {\n        \n        vector<vector<int>> ans;\n        int n= nums.size();\n        \n        // If length of array is smaller than 4 then no quadruplet can be formed.\n        if(n<4) return ans;\n        \n        sort(nums.begin(),nums.end()); // to apply two pointer approach\n        \n        for(int i=0 ; i<n ; i++){\n            \n            long long int a = nums[i];\n            \n            for(int j=i+1 ; j<n ; j++){\n                \n                long long int b= nums[j];\n                \n                // two element are now fixed one at i and other at j\n                \n                // applying two pointer approach over the remaining two\n                \n                int s = j+1;\n                int e = n-1;\n                \n                \n                while(s<e){\n                    \n                    long long int x = nums[s];\n                    long long int y = nums[e];\n                    \n                    long long int sum = x+y+a+b;\n                    \n                    if(sum == target){\n                        // Need to make all a,b,c,d back to int as ans is a vector of vector of int\n                        ans.push_back({int(a),int(b),int(x),int(y)});\n                        \n                        // skipping same value of x and y\n                        \n                        while(s<e and nums[s] == x){\n                            s++;\n                        }\n                        \n                        while(s<e and nums[e] == y){\n                            e--;\n                        }\n                        \n                    }\n                    \n                    else if(sum > target){\n                        e--;\n                    }\n                    \n                    else{\n                        s++;\n                    }\n                    \n                }\n                \n                // skipping same value at jth point\n            \n                while(j+1<n and nums[j+1] == nums[j]){\n                    j++;\n                }  \n                \n            }\n            // skipping same value at ith point\n            while(i+1<n and nums[i+1] == nums[i]){\n                i++;\n            } \n            \n        }\n        \n        \n        return ans;\n        \n        \n    }
['Two Pointers', 'C', 'Binary Tree']