BETA

Difficulty Level: Basic

Submissions: 1504 Accuracy:

62.1%

Identical Linked Lists (Function Problem)
     

Given a Singly Linked List of size N, your task is to complete the function areIdentical(), which checks whether two linked list are identical or not. Two Linked Lists are identical when they have same data and arrangement of data is also same.

Example:

Input:
head1:- 1->2->3
head2:- 1->2->3
Output: Identical

Input:
head1:- 1->3->2
head2:- 1->2->3
Output: Not identical

 

Input:
The function takes two argument as input, the reference pointer to the two heads (head1 & head2) of the two linked list.
There will be T test cases and for each test case the function will be called separately. 

Output:
For each test the output will be 'Identical' if two list are identical else 'Not identical'.

Constraints:
1<=T<=100
1<=N<=100

Example:
Input:

2
6
1 2 3 4 5 6
4
99 59 42 20
5
1 2 3 4 5
5
1 2 3 4 5
Output:
Not identical
Identical

Note:The Input/Ouput format and Example given are used for system's internal purpose, and should be used by a user for Expected Output only. As it is a function problem, hence a user should not read any input from stdin/console. The task is to complete the function specified, and not to write the full code.

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Harshit Sidhwa


					   
It is recommended to 'Compile & Test' your code before clicking 'Submit'!

Compilation/Execution Result:

Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.