锁轮子的wheel lock一个轮子安装几个?# Automobile - 车轮上的传奇
S*C
1 楼
Majority Number II
34%
Accepted
Given an array of integers, the majority number is the number that occurs
more than 1/3 of the size of the array.
Find it.
Note
There is only one majority number in the array
Example
For [1, 2, 1, 2, 1, 3, 3] return 1
Challenge
O(n) time and O(1) space
public class Solution {
/**
* @param nums: A list of integers
* @return: The majority number that occurs more than 1/3
*/
public int majorityNumber(ArrayList nums) {
// write your code
}
}
http://lintcode.com/en/problem/majority-number-ii/
34%
Accepted
Given an array of integers, the majority number is the number that occurs
more than 1/3 of the size of the array.
Find it.
Note
There is only one majority number in the array
Example
For [1, 2, 1, 2, 1, 3, 3] return 1
Challenge
O(n) time and O(1) space
public class Solution {
/**
* @param nums: A list of integers
* @return: The majority number that occurs more than 1/3
*/
public int majorityNumber(ArrayList
// write your code
}
}
http://lintcode.com/en/problem/majority-number-ii/