I came across this post, which reports the following interview question:
Given two arrays of numbers, find if each of the two arrays have the same s
For each integer i check that the number of occurrences of i in the two arrays are either both zero or both nonzero, by iterating over the arrays.
i
Since the number of integers is constant the total runtime is O(n).
O(n)
No, I wouldn't do this in practice.