Add pure O(N^2) implementation that uses lists