3 ms·Sorted or unsorted?by commandlinefan 5y agoSorted or unsorted?kubb 5y agoYou can sort yourself, it's only O(n*logn), so it's still gonna be better than O(n^2), even when you include the linear scan to get the intersection.