finish n^2 solution