New update is available. Click here to update.

Last Updated: 22 Dec, 2020

Difficulty: Moderate

```
1. All four numbers should exist at different indices in the given array.
2. The answer is case-sensitive.
```

```
The first line of the input contains an integer ‘T’ denoting the number of test cases.
The first line of each test case contains two space-separated integers ‘N’ and ‘TARGET’ denoting the number of the elements present in the sequence and the target sum respectively.
The second line of each test case contains ‘N’ space-separated integers denoting the elements of the array 'ARR'.
```

```
The only line of output of each test case should contain “Yes” (without quotes) if there exist 4 numbers (having different indices) that give sum ‘TARGET’ else “No” (without quotes).
```

```
You don't need to print anything, it has already been taken care of. Just implement the given function.
```

```
1 <= T <= 10^2
4 <= N <= 2*10^2
-10^9 <= ARR[i] <= 10^9
-10^9 <= TARGET<= 10^9
Time Limit: 1 sec
```

```
Can you try solving the problem with less than O(N^2 * log(N)) time complexity?
```

SIMILAR PROBLEMS

Ninja And The Strictly Increasing Array

Posted: 27 Nov, 2022

Difficulty: Moderate

Maximum GCD

Posted: 8 Dec, 2022

Difficulty: Hard

Negative To The End

Posted: 16 Dec, 2022

Difficulty: Easy

Sort 0s, 1s, 2s

Posted: 24 Dec, 2022

Difficulty: Easy

Fake Coin Problem

Posted: 24 Dec, 2022

Difficulty: Easy

Popular Interview Problems: