I want to check whether two arrays are equal or not without sorting them and also the order of the elements can be different in arrays.
I am thinking about taking the sum but it will not work in the following case:-
A = [4,2] B = [1,5]
One way of doing this is to create a hash map and check the frequency but that will require extra O(n) space and I want to do it without using any extra space.