import collections
class Solution(object):
def repeatedNTimes(self, A):
"""
:type A: List[int]
:rtype: int
"""
counter = collections.Counter(A)
return counter.most_common(1)[0][0]
if __name__ == '__main__':
s = Solution()
print s.repeatedNTimes([1, 2, 3, 3])
print s.repeatedNTimes([2, 1, 2, 5, 3, 2])
print s.repeatedNTimes([5, 1, 5, 2, 5, 3, 5, 4])
Download N-Repeated Element in Size 2N Array.pyLeetcode 961 N-Repeated Element in Size 2N Array problem solution in python3 with explanation. This is the best place to expand your knowledge and get prepared for your next interview.
Feedback is the most important part of any website.
If you have any query, suggestion or feedback, Please feel free to contact us.