由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - 给一个股票的time series,如何求past N days high?
相关主题
web count 设计Code a non blocking thread safe queue
dynamically找最近m个数里最大的那个这个题目该怎么做
Bloomberg Onsite 面试问一道多线程面试题
关于priority_queue一问leetcode #220很好
请教面过M家onsie的前辈发个a**D*n*m*c*的店面,已经废了
面试题总结(2) - Two/Three pointersG面试题求解
F家电面求教一道经典面题的解法
有没有必要把各种数据结构的实现自己都写几遍写熟?贡献两道google面试题
相关话题的讨论汇总
话题: queue话题: largest话题: time话题: series话题: past
进入JobHunting版参与讨论
1 (共1页)
d********t
发帖数: 9628
1
最优解是啥?
l*****a
发帖数: 14598
2
又出山了?
你的次优解先share一下,也许就是最优呢 ;

【在 d********t 的大作中提到】
: 最优解是啥?
S********s
发帖数: 29
3
how about segment tree
l*****a
发帖数: 14598
4
这种不常用的数据结构。。。

【在 S********s 的大作中提到】
: how about segment tree
S********s
发帖数: 29
5
的确是不常用的数据结构,好处是可以提供time range里面的任何一个pass N的Max
price
d********t
发帖数: 9628
6
靠,次优解就是N^2的brutal force,数据不大的情况其实也没啥不好。

【在 l*****a 的大作中提到】
: 又出山了?
: 你的次优解先share一下,也许就是最优呢 ;

d********t
发帖数: 9628
7

没听说过啊,讲解一下吧。

【在 S********s 的大作中提到】
: how about segment tree
S********s
发帖数: 29
l*****a
发帖数: 14598
9
Two queues
one queue store last N
another Queue store recent Largest(not only one)
when a new number come, insert it into the right location of recent largest
queue
(head is the biggest), remove all those smaller than current
for another queue, each time remove the tail(oldest in last N) and add cur
to the head
if the tail is head of the recent largest queue, remove it

【在 d********t 的大作中提到】
: 靠,次优解就是N^2的brutal force,数据不大的情况其实也没啥不好。
d********t
发帖数: 9628
10
正解!

largest

【在 l*****a 的大作中提到】
: Two queues
: one queue store last N
: another Queue store recent Largest(not only one)
: when a new number come, insert it into the right location of recent largest
: queue
: (head is the biggest), remove all those smaller than current
: for another queue, each time remove the tail(oldest in last N) and add cur
: to the head
: if the tail is head of the recent largest queue, remove it

S********s
发帖数: 29
1 (共1页)
进入JobHunting版参与讨论
相关主题
贡献两道google面试题请教面过M家onsie的前辈
Level order traversal只让用一个Queue怎么做?面试题总结(2) - Two/Three pointers
贡献两道Bloomberg面试F家电面
分享我经历的Google/Microsoft等公司的面试题有没有必要把各种数据结构的实现自己都写几遍写熟?
web count 设计Code a non blocking thread safe queue
dynamically找最近m个数里最大的那个这个题目该怎么做
Bloomberg Onsite 面试问一道多线程面试题
关于priority_queue一问leetcode #220很好
相关话题的讨论汇总
话题: queue话题: largest话题: time话题: series话题: past