LintCode Majority Number 主元素
给定一个整型数组,找出主元素,它在数组中的出现次数严格大于数组元素个数的二分之一。 Given an array of integers, the majority number is the number that occurs more than half of the size of the array. Find it.样例 给出数组[1,1,1,1,2,2,2],返回 1挑战 要求时
原创
2015-07-10 17:24:27 ·
1430 阅读 ·
0 评论