Skip to content

Commit c164538

Browse files
committed
Add 961-NRepeatedElementInSize2NArray.cpp
1 parent 3bfdd67 commit c164538

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class Solution {
2+
public:
3+
int repeatedNTimes(vector<int>& nums) {
4+
std::set<int> s;
5+
for(int p = 0; p < nums.size(); p++){
6+
if(s.count(nums[p])){return nums[p];}
7+
s.insert(nums[p]);
8+
}
9+
10+
return 0;
11+
}
12+
};

0 commit comments

Comments
 (0)