4Sum
Medium · Arrays & Strings · about 20 minutes
Asked at Amazon, Google, Meta, Bloomberg, Microsoft, Adobe, Canva, Electronic Arts, Unity, Autodesk.
Find every distinct group of four values from nums, taken from four different positions, that adds up to target. No group may be listed twice. The groups, and the values within each group, can come in any order.