fixed n squared runtime