A Java Solution with Two Pointers
 public List<List<Integer>> fourSum(int[] nums, int target) {\n        \tList<List<Integer>> result = new ArrayList<List<Integer>>();\n        \tif (nums == nul
     public List<List<Integer>> fourSum(int[] nums, int target) {\n        \tList<List<Integer>> result = new ArrayList<List<Integer>>();\n        \tif (nums == null || nums.length < 4) {\n        \t\treturn result;\n        \t}\n        \tArrays.sort(nums);\n        \tfor (int i = 0; i < nums.length - 3; i ++) {\n        \t\tfor (int j = i + 1; j < nums.length - 2; j ++) {\n        \t\t\tint head = j + 1;\n        \t\t\tint tail = nums.length - 1;\n        \t\t\twhile (head < tail) {\n        \t\t\t\tint tempSum = nums[i] + nums[j] + nums[head] + nums[tail];\n        \t\t\t\tif (tempSum == target) {\n        \t\t\t\t\tList<Integer> item = new ArrayList<Integer>();\n        \t\t\t\t\titem.add(nums[i]);\n        \t\t\t\t\titem.add(nums[j]);\n        \t\t\t\t\titem.add(nums[head]);\n        \t\t\t\t\titem.add(nums[tail]);\n        \t\t\t\t\tif (result.contains(item) == false) {\n        \t\t\t\t\t\tresult.add(item);\n        \t\t\t\t\t} \n        \t\t\t\t\thead ++;\n        \t\t\t\t\ttail --;\n        \t\t\t\t} else if (tempSum < target) {\n        \t\t\t\t\thead ++;\n        \t\t\t\t} else {\n        \t\t\t\t\ttail --;\n        \t\t\t\t}\n        \t\t\t}\n        \t\t}\n        \t}\n        \treturn result;\n        }
[]