Add Two Numbers
Leetcode link: https://leetcode.com/problems/add-two-numbers/submissions/
#
QuestionGiven 2 non-empty singly linked list which represent numbers stored in reverse order, with each node representing a single digit, add the 2 numbers together and return a new linked list representing the result.
The 2 linked lists may not be of the same length.
#
Implementation- Time complexity:
O(n + m)
wheren
is the length of first linked list andm
is the length of the second linked list. - Space complexity:
O(n + m)
for creation of new linked list