Total Accepted: 67962
Total Submissions: 169476
Difficulty: Easy
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++:
1 | class Solution { |
看到了使用set的,表示佩服,代码只需一行
1 | class Solution { public: bool containsDuplicate(vector<int>& nums) { |