
169. Majority Element
·
Algorithm
Majority Element - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 1. 해시맵 스타일(Dict, Counter 사용) from collections import Counter class Solution: def majorityElement(self, nums: List[int]) -> int: counter = Counter() for num in nums: counter[num] += 1 return counter.most_common(1)[0]..