haven’t passed online judge yet, because solution is O(n^2)