C# same as 3SUM
\npublic class Solution {\n    public IList<IList<int>> FourSum(int[] nums, int target) {\n        var n = nums.Length;\n        Array.Sort(nums);\n\n        va
```\npublic class Solution {\n    public IList<IList<int>> FourSum(int[] nums, int target) {\n        var n = nums.Length;\n        Array.Sort(nums);\n\n        var result = new List<IList<int>>();\n\n        for (int i = 0; i < n; i++) {\n            if (i > 0 && nums[i - 1] == nums[i]) continue;\n            for (int j = i + 1; j < n; j++) {\n                if (j > i + 1 && nums[j - 1] == nums[j]) continue;\n                var left = j + 1;\n                var right = n - 1;\n\n                while (left < right) {\n                    var sum = nums[i] + nums[j] + nums[left] + nums[right];\n                    if (sum == target) {\n                        result.Add(new List<int>() { nums[i], nums[j], nums[left], nums[right] });\n\n                        while (left < right && nums[left] == nums[left + 1]) left++;\n                        while (left < right && nums[right] == nums[right - 1]) right--;\n                        \n                        left++;\n                        right--;\n                    } else if (sum < target) {\n                        left++;\n                    } else {\n                        right--;\n                    }\n                }\n            }\n        }\n\n        return result;\n    }\n}\n```
[]