Cracking the coding interview: Check if two arrays are equal or not — 4

Input:
N = 5
A[] = {1,2,5,4,0}
B[] = {2,4,5,0,1}
Output: 1
Explanation:
Both the array can be
rearranged to {0,1,2,4,5}
Input:
N = 3
A[] = {1,2,5}
B[] = {2,4,15}
Output: 0
Explanation:
A[] and B[] have only
one common value.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store