Merge Two Sorted Linked Lists (LeetCode 21) | Full solution with Examples | Study Algorithms

Опубликовано: 29 Октябрь 2024
на канале: Nikhil Lohia
32,828
498

To see more videos like this, you can buy me a coffee: https://www.buymeacoffee.com/studyalg...

Merge Two Sorted Lists is a programming challenge on LeetCode. You are given two list heads or we refer to them as two linked lists. These lists are already sorted. We need to merge them and return a single sorted linked list. The new list should be made by splicing together the nodes of the first two lists. Watch the video to understand the problem in a simplified manner. I then work along with you to solve it first using a Brute Force approach, and then an efficient approach. All along with visuals and explanations.

00:00 - Intro
00:27 - Problem Statement and Test Case
01:07 - Brute Force Method
02:44 - Efficient Solution
04:54 - Dry-run of code

📚 Links I talk about in the video:
Actual problem on LeetCode: https://leetcode.com/problems/merge-t...
Code on Github: https://github.com/nikoo28/java-solut...
Test cases on GitHub: https://github.com/nikoo28/java-solut...

📘 A text based explanation is available at: https://studyalgorithms.com/link_list...

Read more:
What are linked lists: https://studyalgorithms.com/link_list...
Common operations on a linked list: https://studyalgorithms.com/link_list...

To see more videos like this, you can show your support on https://www.buymeacoffee.com/studyalg...

💻 Get Social 💻
Follow on Facebook at:   / studyalgos  
Follow on Twitter at:   / studyalgorithms  
Follow on Tumblr at:   / studyalgos  
Subscribe to RSS feeds: https://studyalgorithms.com/feed/

#leetcode #programming #tutorial