Easiest approach exists on earth 🤣🤣
ApproachCheck Array Length:
First, check if the length of the input array is less than 4. If yes, return an empty array or list because we can't form a valid gr
# Approach
<!-- Describe your approach to solving the problem. -->
Check Array Length:
First, check if the length of the input array is less than 4. If yes, return an empty array or list because we can't form a valid group of 4 elements.

Sort the Array:
Sort the array in ascending order. Sorting helps us manage duplicates and makes it easier to work with combinations.

Find Unique Combinations:
Use a loop to go through the array and look for groups of 4 numbers. While looping, skip any duplicates by using an if condition to check if the current number is the same as the previous one.

Store Results:
For each valid group of 4 numbers without duplicates, add it to the result list.

Return the Result:
After completing the loops, return the list of unique combinations.

# Complexity
- Time complexity:O(n3)
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:O(k)
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```java []
class Solution {
    public List<List<Integer>> fourSum(int[] nums, int target) {
        List<List<Integer>> li=new ArrayList<>();
        if(nums==null || nums.length<4){
            return li;
        }
        Arrays.sort(nums);
        for(int i=0;i<nums.length-3;i++){
            if(i>0&&nums[i]==nums[i-1]){
                continue;
            }
            for(int j=i+1;j<nums.length-2;j++){
                if(j>i+1&&nums[j]==nums[j-1]){
                    continue;
                }
                int left=j+1; int right=nums.length-1;
                while(left<right){
                    long sum=(long)nums[i]+nums[j]+nums[left]+nums[right];
                    if(sum==target){
                        li.add(Arrays.asList(nums[i],nums[j],nums[left],nums[right]));
                        while(left<right&&nums[left]==nums[left+1]){
                            left++;
                        }
                        while(left<right&&nums[right]==nums[right+-1]){
                            right--;
                        }
                        left++;
                        right--;
                    }else if(sum<target){
                        left++;
                    }else{
                        right--;
                    }
                }
            }
        }
        return li;
    }
}
```

# IF YOU LIKE THE SOLUTION THEN PLEASE UPVOTE MY SOLUTION BECAUSE IT GIVES ME MOTIVATION TO REGULARLY POST THE SOLUTION.
![one.png](https://assets.leetcode.com/users/images/52f058b1-7e1c-4460-85e5-0c939522264a_1737650788.05699.png)


['Java']