def majorityElement(self, nums):
for i in set(nums):
:type nums: List[int]
majorElement = [ele for ele in set(nums) if nums.count(ele) > (len(nums)/3)]
The nums.count() function in your loop has time complexity O(n), so the total is not linear.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.