Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 060d8b8

Browse files
authored
Create 0961 - Solution2.py
1 parent 1c8ea6f commit 060d8b8

File tree

1 file changed

+15
-0
lines changed
  • solution/0961.N-Repeated Element in Size 2N Array

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class Solution:
2+
def repeatedNTimes(self, A):
3+
"""
4+
:type A: List[int]
5+
:rtype: int
6+
"""
7+
8+
count = {}
9+
for i in A:
10+
try:
11+
count[i] += 1
12+
return i
13+
except KeyError:
14+
count[i] = 0
15+

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /