carloscn / carloscn/structstudy

数组中次数出现超过一半的数字(摩尔投票法)

Open
#3 2 comments 0 reactions 1 assignee Claimed by @carloscn View on GitHub
数组 查找
Dominant language
C
Stars
4
Forks
1
PR merge metrics
No merged PRs in 30d

Description

### 题目描述

数组中有一个数字出现的次数超过数组长度的一半,请找出这个数字。

例如:输入一个长度为9的数组{1,2,3,**2,2,2**,5,4,**2**}。由于**数字2在数组中出现了5次**,超过数组长度的一半,因此输出2。如果不存在则输出0。

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.