Adding one to a number (Use Linked List data structure)

4

1 votes
Easy
Problem

A number (n) is represented in Linked List such that each digit corresponds to a node in linked list. Add 1 to it.

Input:

The first line of the input contains the number of test cases ‘t’. The next lines contain the number ‘n’ to which one has to be added.

Output:
The number after one is added to the number.

Constraints:
1 <=T<= 50
1 <=n<= 100000

Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?