Solved 18 and 67 with fast algorithm, O(N^2)