You are on page 1of 10

Note:

1. ThisDocumenthasbeencreatedforthemembersofRapidprogramminghuband
JIITProgrammingHubonly.Idontwantittogetpublishedonanyotherpublic
platform.

2. Ihavetriedtoexplainmythoughtprocessandmindsetduringtheinterviewsrather
thanexplainingthedetailedsolutionstotheproblems.

OnlineRound
2CodingProblems
20MCQs

Name:SumitBansal
Company:Amazon
Result:Selected

PI1(45min1hour)

TheInterviewerinitiallyaskedtotellhimsomethingaboutme.ThenIwasaskedaquestion.

Problem1
ConvertDoublyLLtoBalancedBinaryTree.

Iwasfeelingnervousintheinitial15minutes,wasunabletothink&focus.Iimmediatelytold
himthatiamfeelingnervousbecauseitsmyfirsteverinterview.Hepolitelyreplied,ican
completelyunderstandyourfeelings.Itscompletelyok.Youshouldcalmdownandstart
again.Ithelpedmegainlotsofconfidence.

InitiallyproposedaO(n)time&spacecomplexitysolutionusingunordered_map.
Codedit.
Intervieweraskedmetoreducethespacecomplexity.IimprovedittoO(2^h)wherehis
heightofthetree.Iwasaskedtocodethesolution.Icodeditmakingsureicoverallthe
cornercases.
IntervieweraskedmetousesomeotherDStosolvetheproblem.
Isuggestedanapproachusing2queues.
Intervieweraskedmetothinkofabettersolution.
Isuggestedasolutionusingsinglequeue.

Problem2
Createksizelinkedlisthavingsumofnodesati%kpositionsfromagivenlinkedlist.
eg.
Given1>2>3>4>5>6>7>8>NULLandK=5
Return7>9>11>4>5>NULL

Itwasasimpleproblembuthadlotsofcornercasestobecovered.Someonehasgiven
meaadvicethatweshouldgivespecialrespecttosimpleproblems.So,Iclearedall
mydoubtsandfinallycodedthesolution.Beforeshowinghimthesolution,itestedmycode
onsometestcases.Irealisedwehaventcoveredascenarioyet.
So,Iaskedhim.hesaidyesitsagoodobservation.

FinallyIntervieweraskedihaveanyquestionsforhim?
Iaskedaboutkindofworktheydoatamazon.
Somehowduringthediscussionweswitchedtomysql,mongoanddynamo.Healso
explainedmesomegoodtechniquesdynamoisusingforsynchronisationpurposes.

PI2(1hour+)

Interviewerintroducedhimselfandaskedaboutmyexperienceinpreviousround.

ExplainREST?
Explainedwhatevermyunderstandingisaboutrestfulapisindetail.

OSquestionsstarted.

Howprogramworks?

Process&threads?

SynchronousandAsynchronous?

BlockingandNonBlockingIO?

ThreadPool?

ConditionVariables?

Sockets?

Iwasaskedtoexplainthesetermsbecauseiusedthematsomepointinthediscussion.
Interviewersaidyouarenotabletocompletelyexplainmeeverything.Wewillcomebackto
itlater.

Tellmethebiggesttechnicalchallengeyouhavefaced?

Afterthinkingforsometime,discussedindetailaboutachallengeifacedwithAngularJS.

Tellmeifyoueverdisagreedwithyourstartupheadonsomescenario?

ItoldhimainstancerelatedtoAndroiddevelopmentwhereidisagreedwithapproachinitially
suggested.

Finally,Iwasaskedacodingproblem.

Givenasparsebinarytreewith3pointers.SiblingnamedpointerisinitiallypointingtoNULL.
Pointittothenodeontherightsideinthesamelevel.

Iagainclarifiedallmydoubtsandscenarioswiththeinterviewer.Ihavethishabitfrommy
competitiveprogrammingexperiencetounderstandalltheconstraintsinadvance.Before
thinkingorcodinganyapproach.

SuggestedhimaBFSbasedapproach.Afterrunning2testcasesonpaperweagreedon
theapproach.
Icodedthesolutioncoveringallthepossiblecornercases.

Finally,IaskedhimforthefeedbackregardingourOSdiscussion.

Tobehonest,Ifoundthisroundtobethemostdifficultoneoutofallthe4PIs.

PI3(1hour15min)

WhatisREST?yesiwasaskedthisquestionagain.Isimplyansweredwhatever
understandingihaveregardingrestfulapis.
InterviewersaidthatyousimplydontunderstandthemeaningofREST.:)

Iwasaskedtotellthefullformofpubsubimentionedinthepreviousinterviewwhile
discussingAngularJs?:)Lateraskedtoexplainit.
Discussed.

WhyFlask?
Discussedwhyweuseflask?Also,discussedourmicroservicesbasedarchitectureweuse
inourstartupanditsbenefits.Ilaterdiscussedaboutpubsubusingkafka.

WhyAngularJS?
Discussed.

Improvedperformanceinnetworkrequestsinandroid?Explain.
Discussedabouthttpclient,retrofit2andvolley.

ImprovedImagecachingmechanisminandroid?Explain.
DiscussedaboutPicassolibraryandotheralternatives.Assoonasimentionedtheword
asynchronous.

Interviewerstoppedmeandaskedmetoexplainit.Itoldhimsomething.Heaskedmetotry
andexplainitin20wordsonly.
Igaveatry4050words.
Again3040words.
Again2530words.
Again20words.:)

Howyouusedsocket.io,Node.js,&Expressinyourminorproject?Explain.
Discussed.

Interviewertoldmeabouthisworkinreverseengineeringofsocket.io.Hesuggestedmethat
ishouldlearnmoreaboutit.
Iwilldefinitelydoitassoonasigetsometime.:)

WhyRedis?
Discussed.

Finallywemovedtocodling.Heaskedmeaboutmy2favouriteDS.Itoldhimtreesand
graphs.Hesaidthatsthecatchiwontaskyouthesenow.:)

Hewrotedownaquestiononpaperandaskedmeifiknowtheproblem.

GivenaDictionaryofwordsinadifferentlanguage.Tellthealphabetsorder.?

Iagainstartedwithmyanalysingtheconstraintsbasedapproach.Clearedmydoubtson
somescenariosandwrotethemdownonpaper.Iaskedhimhowmanycharacters
languagecanhave?cantherebeacasewhenwewontgettheorder?andsomeother
thingstomakesureicoverupeverything.

Starteddrawinglines/edgesbetweenthecharactersinthelistofstrings.(Duringcompetitive
programmingcontestsikeepondoingsuchthingswheniamnotabletosolveaproblem.
So,thatexperiencehelped.:))
Finallyrealiseditsnothingbuttopologicalsortingofthosecharactersorvertices.
Isaidsiryoutoldmeitwontbeatreeoragraph.:)
Butsinceihadnotcodedatopologicalsortforquitesometime.
Irequestedfora5mindryrunonasimpledirectedgraphandaskedhimifiamdoingit
wrongorright.

Beforecodingitwehadagooddiscussiononapproachestorepresentthosecharactersina
graph.
FinallycodedaDFSbasedtopologicalsortsolution.

Intervieweraskedmetosolveonemoreproblembutquicklybecausewewererunningout
oftime.

Givenarrayofintegers.Replaceeveryelementwiththemaxelementonitsrightside?


Iagainanalysedalltheconstraintsandaskeddoubts.Hetoldmescenariowhenineedto
put1also.

IproposedaO(nlogn)heapbasedsolutionafter23minutes.Interviewerwassmilingand
saidthatforthefirsttimeheishearingaheapbasedapproach.:)
IquicklyrealisedmymistakeandproposedaO(n)solution.
Askedmetocode.
Codedit.

Ifeltreallyconfidentafterthisround.

Iwastoldihavemy4throundin5minutes.Yesbacktobackrounds.

PI4(1hour)

Interviewerintroducedhimself.Offeredmesomesnacksandwater.:)

Youarealreadyafullstackdeveloper?whydoyouwantthisjob?
:)
Iamworkingonthisstartupproducttillidontgetplaced.Afterthatthefoundersofthis
startupwillworkonitfulltime.

Heaskedmehowmuchgeeksforgeeksireferredbeforethisinterview?
IsaidthationlyreferredgeeksquizsectionforMCQpreparation.Allthecodingihave
learnedisbasedonmyexperienceincompetitiveprogrammingovertheyears.Duringthe
summeriwasbusywiththestartupwork.

Heaskedmewhatprogramminglanguagesiknow.IsaidiuseC++forcompetitive
programming,javaforandroidandpythonforbackenddevelopment.
Askedmetochoosetheoneiammostcomfortablewith.
IdecidedtochooseC++.

VirtualFunctions?
FunctionOverloading?
VirtualTable?

IwasnotexpectingOOPSbasedquestionstobehonest.
Soitcameasabigsurprise.

Butiexplainedvirtualfunctionsandpurevirtualfunctionsindetailbywritingsomecodeon
paper.

Endedupansweringfunctionoverloadingpartiallyincorrectbutveryconfidently.He
reconfirmedthrice.Iansweredpartiallyincorrectconfidentlythrice.Hewassmiling
throughoutthesituation.
Iwaslikehowcanigetthissosimplethingwrongin4thround?:)

Ithinkheunderstoodmysituationandsaidletsclosethishereonlyandmovetoyour
favouriteareaDS/ALGO.

AskedmemyfavouriteDS?
MyanswerwasTreeandGraph.IlikethealgorithmsassociatedwiththeseDS.

TellmesomeTreeVariantsyoulike?
TrieandSegmentTrees

Why?
Ilikesolvingtheproblemsassociatedwiththem.Eventhoughiamnotabletocodethe
problemsduringcompetitiveprogrammingcontests.Butireallyenjoythem.

Finallyaproblem.
Givenastringfindthelongestpalindromicsubstring?

Initiallysuggestedabruteforcesolutiontocheckallthesubstringsonebyoneandthen
checkthepalindrome.Suddenlyheshiftedallhisfocusoncheckingpalindromicstring.
Askedmehowtocheckpalindrome?
Ittoldaapproach.
Askedmecomplexity?
IsaidO(n).
Tellmemore?
ItoldanotherO(n)
More?
.
.
anotherapproachO(n).
Hesaiditsalmostsame.
More?
AnotherapproachO(n).

IsaidicantthinkbetterthanO(n)anymoresir?
Whotoldyoutominimise?
Givemesomethingdifferentmaybeabadcomplexitysolution?
:)
Ididntgiveupatthattimeandsuggestedsomething.O(256+n)typeapproachandextra
memory.

Intervieweraskedmeifcancodearecursiveversionofpalindromechecking?
Isaidyes.

Codedit.
Hesaidoptimiseit?
Done

Yeswediscussed56waystocheckpalindrome?:)Ithinktheyweretestinghowmuchi
canthink.

Finallycamebacktotheoriginalproblem.Askedmetoimprovethecomplexityofmyinitial
bruteforcesolution.

RealiseditsaDPproblem.Explained.

Askedmetosuggestsomethingelse?
Ithoughtforlike5minutes.

Heaskedmedoyouknowsuffixtrees?
Iimmediatelyunderstoodtheapproachandexplainedhimsuffixtreesbydrawingonpaper.

Nextheaskedmehowwillyouimplementthefeatureofautosuggesterofrelatednames
whenyoutypeanameofyourfriendonFacebook?

IproposedaTriebasedsolution.

Heaskedmetothinksomethingelse?
:)yesagain:)

Isuggestedsomethingbasedonhashing.Iwasaskedtoimprovemyhashtoavoid
duplicateentriesandsomeothercases.
Overallitwasareallygooddiscussionandienjoyedit.

Askedmeifiknowanyotherinterestingproblembasedontrie?
Explainedthisthread.
https://threadsiiith.quora.com/TutorialonTrieandexampleproblems

Finally,IntheendIaskedsomequestionstohimrelatedtoamazon.

Result:SelectedforFTE

Tips:
1. BeConfident.
2. NeverGiveup.
3. Patientlydiscusstheapproachandcornercasesbeforecodingthesolution.
4. Dontfakeanythingonyourresume.
5. Behonestwithyourinterviewer.
6. STLusageisallowed.

Name:TanmayDatta
Company:Artifacia
Result:Selected

Round1:
6codingquestions
PascalTriangle
https://community.topcoder.com/stat?c=problem_statement&pm=11774&rd=14724
QuestioninvolvingZalgorithm
https://www.careercup.com/question?id=5647083983863808
CheckifbinarytreeisBST
OneeasyquestionIdontremember.

Round2:
Discussionaboutprojects
DatabaseSchemaquestion.StoringImagelinksandtags.
Scalingdatabasewhendataoverflows.Shardingandmakingnewtables.

Round3:
Takearound2Kimagesofbirthdaypartiesfromtheinternet.Buildatextbasedsearch
engineusingtagsoverthoseimages.Thetagsforeachimagecanbeobtainedusingthe
ClarifaiAPI.

Instructions:

It'sanopenendedproblemandwewilllookatattentiontodetailthatyouhavewhile
buildingasystem.Codingstyle,datadesign,systemthinkingetc.

YoucanuseafreelyavailableBootstraptemplatetobuildabasicfrontendinterface
tothesystem.

YouneedtosignupforClarifaitoworkonthisprogram.Theyhaveadecenttagging
systeminplaceforallsortofimages.
Time:24hrs

Round4:
Discussionontheabovegiventask.
WhatDStouseforstoringandsearchingdata.Hashmap.Orderedandunordered.

Round5:
Whatiselasticsearch?Howwouldyouimplementasimpletextbasedelasticsearch?
Whatisvirtualmemory?

Whatispagingandsegmentation?
Differencebetweenprocessandthreads.
Basiccompilerdesignquestions.JusttoknowthatIamawarewhatitis.HoweverI
wasntabletoanswerthem.

Name:TanmayDatta
Company:Kuliza
Result:Selected

Round1:
Onlinetestwith2questionsandMCQs.

Round2:
ProjectDiscussion
Whataresockets?Whyaretheyused?Whentheyshouldbeused?
Howtodrawasquarewitharea2?
Differenceb/wcharpointerandchararraystring.
Givenarrayofnelements.Findfirstmissingpositiveinteger.O(n)time,O(1)extra
space.
Numberofinversionsinanarray.
Checkifthereareanyduplicatesinanarray.Numbersareinrange1n.O(n)time
andO(1)extraspace.
Findfirstoccurrenceofanyelementinsortedarray.(Binarysearch)
2easysqlqueries.

Round3:
Discussiononprojectsandpastexperiences.
2usersaretoreadandwriteinafile.Listpossibleproblemsandhowtosolvethem.
Howtoimplementversioning?(asgithubdoes)
Producerconsumerproblem.
SimpleDBschema,Interviewsystem.
1easySQLqueryandbriefdescriptionaboutJOINSinsql.

Name:TanmayDatta
Company:Curofy
Result:Rejected

Round1:
projectdiscussion
socketswhytouseandwhentouse?
nosqlvssqldifferencesandadvantages
briefintroofelasticsearch
Givenstreamofwords,telltop10wordswrtfrequencyatanytime.Reducespace
(usetrie).

Calculatefactorial.Reducetime(memoization).Reducespace(storepreviously
occuredvalues).

Round2:
projectdiscussion
socketswhytouseandwhentouse?
nosqlvssqldifferencesandadvantages
Howelasticsearchworks?Inacaseofachatapplicationwhatwillyouuse:nosqlor
sql
ifelasticsearchisnosql,whyisitnotusedasnosqldbforstorage
(http://stackoverflow.com/questions/38135000/whatarethepitfallsforusingelastics
earchasanosqldbforasocialapplica/38152311)
whatwillyoudowhengivenboringorrepititivework

Name:TanmayDatta
Company:Amazon
Result:Rejected

Round1:
http://www.geeksforgeeks.org/printnodesdistancekgivennodebinarytree/
http://www.geeksforgeeks.org/maximumsumsuchthatnotwoelementsareadjace
nt/

Round2:
Givenweightedbinarytree.Findallpairsofnodessuchthatdistancebetweenpairs
isK.
Roottoleafmaxpathinbinarytree
Givenarraypar[].Par[i]=jifjisparentofi.ItrepresentsaBST.ConstructtheBSTin
O(n)timeandO(n)space.
Allelementsinarrayappeartwiceexceptoneelement.Arrayissorted.Findthat
elementinlessthanO(n)timeandO(1)space.

You might also like