Back to Browse

2. Add Two Numbers Part-2: Optimal Approach - SimpleMath

35 views
Aug 31, 2024
7:50

2. Add Two Numbers [Medium] https://leetcode.com/problems/add-two-numbers/ Video Chapters: 00:00: Video Content Intro 0:44: Solution think through 2:07: Merge Sort merge operation visualization 3:34: Solution Visualization 5:31: Solution Code 7:13: Time & Space Complexity Analysis Solution: Optimal Approach - SimpleMath. 1. Iterate through each node in linked list 1 and linkedlist 2 2. Add the two node values with carry and create a new node for resulting linked list . Complexity Analysis: Time: O(max(len(l1), len(l2)) Space: O(max(len(l1), len(l2)) Link to the code: https://github.com/codewonkamentor/LeetCodeChannel/blob/main/2.%20AddTwoNumbers/add_two_nums.py Pervious Video: https://youtu.be/7RBXI7e5UCs Next Video: https://youtu.be/whq-T2Lm1HM #leetcode #addtwonumbers

Download

0 formats

No download links available.

2. Add Two Numbers Part-2: Optimal Approach - SimpleMath | NatokHD