注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号 
x
题目叫most popular videos. Let’s say you are running a website that shows videos to users. As a service owner, you want to get real-time data on how often each video is viewed and how popular the videos are. 我的解法很笨拙,就是逐个逐个地弹堆,然后用计数器算它排第几,这样做很低效. 在getTopVideos时,要把top k个按顺序取出,我又只好逐个弹堆了, 请教大家.
|