Advertisement
Guest User

Untitled

a guest
Aug 18th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. class Solution(object):
  2. def repeatedNTimes(self, A):
  3. """
  4. :type A: List[int]
  5. :rtype: int
  6. """
  7. myset = set()
  8.  
  9. for num in A:
  10. if (num in myset):
  11. return num
  12. myset.add(num)
  13.  
  14. '''
  15. Runtime: 176 ms, faster than 95.45% of Python online submissions for N-Repeated Element in Size 2N Array.
  16. Memory Usage: 12.6 MB, less than 98.78% of Python online submissions for N-Repeated Element in Size 2N Array.
  17. '''
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement