Subtraction in Linked List
Submissions: 2328   Accuracy:

17.32%

  Difficulty: Easy   Marks: 2

Given two linked lists that represent two large positive numbers. Your task is to complete the function SubLinkedList which takes two arguments l1 and l2. The function subtracts the smaller number from larger one and return a pointer to the resultant linked list.

Input
The first line of input contains an integer T denoting the no of test cases. Then T test cases follow. The first line of each test case contains an integer n denoting the size of the first linked list (l1)  In the next  line are the space separated values of the first linked list. The third line of each test case contains an integer m denoting the size of the second linked list (l2). In the forth line are space separated values of the second linked list .

Output:
For each test case output will be space separated values of the resultant linked list. 


Constraints:

1<=T<=100
1<=n,m<=100

Example:

Input:

1
3
1 0 0
1

Output:

0 9 9

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Amit Khandelwal
Author: Shubham Joshi 1


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



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

to report an issue on this page.