Day 2: Coding Challenge
Shraddha M Thakur
Software Developer | Actively Seeking Opportunities | Computer Applications Graduate | Passionate about Product Innovation
The problem is adding two numbers, given two LinkedList l1 and l2 which contain the digit, the result is the addition of two LinkedList in a reverse way.
Solution: use the concept of a linked list, and visit each node from l1 and l2 till we encounter a null node, and do the operation if we encounter 2 digits in answer, carry the one digit and next digit and consider for further iteration.
Time Complexity : O(m*n)
Space Complexity : O(1)