Identical Linked Lists
Basic Accuracy: 51.37% Submissions: 42189 Points: 1

Given two Singly Linked List of N and M nodes respectively. The task is to check whether two linked lists are identical or not. 
Two Linked Lists are identical when they have same data and with same arrangement too.

Example 1:

LinkedList1: 1->2->3->4->5->6
LinkedList2: 99->59->42->20
Output: Not identical 

Example 2:

LinkedList1: 1->2->3->4->5
LinkedList2: 1->2->3->4->5
Output: Identical

Your Task:
The task is to complete the function areIdentical() which takes the head of both linked lists as arguments and returns True or False

1 <= N <= 103

Expected Time Complexity : O(N)
Expected Auxilliary Space : O(1)

We are replacing the old Disqus forum with the new Discussions section given below.
Click here to view old Disqus comments.

to report an issue on this page.


We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?


All Submissions

My Submissions:

Login to access your submissions.

Identical Linked Lists

Output Window