由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - lintcode Majority Number II 怎么做?
相关主题
求解lintcode Majority Number III请教一道题 median ii
请教一道算法题G家onsite 随机数一题
九章算法的 解答不怎么样啊好挫的F家面经
lintcode delete digits怎么做?问个fb onsite题目
lintcode subarray sum 怎么做?peak element II 怎么做
lintcode 上的 Count of Smaller Number before itselffind all longest increasing subsequence 谁有源码?
最新L家面经贡献一道面试题
求问一个题求指点一个G家题
相关话题的讨论汇总
话题: number话题: majority话题: ii话题: array话题: lintcode
进入JobHunting版参与讨论
1 (共1页)
S*******C
发帖数: 822
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/
1 (共1页)
进入JobHunting版参与讨论
相关主题
求指点一个G家题lintcode subarray sum 怎么做?
贡献一个最近电面题目lintcode 上的 Count of Smaller Number before itself
我也来问问LC的Maximal Rectangle最新L家面经
求两个google onsite题目解答求问一个题
求解lintcode Majority Number III请教一道题 median ii
请教一道算法题G家onsite 随机数一题
九章算法的 解答不怎么样啊好挫的F家面经
lintcode delete digits怎么做?问个fb onsite题目
相关话题的讨论汇总
话题: number话题: majority话题: ii话题: array话题: lintcode