Remove duplication with same complexity