Subtract Two Linked Lists
easy
1. You are given two linked lists with N and M nodes respectively. 2. The linked list as a whole represents a large positive number. 3. You have to write a function that subtracts the smaller number from larger one and returns a pointer to the resultant linked list. 4. display is a utility function which displays the contents of Linked List, feel free to use it for debugging purposes. 5. main takes input from the users and creates the Linked Lists. You can use display to know its contents. 6. This is a functional problem. 7. You should code only the sublinkedList function. It takes as input the heads of the first and second linked list respectively. It should find the difference of two linked lists and return a pointer to the resultant linked list. 8. Don't change the code of Node, main and display.
Constraints
1 <= N <= 1000 1 <= M <= 1000
Format
Input
First line takes N, the number of elements in the first list. Second line takes input N space separated numbers reperesenting elements of the first linked list. Third line takes M, the number of elements in the second list. Fourth line takes input M space separated numbers reperesenting elements of the second linked list. Input is handled for you.
Output
Difference of two linked lists. Output is handled for you.
Example
Sample Input
7
0 0 0 1 0 0 0
4
0 0 1 0
Sample Output
0 0 0 0 9 9 0