This is a verified interview question from Infoedge. Candidates reporting seeing this problem in recent Online Assessments (OAs) and onsite rounds. Mastering "Seema and Linked Lists" covers key patterns like LinkedList.
"### Problem Seema loves playing with linked lists and numbers. She has two linked lists namely, A and B. The nodes of both the linked list have a value associated with them. If there is a value in a node of B that is also present at some position in A then she wants to choose all the occurrences of that element from A. Return the product of all the chosen elements modulo 10007. ### Input Format * First Line contains n, the number of nodes in linked list A, followed by n lines containing all the elements in linked list serially from head to the end of the linked list. * The next line contains m, the number of nodes in linked list B, followed by m lines containing all the elements in linked list serially from head to the end of the linked list. ### Constraints * 1 <= n <= 10^5 * 1 <= m <= 10^5 * The values of nodes in both the linked list is in the range [1,10^4] ### Output Format * Return the product of all the chosen elements(possibly none, in which case product is considered 0) modulo 10007."
Join thousands of developers practicing for Infoedge.