GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

Tuesday, 14 June 2022

[Solution] 3SUM Codeforces Solution | Codeforces Problem Solution 2022

Given an array a of positive integers with length n, determine if there exist three distinct indices i, j, k such that ai+aj+ak ends in the digit 3.

Input

The first line contains an integer t (1≤t≤1000) — the number of test cases.

The first line of each test case contains an integer n (3≤n≤2⋅105) — the length of the array.

The second line of each test case contains n integers a1,a2,…,an (1≤ai≤109) — the elements of the array.

Solution Click Below:-  CLICK HERE

The sum of n across all test cases does not exceed 2⋅105.

Output

Output t lines, each of which contains the answer to the corresponding test case. Output "YES" if there exist three distinct indices i, j, k satisfying the constraints in the statement, and "NO" otherwise.

You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).

No comments:

Post a Comment