不敢保證所有涵蓋,大部分的都在。
我本身找了一遍,你們一塊兒用着都方便。
不過只是含有題目的帖子 我才包含進來了,只分享經驗沒貼題目的 我都沒有包含
進來。
你們複習着方便。
1. 一個sorted interger Array[1...N], 已知範圍 1...N+1. 已知一個數字missing。
找該數字。
把原題改成unsorted,找missing數字。 performance。
2. 複製linked list。 已知每一個節點有兩個pointer,一個指向後一個節點,另外一個指向
其餘任意一節點。 O(n)時間內,無附加內存,複製該linked list。(存儲不連續)
3. 一個party N我的,若是一我的不認識任何其餘人,又被任何其餘人認識,此人爲
celebrity。用O(n)時間找到此celebrity。
4. 給中序後續,構建樹。
其餘的每輪都問了簡歷。
感受答的都不錯,沒什麼難度。不知道爲啥就被拒了。總之感受很奇怪,不過也無所謂
了。
但願對你們有幫助。
Pasted from <http://www.mitbbs.com/article_t/JobHunting/31342084.html
>
貢獻一道cs面試題,雖然個人面試機會極少。 :D
設計一個函數,返回一組數字的組合,combination,
不一樣的是,你每調用它一次,它就返回下一個組合,而不是一次全返回。
注:你不能一次算完,把他們存起來,而必須臨時算!
Pasted from <http://www.mitbbs.com/article_t/JobHunting/31347263.html
>
IT company, 全都是brain teaser, 有點老。
1. 50個黑球50個百球,2個罐,要求你放這100個球在這2個罐,使得別人隨機從2個
罐中任意拿一個球是黑球的概率達到最大。
2. heard on the street 上的男人出軌題,簡單邏輯推理。
3. 這個沒答上來,後來給了提示作出來了,可是回頭想一想仍是不對。上來請教一下
。
2我的商量好策略,而後一個從52張牌裏面隨機抽5張,看牌,考慮。。。而後排在
桌上,攤開前4張,第5張面朝下,由第二我的判斷第5張牌。 問這個策略。
Pasted from <http://www.mitbbs.com/article_t/JobHunting/31347264.html
>
這週一面的,一共5我的,碰到的題目不太難:
1. 寫atoi函數,
測nodepad
2. 古老的三角形問題:輸入3邊,看是什麼三角形。
一個mobile device能夠從服務器上傳和下載圖像,怎麼測試這個系統?
3. lunch meeting以後回辦公室打開電腦,說他們如今開發的某產品有問題,每次要
loading好久,差很少10秒的樣子。問怎麼測試並找出這個bug? 這個把我難住了,胡亂
講了一通,而後說太困難了;因而他換了個題目,畫了一個plotter軟件的界面,問怎
麼測。
coding的題目是Path Walk,給一條路徑,寫一個函數來走通它。其實這個題目我沒
搞明白什麼意思,先溝通了好久,最後開始寫(仍是不太明白。汗...),寫完了以爲
不正確,正想再改改,被打住了,說給個test case一塊兒來看看程序怎麼執行。每句代
碼跑了一通,卻發現code寫正確了:-)
4. 一開始是個IQ題,把一堆數字填到格子裏,知足一些條件,好比1和2不能相鄰。
測一個記事薄軟件。有scheduler和notifier兩部分,能夠從scheduler輸入時間和
內容,而後notifier到預約時間會給出提醒。
coding題目很容易,找到單鏈表倒數第N個節點。
5. 最後是hiring manager,問了一些behavior問題,而後打開一個網站,問怎麼測試。
Pasted from <http://www.mitbbs.com/article_t/JobHunting/31348374.html
>
在onsite面試中實際遇到的。
1.template中用typename和用class有什麼區別?
2.unix下執行shell腳本和執行可執行文件有什麼區別?哪一個更快,爲何?腳本語言
程序(如javascript)和可執行文件程序有什麼區別?shell和這二者卻別呢?
3.如何對const data member作assignment?
class A{
const int a;
public:
A():a(0){};
A(int m_a):a(m_a){};
};
int main(){
A a(1);
A b;
b = a; //how to implement assignment for this?
}
4.若是把base class對象賦給derived class對象,會怎麼樣?compiler報錯仍是執行錯
誤?
class A{
public:
int a;
};
class B:public A{
public:
int b;
};
int main(){
A a;
B b;
b = a; //what happend?
cout << b.b << endl;
B* b2;
b2 = &a; //how about this?
cout << b->b << endl;
}
Pasted from <http://www.mitbbs.com/article_t/JobHunting/31348607.html
>
兩波兩小時,第一波老白+老印,小兵
1. 介紹Recent Project
2. 兩個C的程序問題
先是char*指針問題
char *dosth()
{
char s[256];
char * p = r;
p = "some new string":
}
而後問了一堆變量的值,好比 s, *s, *(s+2), &p, etc.
另一個switch程序找錯,沒有加break之類,還有就是return local variable地址的
問題
3. 手寫fab(n)函數,不是算,而是輸出,遞歸或者循環均可,不過遞歸不高效你們應
該知道
4. 邏輯問題:八個水罐稱重
5. 一堆關於OO概念的問題,多態,繼承,封裝,接口和抽象類的區別,複寫和重載(
包括C++具體怎麼實現的)
6. 反饋問題
第二波一個項目經理
一來就是比較高難度的,給你一個字節數組(注意取值範圍),數組長度可能很是長,
如何找到第一個只出現了一次的數字。開始沒什麼思路,和他討論了一會,邊問還邊問
複雜度和數據結構的問題,後來發現應該進行數出現次數,這樣複雜度就是2n,結果
出來了要求手寫出代碼。
而後就是一個智力問題,三個囚犯黑帽白帽,以前沒見過,因此用了很多時間纔想出來
,你們能夠搜搜,有現成的。 最後反問問題後結束。
雖然每一個問題都答出來了,不過最後仍是功虧一簣。不是很清楚什麼緣由,哪位同窗能
夠指點一下?如今繼續迴歸閨中狀態中。不過感受彭博問題的重複機率很大,但願對後
來的同窗可以有所幫助:)
Pasted from <http://www.mitbbs.com/article_t/JobHunting/31350186.html
>
1, C vs C++
2, struct in C v.s. in C++ v.s. class in C++
3, virtual function, pure virtual function, abstract class
what is the advantages of using virtual function
4, new v.s. malloc()
5, memory for a process (code, static data, stack, heap)
6, how to know the stack is growing in the direction of address increasing
or decreasing
7, virtual memory
Pasted from <http://www.mitbbs.com/article/JobHunting/31354737_3.html
>
nsite 只見了2我的,估計over了,總結一下教訓。
題目不難,主要一共3道題,都算比較基礎的題。
1.reverse words in a sentence,使用以下函數。
char* reverseWord(const char* str)
2.an interger array containing millions of elements with min 0 and max 1000,
how to sort it?
3.covert interger number to date string, for example, 20090130 -> "01/30/
2009"
說說教訓:
第一道被輸入const給搞死了。先是沒有注意const,直接按照常規非const作,沒有寫完
就被叫停了;而後是被平時強調的malloc後必須及時delete規則搞死,堅持認爲在函數
裏malloc一塊內存而後在函數外delete是很差的習慣;最後當面試者提出若是定義一塊
內存
,如char tmp[2048],而後使用會怎麼樣?本身提到能夠在函數外strcpy函數返回結果
,卻忘了
arr大小實際是沒法指定的,因此這種方法是不可接受的。總之,不少的trick在裏
面沒有注意到。
第二道使用couting sort應該就能夠。面試者要求描述算法,不需寫代碼。
第三道本身的作法是先取得30,而後01,而後2009而後組合成一個string。問題是這樣
的話,月和日的01前的0可能會丟失,使得最後結果可能不對。後來想正確的作法應該
是先把整形轉成string,而後使用substr並組合。另外,面試者問有stl有什麼能夠替換
itoa,本身答不出來。後來查了下,應該是能夠使用stringstream來實現,以下:
stringstream ss;
ss << intVal;
ss.str()就是咱們要的結果。
Pasted from <http://www.mitbbs.com/article/JobHunting/31356298_3.html
>
如今版上的文章好像已經以H1申請爲主了,不知道多少人還對面經感興趣。不過想一想還
是寫一下好,要不本身過幾天可能就忘光了,呵呵。
申請工做:Software Developer,Mobile Application組
問題問的不少很雜,基本上不難。不事後來想一想,也沒有全都答對。大概包括:
* 爲何對Amazon感興趣。
* 本身最近的Project。
* 說出本身會的編程語言並打分(1-5)。
* 有沒有開發Mobile application的經驗。
* 幾個常見Data structure的Lookup操做的時間複雜度。
* HTTP post和get的區別。
* Design Pattern: Singleton, Factory, Lazy initialization。
* Multi-threaded programming, deadlock之類。
* 對Unix環境是否熟悉,幾個常見命令,ls, ps之類。
* Reflection的概念,Java reflection,C++裏面是否是有reflection。
* 如何實現Garbage Collection。Reference counting的缺點(cycle),如何解決,JVM
有沒有解決。
* C++裏面virtual destructor的用途,於通常virtual function的區別。
* 寫一個函數實現兩個整數相除,不用"/"和"%",返回商和餘數。寫完讀給他聽。
* 算法設計:一個Galaxy,每一個星星用一個三圍座標表示,找出離地球最近的1000個。
(後來發現這也是老題了)
Pasted from <http://www.mitbbs.com/article/JobHunting/31368921_3.html
>
have read many posts here although not really helpful this time, here is
something about bloomberg's phone interview question
1. How to implement garbage collector ( what data structure)
2. How to implement c++ smart pointer
3. Pro and Con of multi process and multi-thread
4. How many stack/heap does a multi-thread program with 10 threads have?
there are some other questions I don't remember.
☆─────────────────────────────────────☆
yellpine (fresh CS master looking for referral) 於 (Wed Mar 4 16:42:52
2009) 提到:
4. How many stack/heap does a multi-thread program with 10 threads have?
who can help me with this?
10 stacks? 1 heap?
Pasted from <http://www.mitbbs.com/article/JobHunting/31373641_3.html
>
估計沒有多少人感興趣,
不過仍是說一說.
面的是ELASTIC COMPUTING CLOUD組的SE,我是作網絡的,對他們的這個cloud service有
些興趣,覺得會問算法和系統的問題,結果問了一個OOD的問題,
說一個大樓,10層,4個電梯,怎麼設計類來實現這樣一個系統?
題目career cup上有,不過沒想到他會問這個,ECC又不是作應用的.恰好是個人弱項,一
直作research,對算法和語言還算了解,對應用系統和設計那是一片空白.面的是一塌糊
塗. 有要面amazon的參考一下.
Pasted from <http://www.mitbbs.com/article_t/JobHunting/31376671.html
>
S Master
Windows Live Experience 組:
我一直催HR,今天給我打電話說拒了。 汗了--自我感受還挺好的。
拒了 也把經驗給你們分享一下,在版上受益這麼多,回報一下你們。
一共見了5我的, 兩個SDET, 兩個SDET lead, 最後一個director。題目都很簡單
1.美國人。上來隨便聊聊,而後出了個coding 題目 一個數組,找出第一個重複的數
我給了三種方法,最後用hash寫的,而後問test case之類的
2.印度人
上來問我會什麼C#仍是C++,我說C#會的多一些。而後他上來問了四五個簡單的 語法
問題。正好我還都會,心理還竊喜着呢。coding 也很簡單,給一個01字符串,轉化成
整數。寫完後 test case。 第二個題目是兩個函數互相調用,無限循環了,然我找出
毛病,問怎麼解決。
而後午餐跟這個印度人吃,隨便聊聊。 就過了
3.歐洲人,不知道哪國。
女的, 人很好,跟她聊的最開心。coding 題目是個沒見過的,double bytes
string實現delete鍵功能。這個比較難解釋,她開始也跟我解釋了很長時間。 就是刪
除字符的時候如何肯定是刪一個字節仍是刪兩個字節的問題。我給出算法,而後她有提
示有哪些特殊狀況要考慮,也作出來了。而後她就問我給一個通常的application 如何
測試,又隨便說了一通,結束了
4.美國人 senior test lead
coding 很簡單,給一個句子,把裏邊全部的單詞自身reverse
而後給我看他們的產品,問我怎麼測試。聊的也挺好
5.歐洲人 director
面到這我的的時候,我都快累趴下了,都不想面了,實在是累。心理還想着,offer拿
不拿得着無所謂,別把老子給累死了。(看來真得努力鍛鍊身體,否則面試都挺不住)
題目也很簡單,找1--100的素數。我就給了最簡單的方法,而後我說要 check一些邊界
狀況,他說不用了。而後讓我作到他的椅子上,打開excel,問我怎麼測設置字體這個
feature。說完了問我有什麼問題沒有
面完後以爲還不錯,由於去以前心態還不錯,如今就業狀況很差
也怕,沒打算畢業。
後來回到學校我就一直催HR趕忙給我結果,今天就給催出來了 呵呵
我說打算postpone到年末畢業,他說到時候能夠直接再聯繫他(有個屁用啊 呵呵)
在學校繼續呆着吧,呵呵,把身體鍛鍊好,面試也是一個體力活。
寫出來 但願對你們能有點幫助。
Pasted from <http://www.mitbbs.com/article/JobHunting/31383513_3.html
>
iantianz (tiantianz) 於 (Thu Mar 12 15:23:30 2009) 提到:
剛剛電面了一家中型軟件公司的summer intern,問了一個算法題:
給你一本dictionary,任意給你七個letters,讓你找出包含這七個字母的、最長的單
詞。
條件:能夠pre-processing,這樣每次給你不一樣的letters時,能夠very effcient
我當時想了很久也沒給出完整答案。。。
naive 的解法固然就是每次scan dictionary,每次 O(n)。。。
pre-peocessing那就是建index,但index怎麼建?怎麼操做?
Pasted from <http://www.mitbbs.com/article/JobHunting/31387661_3.html
>
MichaelChen (Michael) 於 (Thu Mar 12 17:05:44 2009) 提到:
上學期ON CAMPUS的INTERVIEW,PENDING了幾個月給了ON SITE
兩週前去的,面的FULL TIME SDE。
見了5我的
1.REVERSE LINKLIST.
2.給了N個數,值域[1,N-1],如何找出第一個重複的數
3.算POLYNOMIAL,好比5x^4+6x^3-7x^2-8=?
4.給一個URL,如何把空格這種字符轉換成%20這種
5.給一個LINKLIST,VALUE的指針指向其餘NODE,複製他
今天RECRUITER發郵件通知給OFFER了,漫長的兩週。。。但願收回OFFER這種事不要發
生。。
準備基本就是看MITBBS精華區,programming interview exposed和careercup,但願大
家都好運,ms應該仍是在招人。
Pasted from <http://www.mitbbs.com/article/JobHunting/31387663_3.html
>
攢rp,最近遇到的面試題。。。
C++:effective c++上的東西若干;exception相關;繼承和子父類指針若干. 十五分
鐘左右。
算法/編程:1. 大文件隨機sample,one pass. 2. sodoku solver. 3. logn解x^y,
4. DP題 5. 1Billion query裏選出時間最近5分鐘內最frequent的1000個,one pass
(我之前在amazon見到過這題)。6.兩個排序數組找共同中值。遞歸和非遞歸解法。7.
斐波那契數列。100層樓梯下樓,能夠一步也能夠兩步,多少種下法?遞歸和非遞歸。
8 貝葉斯後驗機率。9。多少人在一塊兒,生日可能出現重複機率大於0.5?(算法導論原
題,我只記得個答案,直接說了。。。)10. 一個數組,找最大值比較次數?同時找最
大值和最小值比較次數?找最大值和次最大值比較次數?(他問我是否知道這題,我說
是做業題。後來和師兄聊說是這他常拿來用的面試題。)
系統設計和經驗:1 設計一個庫,提供timer的功能。deltalist/hash,或相似linux
kernal的 timer 設計。效率要比較高。2. 一個相似chord的DHT設計。3. 你有一個奇
怪的程序,有時有bug,有時沒有,說出儘量多的可能緣由。4. printf來debug有何
不妥。5. process和thread。process之間的IPC有那些種?process間是否也能夠share
memory.什麼時候選thread或process。
Pasted from <http://www.mitbbs.com/article/JobHunting/31393101_3.html
>
職位是 junior financial engineer, 公司是一hedge fund,其實面完就感受不太好,
一共見了6我的,有兩我的問得技術問題答得不太好,也怪本身事先準備面試下的功夫
不太到家,準備得重點沒有把握好。如下是一些能想起來的問題:
1。C++ 中的virtual destructor是啥? 爲啥要用?
2。quick sort, merge sort的複雜度。
3。 Structure 和class的區別是什麼? (我暈,這個我竟然給答反了)
4。關於C++ 處理異常的方法 。 (基本上一頭霧水)
5。Monte Carlo method in american style option pricing。 (我說的用least
square regression method,blah......)
6. Int_0^T W(t) dW(t) ( 一看見這個,賊激動阿,熟悉的ito' s formula)
7. Stonivich intergral 是啥? 爲何用Ito's 不用 stonivich? (不知道拼得對不
對)
8. 一個國家全部的人若是生了一個男孩之後就中止生育,生了女孩之後就繼續生,直
到生出男孩才中止生育,問多年之後男孩多仍是女孩多? (要聯繫上stopping time的
概念)。
9。什麼是AR model? 啥時候用AR model?
10. American option 的up bound? (我說是stock price,被直接鄙視了,說更精確的
,只好答沒有研究過,當時一頭霧水)。
以上的是我能記得的一些問題,還有一些關於數據結構的問題我就完全歇菜了,歷來沒
有這方面的背景,也就不記得他的問題了。
還有就是,關於本身的簡歷上面的Project 工做經歷,必定要熟練再熟練,有些人問得
那叫一個細啊,並且基本上我全部的Project都被人問到了。此次面試的前4我的主要問
計算機和金融方面的技術問題,第5個HR,問些personality的問題,最後是hiring
manager,由於以前電話面試過我,就沒有問問題,簡單聊聊。整個面試花了5個小時,
雷死了,腦子到後面都已經不轉了。雖然結果讓人遺憾,不過就當是學習了,貼點信息
和你們共享下,但願本身能早日找到工做,也但願還在努力找工做的XDJM們再加把勁,
你們一塊兒加油。
Pasted from <http://www.mitbbs.com/article/JobHunting/31406731_3.html
>
CS方向,但願對你們準備面試有幫助
1. 用stack class來實現queue,具體用幾個stack不限。完了之後問怎麼實現thread
safety,而後是怎麼測試。
2. 實現strstr(str1, str2),若是str2是str1的子串,返回true,不然返回false。實
現完了之後問如何測試。
3. 給定一個integer array with both positive and negative numbers,return a
contiguous subarray with the largest sum. 我原本想用dynamic programming實現
,但面試官但願按照他的一個更heuristic的思路來解,最後勉強搞定。
4. 給定一個排好序的linked list,刪除其中全部的重複元素。好比給定1->2->3->3->
4->4->5,返回1->2->5。給定1->1->1->2->3,返回2->3。看起來簡單,一邊寫一邊發
現許多細節須要當心應對,好在最後搞定。
5. 給你三個烤箱,每一個烤箱能夠同時烤兩片面包,須要的時間分別是3分鐘,4分鐘和3
分鐘。但第三個烤箱有一個slot出了點問題,每次只能烤麪包的一面。因此這個烤箱三
分鐘後只能算烤好一片半面包,你須要把那半片翻個面,在同一個slot裏再烤一次纔算
一片完整的。如今給你這三個烤箱,問烤好21片面包最少須要多少時間?若是是2100片
呢?若是是任意給定的N片,要求O(1)時間內給出最少須要的時間。
6. 給你三根棍子,每根都須要一個小時才燒完,但每根燃燒的速度都不同,也不均
勻。問只有這三根棍子和火柴,如何精確的獲得1小時45分鐘的計時?
7. 在一個party上,每一個人可能認識別人,也可能不認識。如今其中有一我的是名人,
定義就是全部的人都認識他,但他不認識其他的任何人。如今要求你去找出這個名人來
。但你只能夠經過一個方法,就是問A是否是認識B,回答是表示A認識B,不是表示A不
認識B。你能夠任意去問這樣的問題,問最少須要多少次能找出這個名人?思路有了之
後要求寫代碼實現,能夠調用knows(A, B),表明上面的那個問題。實現完了之後問如
何測試
8. 測試copy這個命令。而後本身問了一些clarifying questions,搞清了其實是
copy src dest。src能夠是文件,也能夠是目錄。dest能夠存在,也能夠不存在。
Pasted from <http://www.mitbbs.com/article/JobHunting/31410833_3.html
>
OO設計題,怎麼作一個十字路口的traffic light.
2. 怎麼不用recursion 作二叉樹in order 遍歷。
Pasted from <http://www.mitbbs.com/article/JobHunting/31421129_3.html
>
1. Write a function that returns a node in a tree given two parameters:
pointer to the root node and the in order traversal number of the node we
want to return. The only information stored in the tree is the number of
children for each node.
2. Input a message and a text, find if the message can be composed by the
text.
If the text is in a magazine (two pages/a paper), how to design an algorithm
?
Pasted from <http://www.mitbbs.com/article/JobHunting/31422009_3.html
>
1
When casting an object of a polymorphic class from a base calss type, which
one of the following casts
performs the task only if the cast is valid?
a. static_cast
b. (void*)
c. dynamic_cast
d. const_cast
e. reinterpret_cast
2. class A
{
public: void f();
protected: A() {}
A(const A&) {}
};
why are the default and copy constructors declared as protected?
a. to ensure that instance of A can not be created via new by a more derived
class
b. to ensure that instance of A can only be created by subclasses of A
c. to ensure that isntance of A can not be copied
d. to ensure that A cannot be used as a base class.
e. to ensure that A cannot be instantiated on the stack
3. template<class T1; class T2; class T3>
int Product(T1 a, T2 b, T3 c)
{
return a*b*c;
}
what is wrong with the sample code above?
a. templates must be class definitions
b. the template parameters should be separated by commas.
c. the template definition is missing a pair of braces.
d. template parameters must be pointer types.
e. the * operator has not been defined for T1, T2, and T3.
4. class FOO
{
char * buf;
public:
Foo (const char *b = "default")
{
if (b)
{ buf = new char[std::strlen(b) + 1];
std::strcpy(buf, b);
}
else
buf=0;
}
~Foo() { delete[] buf; }
};
Foo func (Foo f)
{
return f;
}
when the function fun is called, the program may crash or exhibit unexpected
behavior, what is the reason ofr this problem?
a. the destructor may attempt to delete the string literal "default"
b. the destructor needs to check that the value of buf is not 0.
c. the class does not allocate a long enough buffer.
d. the function needs to return Foo& instead of Foo.
e the class needs to specify a copy constructor and assignment operator.
Pasted from <http://www.mitbbs.com/article/JobHunting/31426509_3.html
>
1.請書寫一個程序,將整型變量 x 中數字左右翻轉後存到另一個整型變量 y中,例
如 x = 12345 時,y爲 54321,x = ‐123 時,y爲‐321。其中 x 的個位不爲 0。
void reverse (int x, int* y);
(1) 請實現該函數,以上函數原型是用 C語言寫的,你能夠用你熟悉的語言;
(2) 請寫出一段代碼驗證該函數在各類狀況下的正確性。
2.對集合{1, 2, 3, …, n}中的數進行全排列,能夠獲得 n!個不一樣的排列方式。如今
咱們用字母序把它們列出來,並一一標上序號,如當 n=3 時:
0.123
1.132
2.213
3.231
4.312
5.321
如今,請書寫一個函數 void print (int n, int k), (函數原型是用 C語言寫的,
你能夠用你熟悉的語言)在已知 n和序號 k 的狀況下,輸出對應的排列,並簡要闡述
思路。
3.一維數軸上有 n 條線段,它們的端點都是已知的。請設計一個算法,計算出這些線
段的並集在數軸上所覆蓋的長度,並分析時間複雜度。例如,線段 A 的座標爲[4, 8]
,線段 B 的座標爲[1, 5.1], 那麼它們共同覆蓋的長度爲 7。 請儘可能找出最優化的
算法, 解釋算法便可,沒必要寫代碼。
Pasted from <http://www.mitbbs.com/article/JobHunting/31428195_3.html
>
Given a sorted integer array and a number, find all the pairs that sum up to
the number.
這個很簡單,但如今多了一個條件
What if the array is sorted by absolute value, for example {1, -2, 4, -9},
find the answer in O(N).
這樣有什麼好的思路麼?
Pasted from <http://www.mitbbs.com/article/JobHunting/31430593_3.html
>
How do you find sequences of consecutive integers in a list that add to a
particular number.
Array裏面正負數都有.
這個能在O(n)時間內解決嗎?
Pasted from <http://www.mitbbs.com/article/JobHunting/31431861_3.html
>
A m*n matrix of integer, all rows and columns are sorted in ascending order.
Find the most efficient way to print out all numbers in ascending order.
Pasted from <http://www.mitbbs.com/article/JobHunting/31434325_3.html
>
一次面世Google,問到hash table是怎麼實現的。我說了一個取尾數(round)的方法
,他說這個方法很navie,工業界通常用其餘的方法,比方說STL的map。
我想了半天沒有想出來,到這裏問問。hash table具體怎麼實現的啊?
Pasted from <http://www.mitbbs.com/article/JobHunting/31434401_3.html
>
49 輛賽車. Assume for each one, it travels the track in the same amount of t
ime every time. Also assume no two finish the track in the same amount of ti
me. Suppose you have 7 tracks, but no timer. Design races to find the 25-th
fastest with minimal number of races.
Pasted from <http://www.mitbbs.com/article/JobHunting/31434523_3.html
>
ime span: 38:39
interviewers: 2 -- 1 indian, 1 american
How do you know the bloomberg?
What position do you expect?
What language do you want to answer with? (I choose C.)
What kind of questions do you meet for the online assessment?
what is static in C? how is it implemented by the compiler?
write the definition of a function that returns both the max and min.
why do you use the condition variable?
how to implement a lock?
Under what condition must you use linked list instead of array?
what data structure can you use to store elements dynamically and access
them efficiently?
The complexity of finding any element in a linked list in the worst case.
multi-thread library programming: did you write your multi-thread library
with p-thread? is there any problem you have with you library?
did you do your projects on linux? If you want to find a string in a file,
what command should you use?
do you know vector in C++?
a question about real-time programming (I forgot)
what is buffer overflow?
一些問題是針對個人簡歷裏面提到的內容,因此,簡歷裏面的內容要儘可能的吃透。
Pasted from <http://www.mitbbs.com/article/JobHunting/31434685_3.html
>
Given two classes:
class B
{
public:
B(args_1);
B(args_2);
// and many constructors with different arg lists
};
class D : public B
{
public:
D(args_1) : B(args_1) {}
D(args_2) : B(args_2) {}
// and many constructors with different signatures similarly implemented
// some additional stuff specific to D
};
Assume that the arg list for B's constructors are quite long and may be
revised pretty often in the future, in which case D's constructors have
to be recoded correspondingly. Duplicating the update by copy-and-paste
will certainly work here. Can you propose a better way so that the
update can be done in one place without copy-and-paste duplication?
Pasted from <http://www.mitbbs.com/article/JobHunting/31434891_3.html
>
Given a large string (haystack), find a substring (needle) on it.
感受這道題不就是scan一遍嗎?
有什麼time and space complexity上面的trick嗎?
Pasted from <http://www.mitbbs.com/article/JobHunting/31435419_3.html
>
準備了好久,看了好久算法的書。。 結果被問了一個怎麼 optimize memcpy()..傻
眼了。。碰到了女老印,倒黴~~~~
Pasted from <http://www.mitbbs.com/article/JobHunting/31435587_3.html
>
規問題後,問了個code的問題:
給一個substr,如何判斷它在不在給定的str裏面。
substr有兩個新的符號可能在裏面:
(1)* : 0-n個任意字符
(2)? : 1個任意字符
太緊張了,因此面試者簡化了題目,說去掉「?」,而後讓code和測試:基本框架出來
了,可是好多特殊狀況沒有處理到,好比substr以「?」起頭。
後來又問若是加入「*」有沒有思路,剛說了兩句就out of time了。
唉,失敗了,不知道有沒有下文。
Pasted from <http://www.mitbbs.com/article/JobHunting/31436721_3.html
>
給定 X[1..n] and Y[1..m] 兩個 arrays,已經sort好了.
如何找到X <Union> Y的median?我說用merge sort,要O(m+n/2)時間。面試官明顯不
滿意。
這個已經 lineal了?難道還有更快的?
Pasted from <http://www.mitbbs.com/article/JobHunting/31437417_3.html
>
given a 32 bit number N and 2 numbers(A & B) that determine 2 different bit
pos
itions of N how do you make all the bits between A and B equal to another
given
integer k.
given (A,B is in the range [0 to 31] and
k<=2^(B-A+1) ( so that k fits between B-A+1 bits). Give an O(1) solution for
th
is
e.g if N=9 ( 1001) ,A=0 ,B=2,K=5(101 then the result should be 1101 (1.e 13)
這個題是什麼意思啊?
Pasted from <http://www.mitbbs.com/article/JobHunting/31437907_3.html
>
在作careercup上面的題目, 有兩個問題沒有看懂, 但願有人指點下
1 一個BST, 給定一個值, 打印出全部的path,使path上全部節點的值等於給定值;
2 一個tree, 如何高效的找出最長的path?
☆─────────────────────────────────────☆
mitbbs59 (59) 於 (Fri Jul 3 15:35:37 2009, 美東) 提到:
這都是amazon的題目吧
1.sum of all nodes in a path = givenValue
2.http://www.careercup.com/question?id=87897
Pasted from <http://www.mitbbs.com/article/JobHunting/31441709_3.html
>
是現場寫code的面試。
第一道是寫一個函數,兩個參數(String prefix, String s), 返回true若是s有
prefix
第二道是寫一個函數,兩個參數(int[] a, int sum), 找出數組裏加起來是sum的幾個數
我第一題算是答出來了,第二題沒作完,沒有好的思路。。。
大人指教一下
Pasted from <http://www.mitbbs.com/article/JobHunting/31446979_3.html
>
Went to Adobe to interview a Senior SW Engineer position,
總的interview的不錯, 但被下面問題問倒了,讓回去想一想,
Q1:
"We need to compare thousands text files with each other, they are not big,
less than 100K each. They are in a directories tree, with a few levels of
subdirectories, how to speed up the comparing process ?"
My answers: We can read them all of these files into memory once so that we
can reduce the number of diso I/O.
[Feedback: That is a good appoach].
Q2: How to read these files into memory (on MS Windows platform ) ? how do
you maintain directory structure in memory ?
My answer: I talked some garbage ....
Q3: If someone already wrote the code in slow way, read each file from disk,
do some thing, close the file, read another one, etc. Can you make a "
portable layer API" libary so that with minimal effort, old code can still
work but much faster ? (of course, we need to recompile the code).
Please help with Q2 and Q3, thanks a lot.
--
Pasted from <http://www.mitbbs.com/article/JobHunting/31448285_3.html
>
今天把M的onsite給拒了,實在沒有時間面這麼多company,又不想浪費別人的時間。不
過內心仍是以爲有點惋惜,嘖嘖。
貼一下M的經歷吧。On campus就一輪,30分鐘。Interviewer是個老中,一上來看我res
ume,問爲啥phd了還來面sde。而後開始問resume上的東西,我藉機會sell了一下本身。
Technical問題只有兩個:
1)Coding題很是old了。兩個string找最長common substring。這個當場確定code不了
subffix tree。因而就用暴力的方法,三下五除二搞定。而後問complexity,如何改進
,bla bla bla。居然忘記了說能夠用DP,低級失誤啊。不過面試官還算滿意。
2)你認爲bing有什麼能夠改進的(我投的是bing)?你research作的東西有沒有能夠a
pply的?
而後時間夠了,面試官說三週內給結果。一週以後就收到了onsite通知。攢人品,祝大
家好運!
Pasted from <http://www.mitbbs.com/article/JobHunting/31451397_3.html
>
今天又作coding面試了,上來就要寫個函數 返回二叉排序樹的第k個最小的node。
我寫了一半,感受不對勁。請大俠賜教。
Pasted from <http://www.mitbbs.com/article/JobHunting/31451705_3.html
>
you are given a M x N matrix with 0's and 1's
find the matrix with largest number of 1,
1. find the largest square matrix with 1's
2. Find the largest rectangular matrix with 1's
沒想到頗有效的辦法。你們見集思廣益~
Pasted from <http://www.mitbbs.com/article/JobHunting/31452521_3.html
>
有幾個同窗問麪筋,不太記得起來,不少版上是有的,因此以爲那些面你的人水平挺一
般的,下面貼兩個印象深入的:
1。這道題被好幾個不一樣的公司面到過:Fibonacci數列,通常讓你給一個recursive的
版本,而後寫個iterative的版本,而後問有沒有更快的可能性。我記得之前在某個版
討論過,參考wiki:
這樣的方法,能夠在O(log(N))的時間和O(1)的空間複雜度內算好。要寫程序的話,用
相似下面的方法:
Matrix2x2 F[][2] = {{1, 1}, {1, 0}}, Fn[2][2] = {{1, 0}, {0, 1}};
while (N) {
if (N & 1)
mul(F, Fn, Fn); // Fn = Fn x F;
mul(F, F, F); // F = F^2;
N = N >> 1;
}
2。另一題很簡單,可是蠻tricky的。How to test if a number "a" is power of 2
return (a-1) & (a) == 0;
網上常常有問怎麼樣判斷一個數裏面有多少個1的位數,這個只是其中一個最簡單的特
Pasted from <http://www.mitbbs.com/article/JobHunting/31452533_3.html
>
於完成了F公司歷時2個月的全部interview,總算能夠鬆口氣了,據稱他們下週一開會
討論,但願最終會修成正果。來講點經歷吧。
多虧好朋友Z幫忙forward resume,很快就來了第一輪phone interview。編程題還有點
老:
[Coding Q1]: Given an array A, output another array B such that B[k]=product
of all elements in A but A[k]. You are not allowed to use division.
其實這題interview以前在本版JHQ看過,但是當時看的題目太多,沒有去想solution。
因此剛開始聽到這題還surprise了一下。我以爲這個不能用除法的限制太無聊了(建議
改個problem來問這個algorithm),因而忍不住問why not division,順便拖延一下時
間想算法。面試官說除法慢...顯然不是什麼很convincing的理由,我說那乘法也慢啊。
說完我已經想到怎樣作了,因而順利過關。
接着就來了比較衰的第二輪,題目是這樣的:
[Coding Q2]: You are given a string e.g."face" and a set of mutation rules,
e.g. a->@, e->3, e-E. Print all the possible strings that can be generated b
y the rules, e.g. f@c3, fac3, etc.
其實就是BFS再加上hash table判斷是否重複print。立刻就想到algorithm,面試官說好
,你開始寫吧。而後問題就來了,過久沒寫c++忘了hash table的函數定義。好像依稀記
得hash table還有幾個版本,想了一會沒想起來,又很差意思問,汗!最後仍是忍不住
問了,他說你隨便給個函數名和接口吧。最後磕磕碰碰總算把程序寫完了,卻給人留下
了很很差的印象,感受寫程序很不熟!聽說最後這我的給了我一個borderline,還算好
,沒把我fail掉。真慚愧啊,可憐我仍是寫c++起家的...
由於第二輪不太理想,原本應該兩輪事後就onsite,結果hr來信說要第三輪phone,還很
好人的說We do have three phone interviews at times. We are constantly evalua
ting our process so I apologize for the change. 第三個面試官又臨時換人,最後
竟然是同系師弟,不過以前沒見過面,否則能夠套近乎了。。。言歸正傳,換人大概還
是由於他們組想看看我match與否。他問的都是machine learning,風格和原來徹底不一樣
,還多多少少有點surprising的。
[Coding Q3]: Implement one step of decision tree which splits the node into
two subtrees.
以後還討論了一些learning的問題,我問了他們用的technique,有什麼存在問題等等,
相談甚歡。
關於onsite,由於簽了NDA,不方便透露題目。請你們也不用發信來問了,作人仍是要講
信用的。只看面經的各位看官能夠略過如下了。。。至於那個onsite可謂一波三折。本
來訂了機票週四晚上到sfo,週五中午onsite,挺好的schedule。結果某airline竟然機
件故障,把飛機拖去修了幾個小時,又不願調其餘飛機來,白白miss掉了從vegas飛sfo
最後一班航班,被迫在vegas住了一晚。下了飛機都晚上12點了,隨便找個airport旁邊
的hotel住下,改了次日最先一班機。結果次日又晚點兩個小時!據稱SF大霧,tra
ffic control...折騰了半天到了F都週五下午兩點多了,又累又緊張。連HR也只好說:
it's hard to visit us...不過無論那麼多,灌了杯coffee就上陣了,結果還好,沒有
想象中intensive,也發揮本身的水平了. 由於onsite去的太遲,沒見到manager,HR又
說schedule TWO more follow-up,其中一個是manager。OMG,我說好,那就back-to-b
ack吧。上週終於面完真是relieved啊,先後5輪,歷時2個月。
關於面試的經驗教訓,個人感受是1)F的interview是比較嚴謹的,phone interview就
要candidate在white board上把code寫出來,不是說說算法就算了,detail也問得很仔
細。由於他們要求員工follow整個project,從idea,到algorithm,到implementation
,而不是本身想個東西出來讓別人寫code實現就完了。各位像我同樣平時寫research m
atlab code多於寫c++的phd要注意多練練手了,當心陰溝翻船。2)Never give up不管
interview多麼不順利。不要被外界的不利因素distract本身,該準備什麼就好好準備,
我相信life has miracles.
PS: 貌似F的同窗們也會上來job hunting版。文中如有冒犯之處,請多多包涵。F的S同
學,你那題大概說了也沒關係吧,沒理解背下來也沒啥用的。F的Y同窗,我沒有泄漏你
的面試題,之後還能夠繼續用,哈哈。
Pasted from <http://www.mitbbs.com/article/JobHunting/31452725_3.html
>
看了一夜精華區,發現這道題有問題啊。
5。Given a graph (any type - Directed acyclic graph or undirected graphs
with loops), find a minimal set of vertices which affect all the edges of
the graph.
An edge is affected if the edge is either originating or terminating from
that vertex.
The time should be less Q(n^2)
這個題就是最小頂點覆蓋問題吧?
或者是我對最小頂點覆蓋問題理解有誤?或者對這題理解有誤?
Pasted from <http://www.mitbbs.com/article/JobHunting/31452961_3.html
>
00*100部分有序矩陣數組的排序
有100個有序數組(從小到大),每一個裏面有100個數。
設計一個算法合併這個一百個有序數組,中間步驟只容許多申請一個大小爲100個數的
空間(也就是一個數組的大小)。
Pasted from <http://www.mitbbs.com/article/JobHunting/31453089_3.html
>
1. How to call C++ code in C? How to call C code in C++?
2. In which three cases, initialization list has to or is preferred to be
used for a constructor?
3. Can we design singleton by setting all the data member and method of a
class to be static?
Some others:
4. Is overloading allowed in C? If not, how to differentiate them?
5. Default methods that are generated by a class in C++.
6. Difference of struct and class in C++
7. Given a class has first name, last name, SSN and etc.Need to query
according to first name, first name + last name, what STL should be used? (
If map/multimap, what should be the key?) How the query should be? How to
query all the first name that initialed as "J"?
8. Meaning of static in C and C++
9. Meaning of inline in C++; where should it be used?
幾天上午一個面試的問題。有些東西沒用過,雖然之前看過,可是仍是沒有答出來;都
去準備其它的去了,沒想到全是問c/c++的問題。仍是有些不服氣,move on。
Pasted from <http://www.mitbbs.com/article/JobHunting/31454759_3.html
>
形象投票:
形象得分: 291 分
個人博客
0 0
[上篇] [下篇] [同主題上篇] [同主題下篇]
發信人: mandman (滿老), 信區: JobHunting
標 題: [合集] 一個Google / MS 面題
發信站: BBS 未名空間站 (Wed Oct 28 23:41:26 2009, 美東)
☆─────────────────────────────────────☆
wisher1 (wisher) 於 (Fri Aug 7 16:59:50 2009, 美東) 提到:
在精華區裏看到屢次, 都沒有答案.
刪除一個singly linked list節點, 但不知道head.
不知道head, 怎麼找以前的那個節點阿? 又沒說有loop.
誰知道trick在哪?
多謝!
☆─────────────────────────────────────☆
chaicar (chaicar) 於 (Fri Aug 7 17:05:15 2009, 美東) 提到:
record the next node of it
delete its next node
do the assignment to copy saved next node to it
Pasted from <http://www.mitbbs.com/article/JobHunting/31454761_3.html
>
Write code for finding number of zeros in n!
OR
Find the first non-zero digit from the right in 100! (Factorial of hundred).
Can an int store hundred factorial. What size of array should be sufficient
to solve the above problem. Write a code for the same.
你們有什麼idea?
Pasted from <http://www.mitbbs.com/article/JobHunting/31454839_3.html
>
you have a billion google searches a day, design a data structure which
lets you pull out the top 100 unique ones at the end of the day.
個人想法是create hashtable
scan billion data 一次,在hashtable紀錄每一個query的次數
而後再scan billion data一次,經過heap和hashtable找到top 100
不過這樣的話,billion data會被scan 2次,disk i/o會很大
不知道有沒有什麼scan billion data一次就能夠找到top 100的辦法
你們討論一下
Pasted from <http://www.mitbbs.com/article/JobHunting/31455781_3.html
>
er executing this code:
list<int> L;
...
list<int>::iterator in_range =
find_if(L.begin(), L.end(),
compose2(logical_and<bool>(),
bind2nd(greater_equal<int>(), 1),
bind2nd(less_equal<int>(), 10)));
What is the best assertion that should be used as a post-condition?
assert(in_range == L.begin() || (*in_range >= 1 && *in_range <= 10));
assert(in_range == L.end() || (*in_range >= 1 || *in_range <= 10));
assert(*in_range >= 1 && *in_range <= 10);
assert(in_range == L.end() || (*in_range >= 1 && *in_range <= 10));
assert(in_range == L.end() && (*in_range >= 1 && *in_range <= 10));
Pasted from <http://www.mitbbs.com/article/JobHunting/31456679_3.html
>
he difference of following two expressions: Test A or Test B()
Class Test;
Test A;
or
Test B();
Pasted from <http://www.mitbbs.com/article/JobHunting/31456597_3.html
>
When a derived class is destructed, at what stage will the base class's
destructor be called?
the answer varies on a case-by-case basis
It will automatically be called after the destructors for the derived class
data members
It will automatically be called before the destructors for the derived class
data members
It should explicitly be called at the beginning of the derived class
destructor
It should explicitly be called at the end of the derived class destructor
Pasted from <http://www.mitbbs.com/article/JobHunting/31456485_3.html
>
什麼樣的狀況下用 virtual deconstructor?
2. virtual function是如何工做的?virtual table 是如何實現的?
3. virtual function具體調用哪一個function是在編譯的時候,仍是在代碼執行的時候
決定的?
4. 類的copy constructor 和 assignment operator "=" 有什麼區別?有什麼主意事
項?
個人概念不是太清楚,請好心人幫忙回答。有包子送。
什麼網站有C++的測試題庫,哪有free的能夠練練手?bloomberg 考的C++問題哪裏能得
到?
謝謝!
Pasted from <http://www.mitbbs.com/article/JobHunting/31457805_3.html
>
給定一個二叉樹的一個node,編程返回中序遍歷的下一個node。若是最後一個,返回
null, 怎麼作?
Pasted from <http://www.mitbbs.com/article/JobHunting/31459733_3.html
>
網上看來的:
一堆數,其中一些數出現了一次,一些數出現了兩次,只有一個數出現了三次
找出那個出現了3次的數
hash方法很trivial就不說了。
若是用bitwise operator,怎麼高效的作?除了XOR,是否是還得用點別的辦法?
Pasted from <http://www.mitbbs.com/article/JobHunting/31460327_3.html
>
就是一直一篇文章,球能夠覆蓋全部單詞的最小窗口,記得bbs有幾我的提過這個題,
可是沒人給過解,但願牛人可以賜教!!感激!
Pasted from <http://www.mitbbs.com/article_t/JobHunting/31460569.html
>
1. If the probability of rain tomorrow is twice than no rain.
What is the probability of rain tomorrow:
2. A grass, 3 cow can eat 3 days. 2 cow can eat 6 days. How long can one cow
finish the grass?
Pasted from <http://www.mitbbs.com/article/JobHunting/31461095_3.html
>
Given a document and a query of K words, how do u find the smallest window
that covers all the words at least once in that document? (given you know
the inverted lists of all K words, that is, for each word, you have a list
of all its occurrrences). This one is really hard. Could someone propose an
algorithm in O(n)?
Pasted from <http://www.mitbbs.com/article/JobHunting/31461767_3.html
>
Desgin an algorithm to find whether a given sting is formed by the
Intealeaving of two given strings. 注意,原來的兩個given strings的自己的
character的順序不能變。
這個題不簡單,由於你不能簡單的用3個指針分別指向三個string,遇到string A的就拷
貝到dst string,遇到string B的就拷貝他的。最麻煩的在於遇到A,B都相同的,你不能
advance both ptrs until they are different and then move one of them back.
The point is who is to be moved back? You cannot simply randomly choose one.
For example,
stringA: ABCEF...
string B: ABCA...
dst string : ABCABCEF....
那麼,若是取B's ABCA 就錯了。
哪位大俠能指教怎麼作呢?
Pasted from <http://www.mitbbs.com/article/JobHunting/31463527_3.html
>
Given a set of points (x,y) , find all pairs of points whose distance is
less than a given number, say, K.
這個題brute force: 對每一個點,求和其餘點距離,O(N^2),不知道哪位大俠有高見啊
?請不吝賜教!萬分感激!
Pasted from <http://www.mitbbs.com/article/JobHunting/31463131_3.html
>
{1,5, -5, -8,2, -1,15 }
要把負的掃到左邊,正的掃到後邊。
不能改變順序
獲得{-5 -8 -1 1 5 2 15}
這個題有time 低於 n^2 space=O(1)的解法嗎
Pasted from <http://www.mitbbs.com/article/JobHunting/31464055_3.html
>
這些東西我很都不熟悉。但願有高手指點指點,呵呵
1. Mempool design with 30k limit.
mempool是應該在一開始就allocate 30k 連續的內存,而後分配和管理?
或者是每次call allocate(n)的時候再經過operator new[]來分配內存,update size
member?若是是的話,free(ptr, n)怎麼寫呢?貌似operator delete[]不能帶size參
數啊?
總之我就是對memory design這塊很不熟悉。。。
2. Implement put/get methods of a fixed size cache with LRU replacement
algorithm.
這個是否是用fixed size的max heap來實現?每一個元素定義一個key,表示距離上次使
用的時間,每使用一個元素,就至關因而把它的key更新爲比當前最小值更小的數,然
後作heapify()操做?
每put一個元素,就assign新元素一個最小的key,而後用新元素替換掉堆頂點,而後作
heapify?
3. Write a function to implement a buffer for DataOutputStream.
這個我徹底沒啥概念了。。。求指點一下~
4a. How do you write malloc and free to detect memory reference violation?
4b. flag a block of memory as used by putting some bit pattern at the
beginning of the block. What bit pattern will you use?
這兩個問題也是摸不到頭腦的。。。
5. How to implement singleton without using static/global variable?
徹底沒思路,design pattern我基本上就是臨時抱佛腳都還沒抱上。。。
Pasted from <http://www.mitbbs.com/article/JobHunting/31464509_3.html
>
其實這些題也適合別的OS,只不過面試的這個職位是基於Linux的。
1. buffer overflow的工做原理
問的特定環境是: 在client-server的model下,client是如何經過網絡形成server上
的 buffer overflow,從而在server上製造出security hole?
俺只知道,確定是client給server發的packet中,故意把特定的field(好比長度)弄錯
,使得server上的程序在copy的時候,形成buffer overflow (由於一個特大的length),
誰能說說到底buffer overflow 是如何產生的?有什麼好的文章,或者網站link介紹這
個問題的?以爲搞network security的同窗應該很明白。
謝謝!
2. 關於TCP的實現的問題(1)
操做系統中TCP的實現用到了幾個timer,分別是什麼?
這個題怪怪的,誰能知道這樣的細節?
3.關於TCP的實現的問題(2)
TCP packet header 中的Window size (接受方的 window size)的update是多久進行
一次?就是問接收方在什麼狀況下,或者是多麼頻繁向發送方update新的windows size?
4. 關於socket
TCP connection 用socket創建後,有可能有很長時間通信的雙方沒有任何數據來往,
好比telnet client登陸telnet server後,可能人會離開很長的時間,這個時候TCP
server 怎麼知道TCP client 是alive 仍是crashed?
若是你設計一個本身的應用程序,你該如何處理?就是問在你本身的client和server建
立connection後,你是如何check whether the socket is still alive or not? 是在
你本身的應用程序中定時的發一些相似於"Hello" 的packet做爲查詢呢?仍是OS的
socket可以自動的提供the information about the socket status?
5.如何用C語言實現object oriented programming?
6. 關於kernel synchonization
在SMP系統下,用spinlock,仍是用semaphore來做synchronization比較好?爲何?
俺只知道若是你的代碼不能sleep的時候必須用spinlock,好比在interrup handler裏面
。還有就是若是用了spinlock,你要可以處理的很快。別的就想不出有什麼區別了?
不過Jonathan Corbet的"Linux device drivers"一書中說在Linux kernel 的實現中,
spinlock引入的主要目的是爲了讓 Linux在SMP系統裏運行的更有效,不知這是爲何?
俺被問的一塌糊塗,很鬱悶,請大拿們給啓發一下。
謝謝!
Pasted from <http://www.mitbbs.com/article/JobHunting/31466547_3.html
>
如題,職位是web engineer,但願有人能夠用到。
第一次電話是recruiter的,按清單問了些問題:
1. say some http methods?
2. get/put difference?
3. what does DTD for xml mean?
4. common protocol used in layer 4?
5. describe different ways to use css in html
?
6. difference between well-formed and valid xml?
前兩天第二輪technical phone interview:
1. why and how did u get into web development?
2. what do u like about web development? not like about it?
3. why do u want to work for google? 我扯到ajax的推廣,他順着問 ajax
principle, security issue
4. what language are you comfortable with? talk about it. why and how did
people design it?
5. explain 3 components of MVC
6. what happens when a user types google.com in URL bar and press enter?
(dns, http get, tcp connection establishment, etc)
7. what may slow down the rendering of html
page when its contents have been
downloaded from server? (load other resources like css,js and parse them,
etc)
8. read n lines of random numbers(space as delimiter) from a file, lines
with same numbers are treated as duplicated lines, regardless of the order.
check and print non-duplicate lines. performance time analysis.
順帶問一個轉身份的問題:若是我H1->F1->H1,從新轉回H1的申請被拒了,那是否是還
停留在正常的F1? 一樣,其它轉身份,例如 F1<->F2, F2<->H4互轉之類,若是申請被
拒,是正常停留在以前的身份嗎? 前幾天看到個帖子,H1 transfer被拒,身份就黑了
,不知道跟這些例子有什麼區別,謝謝。
Pasted from <http://www.mitbbs.com/article/JobHunting/31467259_3.html
>
1. there are only 6 db connections in the pool, all 6 are being used,
another request needs to connect to DB, it does not want to wait. How to do
it? One solution is to make a new connection and add it to the pool. But the
interviewer wants standby solution. Anyone knows the standby solution?
Thanks
2. For the db connection. min = 10 and max = 40.
Will 10 connections be created at server start up time?
2.1 If we start with using 13 connections, when all the jobs are done, how
many will be kept in the pool? 10 or 13?
2.2 If we start with using 45 connections, when all the jobs are done, how
many will be kept in the pool? 40 or 45?
Pasted from <http://www.mitbbs.com/article/JobHunting/31467451_3.html
>
uppose there are n cities, and there may / may not be flight route
between c1 to c2. Design data structure to store this information and write
a function that receives two cities name, and return whether or not there is
a flight between them (either directly or through connections)
Pasted from <http://www.mitbbs.com/article/JobHunting/31469019_3.html
>
不trivial
Given a 3x3 square:
1 2 3
4 5 6
7 8 9
You are allowed to do circular shift on any row, and
circular shift on any column, as many times as you
please. Question: can you switch position of 1 and 2 with
the allowed circular shifts?
Pasted from <http://www.mitbbs.com/article/JobHunting/31469459_3.html
>
一般看到這種題目都感受有點頭疼。好比,design a messaging system. an online
poker room.你們說說看
Pasted from <http://www.mitbbs.com/article/JobHunting/31470087_3.html
>
剛剛on-stie面試完某大公司。面試了7我的,大概問了20-30道題,有1道題不會,儘管
其餘的都打上來了,非常鬱悶,本覺得本身準備的足夠好了,哎。可是這道題不會,很
不甘心,但願大俠們幫助!!!
In our indexes, we have millions of URLs each of which has a link to the
page content, now, suppose a user type a query with wild cards *, which
represent 0 or multiple occcurrences of any characters, how to build the
index such that such a type of query can be executed efficiently and the
contents of all correpsonding URLs can be displayed to the users? For
example, given a query http://www.*o*ve*ou.com. You man need to find iloveyou.com, itveabcu.com, etc.
之前我見過相似用wild card來作query的,就*來講,一個方法是用*split query into
a few parts, for example, *o*ve*ou => o, ve, ou, 而後分別用o, ve, ou 查詢,
可是彷佛不適合這道題。 另外,若是對Index裏的每個URL建suffix tree ,而後對
每一個query check againgt 全部的suffix tree, 這樣實際上就是scan all urls, 明顯
也不合適。可是排序?我想不出來。
這道題真難倒我了。。。。。。求求大俠賜教。不只僅是爲了面試,就是以爲不甘心。
。。多謝!!!!
Pasted from <http://www.mitbbs.com/article/JobHunting/31472965_3.html
>
ftware Development Engineer
問候以後,首先問了一下個人research, 讓我具體的闡述我提到過的算法
而後OOD的一道題,其實不難,但我感受本身答得很差
have a furniture class, some child classes like table, chair, etc.
they want to extend the class hierarchy, as there are wood table, steel
table, wood chair, steel chair, and so on.
我首先給出class + interface的design:
furniture (table, chair, ...)
table ( woodtable extends table implements wood, steeltable extends table
implements steel)
chair ( similar as table)
然而interviewer馬上指出這樣的話,若是要加fire, 或者和重量有關的functions時,
會有code duplication (由於wood可燃,steel不可燃, assuming fire function is
defined in wood and steel interfaces). 我最後說那把wood和steel也改爲class (c
++ multi-inheritance), 這樣能夠avoid code duplication. Interviewer又問那麼如
何實現woodsteeltable? 我說就inherit woodtable and steeltable. 本身對這個問題
整體感受很差。你們有什麼好的design?
後面的問題比較簡單:
given a deck of cards, how to shuffle it?
having a web application, front-end, middle layer and database. How to scale
database to accommodate increasing traffic?
Pasted from <http://www.mitbbs.com/article/JobHunting/31471911_3.html
>
onsider a function which, for a given whole number n, returns the number of
ones required when writing out all numbers between 0 and n.
For example, f(13)=6. Notice that f(1)=1. What is the next largest n such
that f(n)=n?
Pasted from <http://www.mitbbs.com/article/JobHunting/31471823_3.html
>
請解釋garbage collection?
在garbage collection中,對circular reference的你怎麼辦?
Pasted from <http://www.mitbbs.com/article/JobHunting/31470831_3.html
>
如下文字轉載自 SanFrancisco 討論區 】
發信人: soldiercrab (老軍醫專治裝B文學小青年), 信區: SanFrancisco
標 題: 一朋友被Google的電面幹掉了
發信站: BBS 未名空間站 (Sat Dec 5 15:03:55 2009, 美東)
栽在一道編程題上:Find a longest increasing subsequence in an integer array。
問問題的人要求朋友拿出O(nlog(n))的算法,但朋友只給出了O(n^2)的dynamic
programming的方法。其實我以爲給出dynamic programming算法足夠進入下一輪了。那
個O(nlog(n))的算法好歹也值當年一篇paper,並且貌似不是那麼直觀。電面就想出來
不容易。不過多半是我段位不夠,還不夠Google的要求。或者朋友的dynamic
programming其實錯了(這道題要倒過來找,稍微繞一點點)。
Pasted from <http://www.mitbbs.com/article/JobHunting/31473303_3.html
>
發信人: MeetYouThere (Meet You There), 信區: JobHunting
標 題: yahoo面試題
發信站: BBS 未名空間站 (Sun Dec 6 18:26:44 2009, 美東)
Given n points in the form (x1, y1, z1)…..(xn, yn, zn), find the k closest
points to the origin.
Given the same points as above, find the K closest points to each other.
有什麼快速解法沒
--
※ 來源:•BBS 未名空間站 海外: mitbbs.com 中國: mitbbs.cn•[FROM:
71.198.]
Pasted from <http://www.mitbbs.com/article/JobHunting/31473965_3.html
>
1. one array filled with numbers from 1 to N, but one number is missing. wha
t's the most efficient way to find the missing item? what about two or more
numbers are missed?
2. find the repetative chars in a string and delete them
3. find the binary tree from its preorder and inorder traversal
Pasted from <http://www.mitbbs.com/article/JobHunting/31474331_3.html
>
and(5) generates a random integer number between [1, 5], how do you
generate a random integer number between [1, 7] when you can only call
rand(5)?
Pasted from <http://www.mitbbs.com/article/JobHunting/31476251_3.html
>
鑑於安靜的氣氛,來一個:
Given an integer, print the closest number to it that is a palindrome
input: 1224
return: 1221.
Pasted from <http://www.mitbbs.com/article/JobHunting/31477969_3.html
>
Given a value and a binary search tree.
Print all the paths(if there exists more than one) which sum up to that valu
e. It can be any path in the tree. It doesn't have to be from the root.
我理解是這個path能夠是其中任意一截,不用包括頭尾
Pasted from <http://www.mitbbs.com/article/JobHunting/31478003_3.html
>
第一個面試官是個中國人,女的。
開始想同她套套近乎,也不知道是否是套錯了,反正當時感受她不喜歡我(其實後來回
頭想一想,可能不是她不喜歡我,她就是那樣說話的態度,是我感受不對)。
編程題
given a character string, print the number of occurence of each charcater in
order. ie. if the string is "ceabcw", then you should print something like:
a 1 b 1 c2 e 1 w 1.
she asked the possible data strucutre to approach. I gave array, hashtable,
and BST. she asked me to use BST, and using no recursive. Also how to handle
unicode.
而後問了一些測試題,讓我測試她們的一個產品。細節忘了,總之她對我不滿意。我也
以爲基本沒戲了。
第二個是個印度人。編程題:
given a matrix(assume it is a bitmap), print all cells that is on.
作的很差。後來問了一些測試題。
第三個是個白人。
開始問測試的問題,回答得通常。由於以爲已經沒有戲了,因此也不大有精神。
編程題很簡單,是實現階乘。不過有個問題沒有考慮到,就是overflow怎麼處理。
總之很是慘,第一次面試這麼慘。也請給位說說本身的想法怎樣解答那些問題
Pasted from <http://www.mitbbs.com/article/JobHunting/31481069_3.html
>
兩個玩家, 一堆石頭,假設多於100塊, 兩人依次拿, 最後拿光者贏, 規則是
1. 第一我的不能一次拿光全部的
2. 第一次拿了以後, 每人每次最多隻能拿對方前一次拿的數目的兩倍
求先拿者必勝策略, 若是有的話
Pasted from <http://www.mitbbs.com/article/JobHunting/31482015_3.html
>
題目:
從一個string 變到另外一個,好比"study"->"world" (字數相等),要求
1. 每次變一個字母
2. 每次改變後的string必須是一個詞典裏面能查到的英語單詞,好比你不能把study變
成atudy
Pasted from <http://www.mitbbs.com/article/JobHunting/31482527_3.html
>
google interview question from glassdoor
Design and describe a system/application that will most efficiently produce
a report of the top 1 million Google search requests. You are given:
You are given 12 servers to work with. They are all dual-processor machines
with 4Gb of RAM, 4x400GB hard drives and networked together.(Basically,
nothing more than high-end PC's)
The log data has already been cleaned for you. It consists of 100 Billion
log lines, broken down into 12 320 GB files of 40-byte search terms per line.
You can use only custom written applications or available free open-source
software.
Pasted from <http://www.mitbbs.com/article/JobHunting/31483445_3.html
>
u are given a binary search tree,
each node has a parent, left and right
do pre-order/in-order traversal without stack.
cannot change the structure of Node.
test cases: 8 6 7 5 4 9 10 11 12
test your codes using the test case above.
Pasted from <http://www.mitbbs.com/article/JobHunting/31483789_3.html
>
關於排列組合的程序問題, 我一隻都沒理解太清楚, 如今厚臉皮來請教一下. 這些問題
通常都要涉及到遞歸, 我這裏不是問的算法的問題, 而是程序的實現問題. 我一直不知
道怎麼實現纔是對的.
好比, 5 選 3 的全組合, a,b,c,d,e.
1 中間結果怎麼保存, 是用一個vector來保存,仍是用多個vector來保存?
2 若是用一個vector來保存, 遞歸的時候, 最終狀態是什麼? 什麼時候pop, 什麼時候push, ?
請問有誰能夠貼個code學習一下麼?
Pasted from <http://www.mitbbs.com/article/JobHunting/31484637_3.html
>
Given an array, find the longest subarray which the sum of the subarray less
or equal then the given MaxSum.
int[] FindMaxSumArray(int[] array, int maxsum)
for example, given array: {1, -2, 4, 5, -2, 6, 7}
maxsum=7
the result would be: {1,-2, 4, -2, 6}
Pasted from <http://www.mitbbs.com/article/JobHunting/31484653_3.html
>
iven a integer, output its previous and next neighbor number which has
the same number of bit 1 in their binary representation.
下面爲何去判斷(number & 3) != 2?
while ((number & 3) != 2) { // for right neighbor, change this line to
// (number & 3) != 1
Pasted from <http://www.mitbbs.com/article/JobHunting/31485091_3.html
>
要求當場寫code。
1 下面的int * takeaddress()有沒有問題, 啥問題?
2 寫個效率高的takeaddress出來, 實現一樣的功能
int * paddress, address1, *r;
paddress = takeaddress(); /* defined below */
address1= paddress[0];
int * takeaddress()
{
int address[8];
/* The address are defined here */
return address;
}
Pasted from <http://www.mitbbs.com/article/JobHunting/31485465_3.html
>
一個字符串,要求返回重複次數最多且最長的子字符串(假設源字符串中最長重複次
數最多的子字符串只有一個)。例如 「abcabcdfabcdf」要求返回「abcdf」. 由於「
abcdf」重複次數最多且最長。
俺只想到兩個土辦法:
1)找到全部字符串組合(例如a, ab, abc, abca, b, bc, ....),都放入hash table
,找重複次數最多的且最長的。
2)用Dynamic Programming找LCS的辦法,兩個字符串都是源字符串,而後在那個2D
array裏面找最長match,並計算重複的次數,而後輸出結果。
感受兩個方法的time complexity都挺大的,不知你們有沒有什麼別的想法?
Pasted from <http://www.mitbbs.com/article/JobHunting/31485529_3.html
>
不少都是老題,不過我專門整理了一下:
1. string match:
string Text, Pattern;
find a substring of Text matches with Pattern.
解法綱要:Rabin-Karp, KMP, suffix tree
變種1b: multiple match:
string Text, PatternSet[n];
find a substring of Text matches with any one pattern in the set;
解法綱要: Rabin-Karp
2.LCSubstring:
string A,B;
find the longest common consecutive substring;
解法綱要:DP(A.len*B.len複雜度),suffix tree(A.len+B.len複雜度)
3.Longest Palindrome
string A;
find the longest substring of A which is a palindrome;
解法綱要:相似2
4.Wild card match:
4a: Pattern contains '?'(s)
4b: Pattern contains '*'(s)
4c: Pattern contains both;
//如下是與dictionary有關的題目
5. dictionary + wild card search(通常都須要作適當預處理):
第一種search:search全部match結果
第二種:返回某個特定的結果,好比,全部match中最長的單詞
5a: pattern = ??a????b* (指定某些位上的字母)
5b: pattern = abcde* (指定fixed/unfixed length的前綴)
5c: pattern = ?a*bcd*e?f* (?和*任意混合搜索)
解法:待探討
6. dictionary + 包含字符集合:
Letter_Set = "aabbbcd";
第一種search: 全部至少包含2個a,3個b,1個c,1個d的單詞
第二種search:全部至少包含這個字母集合的單詞中最長的/最短的
解法:待探討
7. convert a valid word to another valid word of the same length, by
replacing one letter in one step, every intermediate word must also be valid;
解題思路:相同長度的單詞構建一個圖 + BFS
8. edit distance (misspell correction):
type a misppell word, give top10/all suggestions of correct words;
解題思路:首先定義計算edit distance的metrics,而後從每一個valid單詞計算出到它
距離<=某給定值的全部misspell的單詞(相似BFS的一層一層的算)
9. find a matrix with max area: each row and each column of the matrix must
be a valid word;
10. 樸素搜索,在dictionary中搜索一個單詞是否存在:
解題思路:hash; trie;
10b. shortest unique prefix: give a string, find its shortest prefix, which
doesn't match with any prefix of any valid word in dictionary;
for example:
cat against {dog, be, cut} is ca
cat against {dog, be, cut, car} is cat
cat against {dog, be, cut, car, cat} is null
解題思路:trie/prefix tree;
11. solve a crossword puzzle;
Pasted from <http://www.mitbbs.com/article/JobHunting/31485923_3.html
>
1. N臺機器,每臺機器有N個數
找median (2個數組找median的擴展版)
2. 已知coin denominator set,例如,2cent, 3cent, 5cent...
給定一個目標數,好比126cents
最少須要多少個coin。
這個題我之前問過一次,沒人回。。。我以爲是很好的題,貪心,回溯,DP均可以試試
。可是我一直沒找到最滿意的解。
3. 一個整數數組,找3個數知足勾股定理。求比O(n^2)更好的解
Pasted from <http://www.mitbbs.com/article/JobHunting/31486805_3.html
>
glassdoor上看到一道題目:
Given a file of unknown size, devise an algorithm to give equal probability
randomization to choosing a single line given a one line buffer space.
請教思路?
Pasted from <http://www.mitbbs.com/article/JobHunting/31487119_3.html
>
1. 很長的log file記錄了用戶訪問amazon.com的過程,兩列分別爲 userID 和
pageName.
log從上倒下按照點擊發生的時間順序。找出最popular的3連擊。
eg:
zhang welcome
Li Hello
Wang welcome
Li books
Wang Hello
zhang books
Li shopping cart
Li checkout
zhang shopping cart
Wang camera
zhang checkout
最popular的3 combo是books -> shopping cart -> checkout
2. Permutation of a string.這題最鬱悶,我把programming expose裏的code默寫了出
來。但這個方法是無論字符重複的,假設都是不一樣的。如今考官要不顯示重複的,並且
他要求不能先
都列出來再剔除,而要在發現重複的時候及時制止。沒想出來
3. Design a fight ticket booking system.
4. 老闆說網站很慢怎麼辦?
老闆說數據庫很慢怎麼辦?
沒一個很清楚的,每題都說了點。高人說說這幾題標準都怎麼答啊?謝了!
Pasted from <http://www.mitbbs.com/article/JobHunting/31487345_3.html
>
很差意思,剛纔不當心把第一個版本刪除了
上來好幾個 behavior 問題,通常 behavior 問題我不怎麼準備,答的很簡略,都是常
見的問題,我就不列了。
c++ and data structure
** single linked list, find nth from the end
** Overwriting and Overloading
** Stack vs. Queue
** Array of integers, all integers appear even times except one, find the
one appears odd times. (some following up questions for this one)
OOD
** Do you approve the following design?
Class Furniture{
Some functions related to the property of furnitures;
};
4 classes derived from Furniture
Class wood_chair
Class steel_chair
Class wood_table
Class steel_table
What if you need to design a lot of other furnitures like desks.... with
other materials like plastics
**An open question.Takes more time than any other questions. It is related
to the project they are working on, you should not be asked.
Good Luck to All of us :D
Pasted from <http://www.mitbbs.com/article/JobHunting/31487819_3.html
>
1. given n strings with equal length, say x. find the substring shared by
all of them. For example, abcx, abdx, abea, then ab is shared by all of them.
2. the gmail page loads very slow. any suggestion for improvement?
3. we want to check the number of querys obtained from the world in the last
minute and the last hour, what data structure should you use for that? If
there are billions of records, i.e, too many records for the main memory,
what suggestions do you have?
立刻就要第二輪店面了,求你們的題目和建議,咱們也能夠私下交流。謝謝!
Pasted from <http://www.mitbbs.com/article/JobHunting/31487921_3.html
>
你有一種語言的dictionary,你有一大串string,沒有delimit,你如何interpret成字典中
的字呢?
Pasted from <http://www.mitbbs.com/article/JobHunting/31488093_3.html
>
Given a binary tree
struct node{
struct node* leftChild;
struct node* rightChild;
struct node* nextRight;
}
The nextRight points to the right node to the current node in the same
level. Ask you populate the nextRight pointers in each node.
你們怎麼作這道題.
Pasted from <http://www.mitbbs.com/article/JobHunting/31491521_3.html
>
今天facebook第一面,如今hr都開始問技術問題了。。。問我會什麼語言,我就說C++
best, 她就
問我一些很基本C++的問題,還有兩個bubble sort best case 的複雜度和一個排序的
思路。
最後一題聽的不太明白,題目劇長,頭都大了。
面完以後給了puzzle的link,要求作meal和buffet裏挑一個。
問下你們哦,是否是Puzzle以後纔是phone screen啊?你們puzzle都是本身作的嗎?或
者哪裏有前
輩留下的hint嗎?
Pasted from <http://www.mitbbs.com/article/JobHunting/31494081_3.html
>
1。Java裏如何比較兩個objects是否相等
2。怎樣找出一個list是否包含循環
3。inheritance和composition:何時須要用到哪一種?
4。一個int array
如何找出subarray,使得元素之和最大
好比{-2,3,-1,3,-4}
那麼答案應該是{3,-1,3}
Pasted from <http://www.mitbbs.com/article/JobHunting/31494489_3.html
>
發信人: skydoor (海闊天空), 信區: JobHunting
標 題: amazon的那道題目
發信站: BBS 未名空間站 (Sat Jan 16 21:41:59 2010, 美東)
看了網上的討論, 關於amazon那道wood steel table chair furniture的題目
本身寫了一個, 牛人幫我看看我是否寫的有問題......
在我機器上編譯經過, 運行成功.
#include <iostream>
using namespace std;
class stuff {
public:
stuff() {}
virtual ~stuff() {}
virtual void info() = 0 ;
};
class table : public stuff {
public:
table() {}
~table() {}
void info() { cout<<"Table "<<endl;}
};
class chair : public stuff {
public:
chair(){}
~chair(){}
void info() {cout<<"Chair"<<endl;}
};
class wood: public stuff {
public:
wood(stuff * s): stf(s) { }
void info() {cout<<"Wood "; stf->info();}
private:
stuff* stf;
} ;
class steel : public stuff {
public:
steel(stuff *s) : stf(s) {}
void info() {cout<<"Steel "; stf->info();}
private:
stuff* stf;
};
int main() {
stuff * wood_chair = new wood(new chair);
stuff * wood_table = new wood(new table);
stuff * steel_chair = new steel(new chair);
stuff * steel_table = new steel(new table);
stuff * wood_steel_chair = new wood(new steel(new chair));
wood_chair->info();
wood_table->info();
steel_chair->info();
steel_table->info();
wood_steel_chair->info();
delete wood_chair;
delete wood_table;
delete steel_chair;
delete steel_stable;
delete wood_steel_chair;
}
output:
Wood Chair
Wood Table
Steel Chair
Steel Table
Wood Steel Chair
若是須要plastic, 只須要再從stuff inherit一個plastic類就好了
==========================另外一種方案===================================
#include <iostream>
using namespace std;
class material {
public:
material() {}
virtual ~material() {}
virtual void info() = 0 ;
};
class wood : public material{
public:
void info() {cout<<"Wood ";}
};
class steel: public material {
public:
void info() {cout<<"Steel ";}
};
class furniture {
public:
furniture() {};
void setMaterial(material *m) { this->m = m;}
virtual ~furniture() {};
virtual void info() = 0 ;
protected:
material * m;
};
class table : public furniture {
public:
table() {};
void info() { m->info(); cout<<" Table"<<endl;}
};
class chair : public furniture {
public:
chair() {};
void info() { m->info(); cout<<" Chair"<<endl;}
};
int main() {
table *wood_table = new table();
wood_table->setMaterial(new wood());
chair *steel_chair = new chair();
steel_chair->setMaterial(new steel());
wood_table->info();
steel_chair->info();
delete wood_table;
delete steel_chair;
}
output is
Wood Table
Steel Chair
Pasted from <http://www.mitbbs.com/article/JobHunting/31494857_3.html
>
uppose that you have a set of nodes with no null pointers (each node points
to itself or to some other node in the set), given a pointer to a node, how
to find the number of different nodes that it ultimately researches by
following links from that node, without modifying any nodes. DO NOT use more
than a constant amount of extra memory spa
Pasted from <http://www.mitbbs.com/article/JobHunting/31495985_3.html
>
1. 給定一個首尾相連的排過序的單鏈表,首節點最大尾節點最小,給出鏈表中任意一個
節點,要求返回鏈表中間節點;
2. 一摞未排序的撲克中間有重複,用最有效的方法找出並刪除重複者
Pasted from <http://www.mitbbs.com/article/JobHunting/31496467_3.html
>
昨天去某公司面試 Software Engineer碰到的最後一道題:
有一種新語言,只能作三種操做。
X=0; 給變量賦值爲0;
X++; 遞增
LOOP(x){。。} 給定一個變量值就循環X次,循環block能夠嵌套定義的三種操做。
題目是給定B,求A=B-1。
想了好久仍是沒有想出來。。你們能夠幫忙看看有什麼思路嗎?
Pasted from <http://www.mitbbs.com/article/JobHunting/31496897_3.html
>
發信人: PseudoP (Opium), 信區: JobHunting
標 題: Bloomberg 面經
發信站: BBS 未名空間站 (Wed Jan 20 16:13:13 2010, 美東)
剛收到拒信。financial software developer
面試總的感受仍是不錯。interviewers都還專業,nice。仍是很感謝有這個面試機會。
雖然沒中,應該是我我的的問題。
background: physics phd
====================================================
1. online skill assessment, Dec 2009
Some like GRE questions.
2. phone interview with 2 people in R&D, Dec 2009
1) how to find 1 missing number from 0 to N in an array of N numbers.
2) brainteaser, 5 jar problems.
3) how to calculate sqrt(N) without using sqrt function. Binary search tree
problem.
4) some behavioral problem. Like, How do you know about BB? Why you wanna
work in BB? Why you wanna work in industry?
3. onsite interview, Jan 2010
1st meet 2 people in R&D
1) train, tunnel, people escaping problem
2) 6 digits number, each changes from 0 to 9. Find the odds that sum of
first
three is the same as the sum of last three. A: 2 do loop.
3) Find 1 missing number from 0 to N. But notice that it is possible the sum
would overflow. Think about a way to avoid the overflow.
4) Tricky problem. I do not think anyone else would know the answer except
the one who gives the problem. Nothing to do with math, statistics.
5) Same 5 jars problem. That is their favorite.
2nd meet a lady in HR.
Ask 15-20 Behavioral problems. Cover most commonly behavioral problems.
3rd meet a senior manager in R&D
Talk a lot about my research.
Ask one question, how to find the first unique number in an array of byte.
and write a code to realize it.
====================================================
但願對後來的有幫助,祝你們好運。
--
※ 修改:•PseudoP 於 Jan 20 16:17:57 2010 修改本文•[FROM: 128.174
.]
※ 來源:•WWW 未名空間站 海外: mitbbs.com 中國: mitbbs.cn•[FROM:
128.174.]
Pasted from <http://www.mitbbs.com/article/JobHunting/31497519_3.html
>
發信人: bigdog (大狗1號), 信區: JobHunting
標 題: 一道C面試題
發信站: BBS 未名空間站 (Sat Jan 23 00:54:52 2010, 美東)
Suppose there is a C function to count and return thhe number of nodes in a
linked list.
What cases would you cover in unit tests of this function?
I can only think of two testing cases
(1): An empty list.
(2): An extrem long list with the length of the maximum value of unsigned
int.
Any other testing cases?
--
我雖然至今未婚,但平常工做之餘一直堅持研究學習關於婚姻、男女、兩性的各類心理
知識
※ 來源:•BBS 未名空間站 海外: mitbbs.com 中國: mitbbs.cn•[FROM:
202.156.]
Pasted from <http://www.mitbbs.com/article/JobHunting/31499799_3.html
>
發信人: timeforce (timeforce), 信區: JobHunting
標 題: bloomberg第一輪面試
發信站: BBS 未名空間站 (Sat Jan 23 13:28:22 2010, 美東)
早上剛面完,我是ee的,因此主要面了些算法和智力題。
1.behavior question, Why you want to join BB?
2.一個windows系統,一個unix系統,unix系統裏有100個數據庫,總共1TB,如何在1小
時內從unix系統轉移到windows系統中
3.找出一個字符串中最先出現的非重複字母
4.兩個雞蛋測試那層樓丟下來會碎
5.問了些作過的project的具體內容
另,我想再聯繫下個人面試官,我知道名字,怎麼找到他的郵箱地址?謝謝。
--
※ 來源:•WWW 未名空間站 海外: mitbbs.com 中國: mitbbs.cn•[FROM:
68.36.]
Pasted from <http://www.mitbbs.com/article/JobHunting/31499929_3.html
>
0 0
[上篇] [下篇] [同主題上篇] [同主題下篇]
發信人: jetchen (飛機), 信區: JobHunting
標 題: 問一個鏈表方面的算法問題 (轉載)
發信站: BBS 未名空間站 (Sun Jan 24 00:09:57 2010, 美東)
【 如下文字轉載自 CS 討論區 】
發信人: jetchen (飛機), 信區: CS
標 題: 問一個鏈表方面的算法問題
發信站: BBS 未名空間站 (Sun Jan 24 00:08:52 2010, 美東)
小弟EE的,不是cs科班出生,不知道這個問題描述的準不許確:
有一個循環鏈表 a->d->b->c->e->....->a
每個節點都是一個整數,且不重複(除了首尾節點外)。
如今這個鏈表被拆斷開了,每2個相鄰節點被存在一個cell裏面, 但這些cell不是有序
的。 就是說鏈表被拆成了 a->d, c->e,...,d->b,...,b->c,....
我想從新把鏈表創建起來,應該用什麼樣的算法?
謝謝.
--
Pasted from <http://www.mitbbs.com/article/JobHunting/31500287_3.html
>
合併兩個BST要求O(n+m)時間,n和m爲兩棵樹的大小。有什麼好的解法麼?
Pasted from <http://www.mitbbs.com/article/JobHunting/31500627_3.html
>
面試了一個小時左右。
1. 用兩個stacks來實現一個queue,題不是很難,可是要求逐行念代碼,精確到冒號分
號,尖括號怎麼說
不知道。。。耗了很久。
2. 一些關於multi-threading,critical section,等等。
3. SQL的一些問題,我不怎麼會,就skip了。
4. OOD問題,如何設計parking garage,你們有什麼好的想法嗎?
攢人品中……
Pasted from <http://www.mitbbs.com/article/JobHunting/31501235_3.html
>
給你一個字典array of strings (you may preprocess it if necessary)
任意一個單詞,求最小的edit distance
一個單位的distance定義爲:
a. replace a letter
b. delete a letter
c. insert a letter (also at any position)
快速的code出來~ 你就能夠拿facebook面試了
Pasted from <http://www.mitbbs.com/article/JobHunting/31501445_3.html
>
November 02
總結下最近幾天看到的一些頗有趣的題目
題目1. LIS. 一個任意的數組,找出一個嚴格單調遞增的最長子序列。
例如: {3,0,1,7,2,4,5,9} –> output: {0, 1, 2, 4, 5, 9}
很簡潔巧妙的算法,能在O(N log N)時間和O(N)空間作出來!方法就是始終保持一個單
增的序列,而後新來的數若是比當前最大還大就append在後面,不然在單增序列裏面作
binary search,替換相應位置的數。
題目2. 玻璃杯/雞蛋drop問題。有N層樓,假定是在 i 層樓扔雞蛋,若是沒有碎,那麼
在全部<=i 樓層扔雞蛋都保證不會碎,反之若是碎了,那麼保證在全部 >=i 樓層扔雞
蛋都必碎。經過若干次嘗試扔雞蛋,找到某個雞蛋碎/不碎的」臨界」層。容許你扔雞
蛋的總次數是D,容許你打碎的雞蛋數是B。
問題的描述是:對一組給定的數(N D B),若是存在一個策略保證能在D B的限制下,
在N層樓中找到「臨界」層,那麼稱此(N D B)是Solvable的。接下來相關聯的三個問題
就是:
(a)給定D,B,求知足(N,D,B)Solvable的最大的N_max. 例:D=4,B=1, 策略是
從第一層開始一層層往上. N_max=D=4.
(b)給定F,B,求最小的D_min
(c)給定F,D,求最小的B_min
這個問題至關容易找到看似最優的解,可是絕大部分的方法都不是最優的(最快最高效)
。並且最迷惑人的是,(a)(b)(c)三個問題中,必須先從其中某一個下手開始解決,如
果你不幸的先從另外的兩個問題下手,多半離最優解遙遙無望。
若是你找到了正確的入手點,有了正確的思路,最後的答案會異常的簡單!
入手點就是首先解決(a)問題,而且能夠遞歸的來解決:假設D,B對應的答案是F(D,B),
那麼考慮在某一層摔一個雞蛋後,若是碎了,D--,B--,若是沒碎就只是D--,B不變。
這樣很容易寫出遞歸方程,算出F關於D,B的table。
題目3. 經典的機率悖論。3扇門,一扇背後有羊,你選中一扇門後,如今另一扇門開
了,裏面是空的。問你是否應該從新選擇。
分析:據觀察,有一部分的人堅持認爲必定要從新選擇,另外一部分的人認爲是否從新選
擇都同樣。另外少部分的人能看出,這個問題很巧妙的隱含了意識(主觀intention),
信息和機率的關係!
題目4. 很簡單的,N個數的數組,找出最大的和第二大的數,只用N+logN-2的比較次數
,不須要額外空間。這個是典型的問題自己就是答案提示的題目--基於比較又有LogN,
很顯然思路涉及二分法,繼續下去,剩下的問題就僅僅是找一個符合要求的
Implementation了。
題目5. 找N!最後一個非零的數字。巧妙的方法能夠在 LogN 時間內找出來,一個hint
是利用 5^k(和log_5)劃分問題
題目6. 任務分配,假設有N個任務,每一個任務須要W_i工做量,M我的,每人天天能作工
做量w_i,如何安排工做,使得全部工做能最快完成。這個問題其實更像一個開放性問
題,由於一個合理的貪心策略,最後的結果跟最優結是很接近的(大體上,最多隻差一
天)。
題目7. 計算Fibonacci 數 F(n),O(n)的算法是很trival的。可是有很漂亮簡潔的Log(
N)算法,思路是利用2*2矩陣表示Fibonacci遞推式,而後用二分法的思想球矩陣的N次
方。
題目8. 一顆BinaryTree,每一個節點有個NULL指針,要求把每一個節點和在BFS中它的下一
個節點串起來。其餘BinaryTree的常見題有好比非遞歸的實現遍歷,用.parent or
stack。思考這些題的經驗是,對於這一類的樹的題目,有很強的遞歸性/規律性,一般
都是O(N)的複雜度,那麼把N steps的問題,放在某個單step來研究,會把思路變得更
清晰。另一點就是,徹底能夠假設在作這一單步以前,在作這一步以前的問題已經最
大可能的正確解決了,這樣可以以一種數學概括法的思想去利用以前的結論。好比這個
題裏面,假設節點 i 以前的節點都已經串好了,如何把 i 串到下一個節點。這個問題
就是看一眼草圖就能知道的了。最後一點經驗是,在效率至關的算法的基礎上,不一樣版
本的實現,已經有可以互相啓發的地方。
--
Pasted from <http://www.mitbbs.com/article/JobHunting/31502251_3.html
>
發信人: geniusxsy (小尾羊), 信區: JobHunting
標 題: 轉一些我blog上之前總結題目的日記(三)
發信站: BBS 未名空間站 (Tue Jan 26 15:10:35 2010, 美東)
November 06
一日3題
第一題。給一個數組a[1]到a[n] : 例如 1,2,3,4,5,6
如今隨機生成a的一個permutation: b[1]到b[n] (例如:3 1 5 2 4 6)
問, a和b數組在每一位上都不相同的機率是多少?假設a自己沒有重複的數
個人解法:
主問題:F(n) = 給定長度爲n的a數組,b數組有多少種取法
輔助問題:結果用f(n)表示。 b數組是{1….i-1,x,i+1…n}的一個排列,其中x!=i,滿
足a,b在每一位上都不相同,有多少種b?例如,a = 1,2,3,4; b是{1,2,5,4}的一個排
列。換句話說,組成b的元素中,有且只有一個數不在a中。
這樣定義了F(n),f(n)後,很顯然有遞推關係:
F(n) = (n-1) * f(n-1) //解釋:第一位有n-1種選擇,任意一種選擇後,問題變爲
一個 n-1規模的輔助問題
f(n) = F(n-1) + (n-1)*f(n-1) //狀況一,在b數組的第i位置填入x,考慮剩下的n-
1個位置,便是一個n-1規模的主問題;狀況二,i位置填入非x的數,考慮剩下的n-1個
位置,便是一個n-1規模的輔助問題。
簡化一下表達式就是:
F(n) = (n-1)(F(n-1)+F(n-2))
第二題,一個binary tree,逆序打印BFS序列。不能同時用兩段存儲空間(不一樣時用
queue和stack)
解法,用一個vector(array)模擬queue+stack。queue的push操做即vector的push_
back,等效於 q.pop()+stack.push()的操做則是,vector的index往前走一步!最後把
vector從尾到頭打印一遍便可。
第三題,網上看的答案,超級巧妙,生成一個0-255 二進制數有多少位是1的查詢表
static int BitSetCount256[256] =
{
#define B2(n) n, n+1, n+1, n+2,
#define B4(n) B2(n), B2(n+1), B2(n+1), B2(n+2),
#define B6(n) B4(n), B4(n+1), B4(n+1), B4(n+2),
B6(0), B6(1), B6(1), B6(2)
}
不得不說,這個宏遞歸的方法用的太妙了!!!
附帶贊一個巧妙度略低一些的計算二進制數有多少位1的方法
int bitSetCount(unsigned int i){
int c=0;
while(i){
c++;
i &= (i-1); //這一步很贊,每次保證清除最低一位1;
}
return c;
}
--
※ 來源:•WWW 未名空間站 海外: mitbbs.com 中國: mitbbs.cn•[FROM:
169.234.]
Pasted from <http://www.mitbbs.com/article/JobHunting/31502237_3.html
>
November 07
學習了backtrack(回溯法)
以前作了一些回溯的題,好比打印permutation,打印任意n對括號等等,都是瞎蒙的。
還真湊巧,上午作了打印n括號的題,下午就看見有人說到回溯法,想一想本身還沒系統
學過這個,找了本基礎的中文算法書來看了看,雖然書上講的很淺顯,發現本身貌似瞎
蒙還蒙對了思路,呵呵。正好湊巧的是,剛剛看了一點點,網上就有我的問怎麼作
Vertex Cover的問題,正好讓我來作作練習。
1. 打印任意合法的n對括號:
void printParenthes(int N, int left, int right, stack<char> &stk){
if(left == N && right == N){
printStack(stk);
return;
}
if(left>right){
stk.push(')');
printParenthes(N, left,right+1, stk);
stk.pop();
}
if(left < N){
stk.push('(');
printParenthes(N, left+1, right, stk);
stk.pop();
}
}
2. Vertex Cover(NPC問題),圖G中找一個頂點的最小子集,覆蓋圖的全部邊。
int current_k = N; //global
void VC(int k, int start_v){
if(all_edge_covered(G) && k<current_k){
current_k = k;
return;
}
if(k == current_k - 1) return; //剪枝
for(; start_v<=N; start_v++){
if(!edge_list[start_v].empty()){ //剪枝
list<int> temp_edge_list = edge_list[start_v];
clear_edge(start_v,G);
VC(k+1, start_v+1);
if(curent_k == k+1) return; //剪枝
reset_edge(start_v,temp_edge_list,G);
}//endif
}//endfor
}//endVC
想了想,其中的for循環實際上是沒必要的,對於解空間樹是子集樹的問題,只須要考慮《
當前頂點「選」「不選」》兩個狀況
改進後的算法是:
void VC2(int k, int start_v){
if(k<current_k && all_edge_covered(G)){
current_k = k;
return;
}
if(k >= current_k - 1) return; //剪枝
if(start_v == N) return; //沒有下一個頂點了
if(!edge_list[start_v].empty()){ //若是
list<int> temp_edge_list = edge_list[start_v];
clear_edge(start_v,G);
VC2(k+1, start_v+1);
if(curent_k == k+1) return; //剪枝
reset_edge(start_v,temp_edge_list,G);
}//endif
VC2(k, start_v+1); //不選start_v這個頂點
}//endVC
Pasted from <http://www.mitbbs.com/article/JobHunting/31502231_3.html
>
Dec 05
最近又看到了幾道很好的題:
1. 咱們知道,從一個數組裏找一段(連續的)子數組求最大和,是一道經典的面試題,
方法很簡單,只要O(n)的時間。把這個問題變一下,假設是一個循環數組呢?找一個
size<=n的子數組with最大和。
分析,很容易想到第一步,找個地方把循環數組切斷,回到了原來的問題,而後在考慮
一下額外的狀況。額外的狀況就是:有可能最大和的子數組是跨越了切斷點的?這種情
況的最大和怎麼求呢?一個naive的方法能作到O(n),可是須要O(n)的空間。巧妙的解
法就是,注意到全部數的和是固定的,考慮切斷後的非循環數組,找一段從首開始+一
段從尾開始的兩個子數組with最大和,等價於找一段子數組with min sum.
總結,要擅長利用等價性轉換問題,從而將新的問題轉變爲一個已知有好solution的舊
問題。利用已知的經典問題來解決新問題,能夠說是面試題目中至關重要的一個技巧
2. largest rectangular problem:問題是這樣的,一個N×M的棋盤,上面的數字要麼
是1,要麼是0,那麼要:a)最大的一個正方形全是1填充,b)最大的全是1的矩形。
a)是用動態規劃作,雖然方法也很好,可是這裏就不提了。b)問題感受上要比a難很
多,爲何呢,由於rectangular比square有更大的自由度。很差用DP來作,分冶也不
合適。
這題的奧妙就在於,利用經典問題。什麼經典問題呢?實際上是另一道面試題,其自己
也是有必定難度的題,題目是:給你一個統計直方圖,假設每根柱子都是單位寬度,從
圖的最左邊一個緊挨一個排到圖的最右邊,求在這個圖裏找到一個最大矩形,它不跟任
何直方柱相交(邊緣接觸是容許的)。爲何提起這個題呢,故事是這樣的,我以前沒有
作出O(N*M)解法的largest rect題,後來有一天遇到了這個直方圖的題目,找到了很漂
亮的O(N)解法,猛然回顧起那道largest rect的題,此次就很輕鬆的搞定了。
3(鳴謝mittbbs jobhunting版上的一位面試官貢獻本身出的題)有n個房間,小偷天天
偷一間,偷的規律簡單說就是隨機行走,若是今天偷了第i間屋子,明天有一半的概率
偷i-1,一半的概率偷i+1,注意若是恰好偷到了邊界上,那麼次日只有惟一的選擇。
若是你是警察,你只能天天選擇一個房間蹲守,而且賊的手段至關高明,偷了一個房間
後,沒有任何人能發覺該房間是否曾經被偷過。
提示:奇偶性。總結:注意觀察題目中隱含的性質。
4. wild card匹配+搜索:假設你有一個dictionary(原題中是URL集合),你要搜到到所
有與 *a*bc*d 這樣的輸入所匹配的words。這裏,*是通配符,能夠當成是任意個任意
字符(包括空),怎麼 預處理+搜索?若是輸入是 ???a???b??cde 這類呢? ‘?’表明
單個任意字符。若是輸入是? *的混合呢?
Pasted from <http://www.mitbbs.com/article/JobHunting/31502229_3.html
>
有m個nuts, n個bolts,規格大小都不相同
只能nut和bolt之間比較
怎麼把他們排序?要求複雜度最小
Pasted from <http://www.mitbbs.com/article_t/JobHunting/31502045.html
>
竟然把時間看錯了,原來人家說的是東部時間的2pm。。。搞得來11點打來電話的時候
我還緊張了一陣。。。口語說的很爛,腦子也不太靈光。。。
題目其實都不難,behavior問了你最喜歡的CS的東西是什麼,我就說算法,而後他還居
然提了下我簡歷上量子計算,估計他不會怎麼感興趣,我就只簡單提了一點。而後
coding題都是很基本的,一個串in place刪除某些字符,code完了後,反過來,一個串
在某些地方插入字符,期間我腦子短路了一陣子,還好過了一些時間後接上來了。。。
而後是個超級老題,數組裏面找惟一一個出現了奇數次的整數,我此次很誠實,直接說
我知道這類trick的。。。不過他仍是讓我接着說了一下笨辦法怎麼作。接下來又是一
個老題,樓層扔雞蛋問題,這個我前面的日記裏面都貼過的,因此除了表述上可能有些
不清楚外,算法自己確定是optimal的了。接下來問了面試官幾個 cliche的問題就結束
了,至少表面上面試官仍是比較滿意的。。。
整個面了下來竟然沒有問design的題目,也不知道是幸運仍是不幸(一次都還沒被問過
,缺乏實戰經驗)。。。
最大的總結:
看清楚面試時間 + 多練口語表達思路 + 看清楚面試時間。。。
Pasted from <http://www.mitbbs.com/article/JobHunting/31502227_3.html
>
面的通常,關鍵感受那面試官比較冷,問他也不說對錯,讓人挺鬱悶。
1. 如何尋找二叉樹(not binary search tree)的least common ancestor.
2. 如何測試一個計算器。
3. 若是你想打電話面試一我的,拿到那我的的簡歷,卻發現他沒有提供電話號碼,你
能想到幾種方法找到他的電話號碼。
最後一個問題仍是挺好的,不知道你們能想到幾種方法。 第一個問題我知道如何作,
就是找到從root到兩個節點的path, 而後比較path就能夠了。但他問的很細,可能我講
的不是很清楚. 我如今想像這樣具體到代碼的問題,咋們能不能說在電腦上寫好了發到
他郵箱,而後再解釋啊? 否則像這個問題,一行一行解釋真地挺難的。
Pasted from <http://www.mitbbs.com/article/JobHunting/31502699_3.html
>
very easy, but I think I have to say goodbye
1. deadlock's four condition
2. what's virtual memory
3. how to increase the virtual memory
4. when should we maintain v2p page table, when should we maintain p2v page
table.
5. what's mmap & lazyloading. when should we use mmap to allocate memory
6. multi-level page table
7. implement a stack with lock to ensure thread safe
Pasted from <http://www.mitbbs.com/article/JobHunting/31356292_3.html
>
大部分的題都是板上貼過的,再貼貼吧:)
1. C++和C#的最大區別?
2. 問到了C++和Java在Runtime Environment(沒太聽清,多是這個詞)的區別。後
來我問問了,好像是在virtual function上的區別。我答得是Java裏全部函數都是
virtual函數,C++要顯示標明。
3. TCP和UDP的區別
前面3個應該是根據我簡從來問的,其實我Java和C#也沒用太多:(
4. 給定一個int數組和一個int變量叫sum,返回是否有數組中的2個數的和等於sum。
這個問題我最開始沒處理好正好數組裏有一個數等於sum/2的狀況:(
5. n級臺階,一次能夠上1級或2級,有多少種上發
老題目了,fibonacci number
6. reverse the words in a sentence, but don't reverse the words.
Pasted from <http://www.mitbbs.com/article/JobHunting/31344095_3.html
>
. Given a random generator which can generate integer number from 1 to 5
with uniform probability. how to generate number from 1 to 7 with uniform
probability.
2. Find the shortest path to convert one string to another using the minimum
edits with each transformation string being a valid dictionary word in a
dictionary.
for example: for->fork->ford->word->sword
Pasted from <http://www.mitbbs.com/article/JobHunting/31429703_3.html
>
how do you dynamically allocate space for a two dimension array in consecuti
ve bytes?
should be easy
Pasted from <http://www.mitbbs.com/article/JobHunting/31432089_3.html
>
iven N points in a place with their (x,y) co-ordinates. Find two points
with least distance between them.
Pasted from <http://www.mitbbs.com/article/JobHunting/31437667_3.html
>
plz implement a non-recursive post order tree traversal.
I think this is difficult. It is kinda simple for pre-order and in-order, bu
t post-order is tough.
Pasted from <http://www.mitbbs.com/article/JobHunting/31455707_3.html
>
How do you measure context switch time in OS?
any ideas?
Pasted from <http://www.mitbbs.com/article/JobHunting/31465291_3.html
>
ou have a data structure of integers, which can be negative, zero, or
positive, and you need to support an API with two public methods, insert(int
) and getmedian(). Describe a data structure you would use to support this
API and describe the running time of the two methods.
Pasted from <http://www.mitbbs.com/article/JobHunting/31472621_3.html
>
How to sort an array with only {0, 1, 2} possible values in O(n) without
extra space?
Ex: an array {0, 1, 2, 2, 1, 0}
Pasted from <http://www.mitbbs.com/article/JobHunting/31472623_3.html
>
given a string, how to do a string rotation without using extra memory?
Pasted from <http://www.mitbbs.com/article/JobHunting/31473311_3.html
>
Given a list of characters and an int which is the distance between the
same characters
Eg: input- aaaaabbbbcc and distance as 2. One of the outputs can be-
aabaababbcc
Come up with an algorithm and Code it.
好吧,我認可,給個人人說他也不記得了,當時就是挺confused的。
來另外一個吧:
Q2) Find out if two inputs are Anagrams with HUGE HUGE input (like thousand
of terabyte)
Q3) Given lots and lots of points in a 2D space find all the line with most
points on it.
Pasted from <http://www.mitbbs.com/article/JobHunting/31480153_3.html
>
dictionary is given. You have a word which may be misspelled. How will you
check if it is misspelled?
Pasted from <http://www.mitbbs.com/article/JobHunting/31485125_3.html
>
發信人: sumperman (超哥), 信區: JobHunting
標 題: Google interview question
發信站: BBS 未名空間站 (Tue Jan 5 14:59:47 2010, 美東)
Design a system to store heap on multiple machines ? What is avg number of
machines accessed per operation and number of elements stored in a machine ?
First greater number in an array. Given a large array of positive integers,
for an arbitrary integer A, we want to know the first integer in the array
which is greater than or equal A . O(logn) solution required
ex [2, 10,5,6,80]
input : 6 output : 10
input :20 output : 80
Given an N-by-N array of black (1) and white (0) pixels, find the largest
contiguous sub-array that consists of entirely black pixels. In the example
below there is a 6-by-2 sub-array.
1 0 1 1 1 0 0 0
0 0 0 1 0 1 0 0
0 0 1 1 1 0 0 0
0 0 1 1 1 0 1 0
0 0 1 1 1 1 1 1
0 1 0 1 1 1 1 0
0 1 0 1 1 1 1 0
0 0 0 1 1 1 1 0
Any ideas?
--
※ 來源:•WWW 未名空間站 海外: mitbbs.com 中國: mitbbs.cn•[FROM:
173.26.]
Pasted from <http://www.mitbbs.com/article/JobHunting/31487235_3.html
>
Given a log file, which contains a series of websites, which the user has
visited, find the most frequent path of 3 websites.
e.g: If this is a log file
A B C D E
A C D B E
C D E B A
A C D E B
C D E A B
clearly, C D E in the most frequent website?
Pasted from <http://www.mitbbs.com/article/JobHunting/31493409_3.html
>
. find a pair that add up to a given sum
2. find all phone numbers in the html
pages in a folder (and subfolder).
something else, and self-introduction stuff
Pasted from <http://www.mitbbs.com/article/JobHunting/31493961_3.html
>
2010.1.23 9:00am-11:00am. NYC headquarter
流程:公司介紹+參觀公司+面試
我是CS的。問的都是C++編程。一對一。半小時。C++好久以前學過的,惡補了一晚。我
跟他說本身
仍是beginner,因此問題不是很難,可是仍是不會。。。
1.爲何加入bloomberg?
2.introduce your experience。
3.比較c++和java的區別。內存管理,garbage class....compiler,編譯的做用?(
gcc)(不懂java。java貌似編譯了之後各個平臺上均可以運行嗎?virtual machine?C
++編譯
了之後的彙編語言只能在特定的系統上運行?)
4.C++中什麼function call delete a object? destructor
5.談到了shallow copy deep copy.
6.int main()
{
return main();
}
will this compile? will this run?
7. 利用一個寫好的函數putchar(char A)which prints out the character you
entered. 寫一個putlong (long A).只能調用putchar,不能調用其餘任何函數(能夠用
STL,可是不能用STL中的函數)。後來還問到了如何test你的程序。這一道題折磨了我
15分鐘。
答案在這裏:
http://wuhrr.wordpress.com/2007/11/09/how-to-print-a-long-integ
only-putchar/
全部問題不告訴你回答正確與否。他沒有固定的幾道題要問,你談到了什麼就往深裏面
問。今天有50多人面試,各個背景的都有。CS/EE的我感受就問編程,非CS/EE的問智力
題。再有就
是通知巨忽然,週四晚上收到郵件,讓週六早上面試。。。
體會:是否是編程牛人,一寫程序就知道。。。。此次又去當炮灰了。javascript