这个内存如何# Hardware - 计算机硬件
s*t
1 楼
直接面的第2轮,两道题,
1. printBSTOnHeight(Node *root, int height)
print the height level nodes, code on paper.
按层打印BST的变种,我给的方案是,用一个Queue,输入每个node然后每一层用一个
SingalNode来分开,然后检测,打印。版上讨论过,方法应该类似。
这个想法显然不是面试官脑子里的想法,揪住我问了半天,最后通过一个simulation,
终于让他知道这个是可行的。
2. Stock price. given a company name, print the last 20 prices based on time
.
我给出的方案是 map>
streamingData, 每进来一个,queue里剔除头上的一个。
我个人觉得都答对了, 大家帮我看看有什么问题?
我自己觉得如果有问题,可能是第一个写得慢了点儿,另外他可能有比我这个更好的方
法,我能想到的是用一个count来记录每层的数,然后打印。但我想,至少我的方法可
行呀,复杂度也没提高。
被拒后,十分沮丧!上学期面过一次internship,想试试,因为没怎么准备,挂在了一
个比较简单的题上了。这次认真准备了,但又没过!我觉得面试最郁闷的就是这种情况
了,自己感觉良好,但没有过,还不知道原因。(题外话,面试官两次都是同一位国人
大哥)。
Anyway, 发发牢骚,接着看书了.
1. printBSTOnHeight(Node *root, int height)
print the height level nodes, code on paper.
按层打印BST的变种,我给的方案是,用一个Queue,输入每个node然后每一层用一个
SingalNode来分开,然后检测,打印。版上讨论过,方法应该类似。
这个想法显然不是面试官脑子里的想法,揪住我问了半天,最后通过一个simulation,
终于让他知道这个是可行的。
2. Stock price. given a company name, print the last 20 prices based on time
.
我给出的方案是 map
streamingData, 每进来一个,queue里剔除头上的一个。
我个人觉得都答对了, 大家帮我看看有什么问题?
我自己觉得如果有问题,可能是第一个写得慢了点儿,另外他可能有比我这个更好的方
法,我能想到的是用一个count来记录每层的数,然后打印。但我想,至少我的方法可
行呀,复杂度也没提高。
被拒后,十分沮丧!上学期面过一次internship,想试试,因为没怎么准备,挂在了一
个比较简单的题上了。这次认真准备了,但又没过!我觉得面试最郁闷的就是这种情况
了,自己感觉良好,但没有过,还不知道原因。(题外话,面试官两次都是同一位国人
大哥)。
Anyway, 发发牢骚,接着看书了.