BETA

Submissions : 242 Accuracy :

47.93

Count Pairs whose sum is equal to X (Function Program)
     

Given two linked list of size N1 and N2 respectively of distinct elements, your task is to complete the function countPairs(), which returns the count of all pairs from both lists whose sum is equal to the given value X
Input:
The function takes three arguments as input, reference pointer to the head of the two linked list (head1 and head2), and an variable X.
There will be T test cases and for each test case the function will be called separately.
Output:
For each test case the function should return the count of all the pairs from both lists whose sum is equal to the given value X. 
Constraints:
1<=T<=100
1<=N1,N2<=1000
1<=X<=10000
Example:
Input:

2
6
1 2 3 4 5 6
3
11 12 13
15
4
7 5 1 3
4
3 5 2 8
10
Output:
3
2

Note:The Input/Ouput format and Example given are used for system's internal purpose, and should be used by a user for Expected Output only. As it is a function problem, hence a user should not read any input from stdin/console. The task is to complete the function specified, and not to write the full code.

**For More Examples Use Expected Output**



					   
Result:
It is recommended to test your code before clicking 'Submit' button!



                   



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.