Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution(object):
- def repeatedNTimes(self, A):
- """
- :type A: List[int]
- :rtype: int
- """
- myset = set()
- for num in A:
- if (num in myset):
- return num
- myset.add(num)
- '''
- Runtime: 176 ms, faster than 95.45% of Python online submissions for N-Repeated Element in Size 2N Array.
- Memory Usage: 12.6 MB, less than 98.78% of Python online submissions for N-Repeated Element in Size 2N Array.
- '''
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement