#C10425. Three Sum Triplet

    ID: 39629 Type: Default 1000ms 256MiB

Three Sum Triplet

Three Sum Triplet

You are given an array of integers and a target integer. Your task is to determine whether there exist three distinct numbers in the array whose sum equals the target. Use an efficient algorithm (with a time complexity of O(n²)) to solve the problem. This problem tests your ability to work with arrays, sorting, and two-pointer techniques.

Note: The input will be provided via standard input (stdin) and the output should be printed to standard output (stdout). The answer should be either 'True' or 'False' (case-sensitive).

Example:
Input: 5\n1 2 3 4 5\n9
Output: True

inputFormat

The first line of input contains an integer n representing the number of elements in the array. The second line contains n space-separated integers representing the array elements. The third line contains an integer target which is the sum that you need to check against.

Input Format:
n
a1 a2 ... an
target

outputFormat

Print a single line to standard output which is either True if there exist three distinct numbers in the array that sum to the target, or False otherwise.

Output Format:
Result (True/False)

## sample
5
1 2 3 4 5
9
True