15. Sansanowa
Title description
Example
Ideas and algorithms
The easiest way to think of is to use a triple loop to traverse the entire array, but this method is too cumbersome. Because the sum of the three numbers is equal to a certain number, when one of the numbers (we set it as the first number here) is determined, the other two numbers are also relatively determined. The larger the second number b, The third number c is required to be smaller, so that it can be implemented by using double pointers in an array arranged in ascending order. Because the triples found in the title cannot be repeated, we can sort the array from small to large first to ensure that the triples satisfy the following relationship: the first number a of the previous triple a <the next triple The first number a', the second and third numbers b, c and so on.