Given two given arrays of equal length, Check if given arrays are equal or not.

Problem Note

  • Two arrays are said to be equal if both of them contain the same set of elements, the permutation of the elements may be different though.
  • If there are repetitions, then counts of repeated elements must also be the same for two arrays to be equal.

Example 1

Input: A[] = [3, 8, 9, 1] , B[] = [9, 3, 1, 8]  
Output: 1

Example 2

Input: A[] = [1, 2, 5, 2, 1] , B[] = [2, 1, 2, 1, 5] 
Output: 1

Example 3

Input: A[] = [1, 2, 2, 7, 1] , B[] = [2, 1, 2, 7] 
Output: 0

Example 4

Input: A[] = [0, 5, 0] , B[] = [5, 0, 5] 
Output: 0