Add two numbers represented by Linked List
Submissions: 608   Accuracy:

31.52%

  Difficulty: Medium   Marks: 4

Given 2 numbers represented by two linked lists, write a function that returns Sum list. The sum list is linked list representation of addition of two input numbers.

Input: First line of input contains number of testcases T. For each testcase, first line contains size S1 and size S2, length of 2 numbers. The next 2 lines contain, space separated digits of the 2 numbers.

Output: Sum the two numbers and return the result.

User Task: The task is to complete the function addSameSize() addCarryToRemaining().

Constraints:
1 <= T <= 100
1 <= S1, S2 <= 100

Example:
Input:
1
3 3
2 3 4
3 4 5

Output:
5 7 9

Explanation:
Testcase 1:
After adding the 2 numbers the resultant number is 5 7 9.

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

Author: SIDG


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.