the O(N^2) problem