MCPcopy Create free account
hub / github.com/Ainevsia/Leetcode-Rust / Solution

Class Solution

217. Contains Duplicate/Solution.cpp:14–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12using namespace std;
13
14class Solution {
15public:
16 bool containsDuplicate(vector<int>& nums) {
17 unordered_map<int, int > map;
18 for (int i : nums) {
19 if (map.find(i) == map.end()) {
20 map[i] = 1;
21 } else {
22 return true;
23 }
24 }
25 return false;
26 }
27};
28
29int main() {
30 Solution a;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected