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

Method containsDuplicate

217. Contains Duplicate/Solution.cpp:16–26  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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() {

Callers

nothing calls this directly

Calls 1

findMethod · 0.45

Tested by

no test coverage detected