The problem of identical arrays
Submissions: 2424   Accuracy:

33.5%

  Difficulty: Basic   Marks: 1

Two arrays of size N are called identical arrays if they contain the same elements. The order of elements in both arrays could be different; however, both the arrays must contain same elements. You are given two arrays of size N.

You need to determine if the arrays are identical or not.

Input:
The first line of the input contains a single integer T, denoting the number of
test cases. Then T test case follows. Each test case contains 3 lines:-
size of array N
elements of array1
elements of array2

Output:
Print 1 if the arrays are identical, and print 0 if they are not identical.

Constraints:
1<=T<=100
1<=N<=1000
0<=A[i]<=9

Example:

Input:
3
5
1 2 3 4 5
3 4 1 2 5
4
1 2 3 4
1 2 3 9
1
8
8

Output:
1
0
1

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

Contributor: Ankit Sharma
Author: Soul_xhacker


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



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


to report an issue on this page.