Welcome to the daily solving of our PROBLEM OF THE DAY with Yash Dwivedi We will discuss the entire problem step-by-step and work towards developing an optimized solution. This will not only help you brush up on your concepts of Linked List but also build up problem-solving skills.
Given two singly linked lists, return the point where two linked lists intersect.
Note: If the linked lists do not merge at any point, return -1.
Examples:
Input: Linked list 1: 4->4->4->4->4, Linked list 2: 4->4->4
Output: 4
Explanation: From the above image, it is clearly seen that the common part is 4->4 whose starting point is 4.
Give the problem a try before going through the video. All the best!!!
Problem Link: https://www.geeksforgeeks.org/problems/intersection-point-in-y-shapped-linked-lists/1