3 ms·
At that point, might as well just do `sorted(list(x)) == sorted(list(y))`.
by meowface 13y ago
At that point, might as well just do `sorted(list(x)) == sorted(list(y))`.
- beambot 13y agoCounters are effectively building a sparse histogram by going through each element in x, and then each element in y. Ignoring the test for equality, the Big-O for histograms is O(x+y). For sorting in general, the Big-O is O(x·log(x)+y·log(y)). In other words: the sorting solution is correct but less efficient.