Triplet sum in array
Sort the array and fix the first number of the triplet. The other two come from the numbers after it: start left at the smallest and right at the biggest. A sum below the target needs a bigger number, so left moves up; a sum above it needs a smaller one, so right moves down. O(n²) instead of trying every triplet in O(n³).