Click here to Skip to main content
15,894,180 members

Comments by Zeeshan Ahmad Jul2022 (Top 8 by date)

Zeeshan Ahmad Jul2022 30-Jul-22 1:54am View    
Okay thank you. I will definitely try it.
Zeeshan Ahmad Jul2022 29-Jul-22 15:25pm View    
Done
Zeeshan Ahmad Jul2022 29-Jul-22 15:20pm View    
It is actually in my assignment. I can get you the info
You have been given a random integer array/list(ARR) and a number X. Find and return the triplet(s) in the array/list which sum to X.
Note :
Given array/list can contain duplicate elements.
Input format :
The first line contains an Integer 't' which denotes the number of test cases or queries to be run. Then the test cases follow.

First line of each test case or query contains an integer 'N' representing the size of the first array/list.

Second line contains 'N' single space separated integers representing the elements in the array/list.

Third line contains an integer 'X'.
Output format :
For each test case, print the total number of triplets present in the array/list.

Output for every test case will be printed in a separate line.
Constraints :
1 <= t <= 10^2
0 <= N <= 10^3
0 <= X <= 10^9
Sample Input 1:

7 Size
1 2 3 4 5 6 7
12
Sample Output 1:
5
Sample Input 2:

7 Size
1 2 3 4 5 6 7
19

Sample Output 2:
0



Explanation for Input 2:
Since there doesn't exist any triplet with sum equal to 19 for the first query, we print 0.


Zeeshan Ahmad Jul2022 28-Jul-22 17:18pm View    
Done
Zeeshan Ahmad Jul2022 28-Jul-22 16:57pm View    
That's fine