25. leetcode 217. Contains Duplicate

217. Contains Duplicate

 Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should return false if every element is distinct.

思路:若整型数组中存在出现超过一次的数则返回真,否则返回假。同样利用C++ 中STL中的map结构,注意map遍历的方式:详见注释。

 

posted @ 2017-04-09 21:42  蓦然闻声  阅读(140)  评论(0编辑  收藏  举报