判断数组中是否有重复的元素

bool containsDuplicate(vector<int>& nums) {
  return !(nums.size() == unordered_set<int>(nums.cbegin(), nums.cend()).size());
}

 

posted @ 2015-08-04 08:15  wu_overflow  阅读(276)  评论(0编辑  收藏  举报