由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - 一道题
相关主题
Hot startup coding test 的问题问道题
请教一道题Find shortest substring that is only occurring once. in Given String(Medallia面试题)
问个算法题8一个面试challenge
我想说,我的A家电面,绝对是被烙印黑了,两个45分钟两个烙印Google 需要bug free 么?
Senior digital engineer job opening in Chicago (转载)Amazon 电面
报个微软的Offeranother interview question
菜鸟求救 请大家看看我的代码有没有问题请教一个题Common Ancestor(不是tree)
[合集] 今天面试惨败,分享面经湾区公司店面
相关话题的讨论汇总
话题: string话题: implement话题: function话题: document话题: word
进入JobHunting版参与讨论
1 (共1页)
r******g
发帖数: 138
1
Write a function that takes two parameters: (1) a String representing a text
document and (2) an integer providing the number of items to return.
Implement the function such that it returns a list of Strings ordered by
word frequency, the most frequently occurring word first. Use your best
judgment to decide how words are separated. Your solution should run in O(n)
time where n is the number of characters in the document. Implement this
function as you would for a production/commercial system. You may use any
standard data structures.
我想到的是先hashmap 把每个unique的string 的个数保存下来。然后再用heap来找到
K top string。但是时间复杂度就是 nlogK 了。 怎么做到O(n)?
1 (共1页)
进入JobHunting版参与讨论
相关主题
湾区公司店面Senior digital engineer job opening in Chicago (转载)
Yahoo Platform组面经报个微软的Offer
Java String concatenation菜鸟求救 请大家看看我的代码有没有问题
最近好几个trie的面试题,有人愿意分享一下trie到底怎么implement的吗?[合集] 今天面试惨败,分享面经
Hot startup coding test 的问题问道题
请教一道题Find shortest substring that is only occurring once. in Given String(Medallia面试题)
问个算法题8一个面试challenge
我想说,我的A家电面,绝对是被烙印黑了,两个45分钟两个烙印Google 需要bug free 么?
相关话题的讨论汇总
话题: string话题: implement话题: function话题: document话题: word