Skip to content

Majority Element#79

Open
Yuto729 wants to merge 1 commit into
mainfrom
majority-element
Open

Majority Element#79
Yuto729 wants to merge 1 commit into
mainfrom
majority-element

Conversation

@Yuto729

@Yuto729 Yuto729 commented Jun 15, 2026

Copy link
Copy Markdown
Owner

解く問題

Majority Element

次に解く問題

Repository owner deleted a comment from github-actions Bot Jun 15, 2026
Comment thread majority-element/main.md
def majorityElement(self, nums: List[int]) -> int:
n = len(nums)
condition = n // 2
num_to_count = defaultdict(int)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

この用途であれば collections.Counter も使えると思いました。
https://docs.python.org/ja/3.14/library/collections.html#collections.Counter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants