beats 99.15%of python solutions


  • 0
    W
    class Solution(object):
        def majorityElement(self, nums):
            """
            :type nums: List[int]
            :rtype: List[int]
            """
            array = list(set(nums))
            List = []
            for i in array:
                if(nums.count(i)>len(nums)//3):
                    List.append(i)
            return List
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.