Problem: Given an array of n integers and an integer target, are there elements a, b, c, and d in nums such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target.
So there's the obvious n^3 solution with sorting, two nested for loops and then checking.
But is there a way to do better? Note this isn't the decision problem, just see if a solution exists but instead to return all unique quadruplets.