|All-time Popular Problems|
|Delete keys in a Linked list|
|Delete Middle of Linked List|
|Max sum in the configuration|
|Given a linked list of 0s, 1s and 2s, sort it.|
|Top View of Binary Tree|
|Linked List Insertion|
|Boundary Traversal of binary tree|
|n'th node from end of linked list|
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.
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.
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.
1 2 3 4 5 6
11 12 13
7 5 1 3
3 5 2 8
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.