华为集团面试经验100个总结Word文档格式.docx
- 文档编号:17056670
- 上传时间:2022-11-28
- 格式:DOCX
- 页数:6
- 大小:21.46KB
华为集团面试经验100个总结Word文档格式.docx
《华为集团面试经验100个总结Word文档格式.docx》由会员分享,可在线阅读,更多相关《华为集团面试经验100个总结Word文档格式.docx(6页珍藏版)》请在冰豆网上搜索。
(mergesort)
∙Howwouldyoure-positionGoogle’sofferingstocounteractcompetitivethreatsfromMicrosoft?
∙Howmanygolfballscanfitinaschoolbus?
∙这种题一般来说是考你的解题思路的,注意,你不能单纯地把高尔夫球当成一个小立方体,其是一个圆球,堆起来的时候应该是错开的——也就是三个相邻的球的圆心是个等边三角形)
∙Youareshrunktotheheightofanickelandyourmassisproportionallyreducedsoastomaintainyouroriginaldensity.Youarethenthrownintoanemptyglassblender.Thebladeswillstartmovingin60seconds.Whatdoyoudo?
∙HowmuchshouldyouchargetowashallthewindowsinSeattle?
∙Howwouldyoufindoutifamachine’sstackgrowsupordowninmemory?
∙Explainadatabaseinthreesentencestoyoureight-year-oldnephew.
∙(用三句话向8岁的侄子解释什么是数据库,考你的表达能力了)
∙Howmanytimesadaydoesaclock’shandsoverlap?
(经典的时钟问题)
∙YouhavetogetfrompointAtopointB.Youdon’tknowifyoucangetthere.Whatwouldyoudo?
∙Inacountryinwhichpeopleonlywantboys,everyfamilycontinuestohavechildrenuntiltheyhaveaboy.Iftheyhaveagirl,theyhaveanotherchild.Iftheyhaveaboy,theystop.Whatistheproportionofboystogirlsinthecountry?
(第一反应是——这个国家是中国。
一个概率问题,其实,无论你怎么生,50%的概率是永远不变的。
)
∙Iftheprobabilityofobservingacarin30minutesonahighwayis0.95,whatistheprobabilityofobservingacarin10minutes(assumingconstantdefaultprobability)?
∙Ifyoulookataclockandthetimeis3:
15,whatistheanglebetweenthehourandtheminutehands?
(Theanswertothisisnotzero!
∙Youareatapartywithafriendand10peoplearepresentincludingyouandthefriend.yourfriendmakesyouawagerthatforeverypersonyoufindthathasthesamebirthdayasyou,youget$1;
foreverypersonhefindsthatdoesnothavethesamebirthdayasyou,hegets$2.wouldyouacceptthewager?
∙Howmanypianotunersarethereintheentireworld?
∙Youhavefivepirates,rankedfrom5to1indescendingorder.Thetoppiratehastherighttoproposehow100goldcoinsshouldbedividedamongthem.Buttheothersgettovoteonhisplan,andiffewerthanhalfagreewithhim,hegetskilled.Howshouldheallocatethegoldinordertomaximizehissharebutlivetoenjoyit?
(Hint:
Onepirateendsupwith98percentofthegold.)
∙Youaregiven2eggs.Youhaveaccesstoa100-storybuilding.Eggscanbeveryhardorveryfragilemeansitmaybreakifdroppedfromthefirstfloorormaynotevenbreakifdroppedfrom100thfloor.Botheggsareidentical.Youneedtofigureoutthehighestfloorofa100-storybuildinganeggcanbedroppedwithoutbreaking.Thequestionishowmanydropsyouneedtomake.Youareallowedtobreak2eggsintheprocess.
∙(从3的倍数的楼层开始扔,比如3,6,9,12…..,如果鸡蛋在3n层碎了,那到在3n-1层扔第二个鸡蛋,如果没碎,则最高不碎楼层为3n-1,否则为3n-2)
∙Describeatechnicalproblemyouhadandhowyousolvedit.
∙Howwouldyoudesignasimplesearchengine?
∙DesignanevacuationplanforSanFrancisco.
∙Howmanyvacuum’saremadeperyearinUSA?
∙Whyaremanholecoversround?
∙(为什么下水井盖是圆的?
这是有N种答案的,上Wiki看看吧)
∙Whatisthedifferencebetweenamutexandasemaphore?
Whichonewouldyouusetoprotectaccesstoanincrementoperation?
∙Amanpushedhiscartoahotelandlosthisfortune.Whathappened?
∙(脑筋急转弯?
他在玩大富翁游戏?
!
∙Explainthesignificanceof“deadbeef”.要是你看到的是16进制DEADBEEF,你会觉得这是什么?
IPv6的地址?
∙WriteaCprogramwhichmeasuresthethespeedofacontextswitchonaUNIX/Linuxsystem.
∙Givenafunctionwhichproducesarandomintegerintherange1to5,writeafunctionwhichproducesarandomintegerintherange1to7.
∙Describethealgorithmforadepth-firstgraphtraversal.
∙Designaclasslibraryforwritingcardgames.
∙(用一系列的类来设计一个扑克游戏,设计题)
∙Youneedtocheckthatyourfriend,Bob,hasyourcorrectphonenumber,butyoucannotaskhimdirectly.YoumustwriteathequestiononacardwhichandgiveittoEvewhowilltakethecardtoBobandreturntheanswertoyou.Whatmustyouwriteonthecard,besidesthequestion,toensureBobcanencodethemessagesothatEvecannotreadyourphonenumber?
(协议+数字加密,我试想了一个,纸条上可以这样写,“Bob,请把我的手机号以MD5算法加密后的字符串,比对下面的字符串——XXXXXX,它们是一样的吗?
”)
∙HowarecookiespassedintheHTTPprotocol?
∙DesigntheSQLdatabasetablesforacarrentaldatabase.
∙Writearegularexpressionwhichmatchesaemailaddress.(上StackOverflow查相当的问题。
∙Writeafunctionf(a,b)whichtakestwocharacterstringargumentsandreturnsastringcontainingonlythecharactersfoundinbothstringsintheorderofa.WriteaversionwhichisorderN-squaredandonewhichisorderN.(算法题,不难,不说了。
一个O(n^2)和一个O(n)的算法复杂度)
∙Youaregivenathesourcetoaapplicationwhichiscrashingwhenrun.Afterrunningit10timesinadebugger,youfinditnevercrashesinthesameplace.Theapplicationissinglethreaded,andusesonlytheCstandardlibrary.Whatprogrammingerrorscouldbecausingthiscrash?
Howwouldyoutesteachone?
(和随机数有关系?
或是时间?
∙ExplainhowcongestioncontrolworksintheTCPprotocol.
∙InJava,whatisthedifferencebetweenfinal,finally,andfinalize?
∙Whatismultithreadedprogramming?
Whatisadeadlock?
∙Writeafunction(withhelperfunctionsifneeded)calledtoExcelthattakesanexcelcolumnvalue(A,B,C,D…AA,AB,AC,…AAA..)andreturnsacorrespondingintegervalue(A=1,B=2,…AA=26..).
∙Youhaveastreamofinfinitequeries(ie:
realtimeGooglesearchqueriesthatpeopleareentering).Describehowyouwouldgoaboutfindingagoodestimateof1000samplesfromthisneverendingsetofdataandthenwritecodeforit.
∙Treesearchalgorithms.WriteBFSandDFScode,explainruntimeandspacerequirements.ModifythecodetohandletreeswithweightededgesandloopswithBFSandDFS,makethecodeprintoutpathtogoalstate.
∙Youaregivenalistofnumbers.Whenyoureachtheendofthelistyouwillcomebacktothebeginningofthelist(acircularlist).Writethemostefficientalgorithmtofindtheminimum#inthislist.Findanygiven#inthelist.Thenumbersinthelistarealwaysincreasingbutyoudon’tknowwherethecircularlistbegins,ie:
38,40,55,89,6,13,20,23,36.(陈皓:
循环排序数组的二分查找问题)
∙Describethedatastructurethatisusedtomanagememory.(stack)
∙What’sthedifferencebetweenlocalandglobalvariables?
∙Ifyouhave1millionintegers,howwouldyousortthemefficiently?
(modifyaspecificsortingalgorithmtosolvethis)
∙InJava,whatisthedifferencebetweenstatic,final,andconst.(ifyoudon’tknowJavatheywillasksomethingsimilarforCorC++).
∙Talkaboutyourclassprojectsorworkprojects(picksomethingeasy)…thendescribehowyoucouldmakethemmoreefficient(intermsofalgorithms).
∙SupposeyouhaveanNxNmatrixofpositiveandnegativeintegers.Writesomecodethatfindsthesub-matrixwiththemaximumsumofitselements.(以前见过一维数组的这个问题,现在是二维的。
感觉应该是把二维的第一行的最大和的区间算出来,然后再在这个基础之上进行二维的分析。
思路应该是这个,不过具体的算法还需要想一想)
∙Writesomecodetoreverseastring.
∙Implementdivision(withoutusingthedivideoperator,obviously).(陈皓:
想一想手算除法的过程。
∙Writesomecodetofindallpermutationsofthelettersinaparticularstring.
∙Whatmethodwouldyouusetolookupawordinadictionary?
(陈皓:
使用排序,哈希,树等算法和数据结构)
∙Imagineyouhaveaclosetfullofshirts.It’sveryhardtofindashirt.Sowhatcanyoudotoorganizeyourshirtsforeasyretrieval?
∙Youhaveeightballsallofthesamesize.7ofthemweighthesame,andoneofthemweighsslightlymore.Howcanyoufinetheballthatisheavierbyusingabalanceandonlytwoweighings?
∙WhatistheC-languagecommandforopeningaconnectionwithaforeignhostovertheinternet?
∙Designanddescribeasystem/applicationthatwillmostefficientlyproduceareportofthetop1millionGooglesearchrequests.Thesearetheparticulars:
1)Youaregiven12serverstoworkwith.Theyarealldual-processormachineswith4GbofRAM,4x400GBharddrivesandnetworkedtogether.(Basically,nothingmorethanhigh-endPC’s)2)Thelogdatahasalreadybeencleanedforyou.Itconsistsof100Billionloglines,brokendowninto12320GBfilesof40-bytesearchtermsperline.3)Youcanuseonlycustomwrittenapplicationsoravailablefreeopen-sourcesoftware.
∙ThereisanarrayA[N]ofNnumbers.YouhavetocomposeanarrayOutput[N]suchthatOutput[i]willbeequaltomultiplicationofalltheelementsofA[N]exceptA[i].ForexampleOutput[0]willbemultiplicationofA[1]toA[N-1]andOutput[1]willbemultiplicationofA[0]andfromA[2]toA[N-1].SolveitwithoutdivisionoperatorandinO(n).(注意其不能使用除法。
算法思路是这样的,把output[i]=a[i]左边的乘积xa[i]右边的乘积,所以,我们可以分两个循环,第一次先把A[i]左边的乘积放在Output[i]中,第二次把A[i]右边的乘积算出来。
我们先看第一次的循环,使用迭代累积的方式,代码如下:
for(r=1;
i=0;
i<
n-1;
i++){Output[i]=r;
r*=a[i];
},看明白了吧。
第二次的循环我就不说了,方法一样的。
∙ThereisalinkedlistofnumbersoflengthN.Nisverylargeandyoudon’tknowN.Youhavetowriteafunctionthatwillreturnkrandomnumbersfromthelist.Numbersshouldbecompletelyrandom.Hint:
1.Userandomfunctionrand()(returnsanumberbetween0and1)andirand()(returneither0or1)2.ItshouldbedoneinO(n).(本题其实不难。
在遍历链表的同时一边生成随机数,一边记录最大的K个随机数和其链接地址。
∙FindordeterminenonexistenceofanumberinasortedlistofNnumberswherethenumbersrangeoverM,M>
>
NandNlargeenoughtospanmultipledisks.AlgorithmtobeatO(logn)b
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 华为 集团 面试 经验 100 总结