How to find intersection node of two linked lists without using inner loop. With O(m+n).

Опубликовано: 18 Октябрь 2024
на канале: Ashok Dhulipalla
528
6

#AshokSoftwareDeveloper
1. Get the length of first list (C1).
2. Get the length of second list (C2).
3. Find difference of lengths. d= abs(C1 - C2)
4. Increment bigger list by d nodes.
5. Increment both lists by 1 until they both are pointing to the same node which intersection node.