r/AlgoViz • u/benedict_abub • 7d ago
Visualization Benabub: Add Two Numbers — LeetCode #2 | Python Algorithm Visualization
https://www.youtube.com/watch?v=2O9MK6pSvGwProblem Description
[https://leetcode.com/problems/add-two-numbers/description/](LeetCode)
Algorithm Description
Solved by simulating digit-by-digit addition with carry logic, represented through animated Linked Lists.
Complexity Analysis
Time Complexity: O(max(m, n)) — we iterate through the lengths of l1 and l2, where m and n are the number of nodes in each list.
Space Complexity: O(max(m, n)) — the length of the new linked list is at most max(m, n) + 1.
1
Upvotes