questions2014-2015
DESCRIPTION
IIT placement questionsTRANSCRIPT
-
PleaseaddallquestioorninthisdocwithheadingCompanyname@CollegeName,DatePleasegrouppapersofsamecompanytogetherCONGRATULATIONSTOEVERY.WehavedecidedatPGABthatfroWorksApplicationQuantitativetest,Mathsbased,prettyeasy
DIRECTI@IITKGP18NOVYou are given a rectangular grid with 2 rows and N columns. The top row is labeled 1 and the bottom row is labeled 2. The
columnsarelabeledfrom1toNinincreasingorder.Eachcellinthegridcontainsasinglecharacter.
Consider a hamiltonian walk in this grid. Meaning, pick a starting cell, say (i,j), and consider a path that starts from (i,j) and
goes through every cell in the grid exactly once. Note that you can only walk to adjacent cells, or cells that you share a
common edge with. There may be several such paths. Let us concatenate the characters in the order in which the cells are
visitedduringawalk.Thestringformedcanbecalledthestringforthewalk.
-
Among all the possible walks, and their respective strings, find out the lexicographically smallest string. We know that the
length of the strings are all the same to be precise, 2N. Thus, the lexicographically smallest string is simply the alphabetically
smalleststringifyoucomparethecharactersfromlefttoright.
Input
The first line of input contains a number T, the number of test cases. Then follow T test cases. Each test case contains 3 lines.
The first line contains the number N, the number of columns in the grid. It is well known of course that the grid contains rows.
The next two lines contain the description of the grid in the form of two strings the string of N characters in row 1 from left to
rightandthestringofNcharactersinrow2fromlefttoright,respectively.Eachcharacterwillbealowercaseenglishletter.
Outputlabs
Output a single line for each test case. The line must contain a string with 2N characters. This string should be the
lexicographicallysmalleststringforsomehamiltonianwalkinthegrid.
Constraints
1T1001N10
SampleInput
2gm3abcdef10ababaaababbababababa
SampleOutput
abcfedaaababababababababab
Explanation In the first test the possible strings are { abcfed, adebcf, adefcb, badefc, bcfeda, cbadef, cfedab, cfebad, dabcfe, dabefc, defcba, edabcf, efcbad, fedabc, fcbade, fcbeda }. The smallest string is abcfed.
You are given a large array of 10,000,000 bits. Each bit is initially 0. You perform several operations of the type "Flip all the
bits between start_index and end_index, inclusive". Given a sequence of several such operations, perform all the operations
on the array. Finally, split the array into sets of 4 bits first four, next four, then next four and so on. Each set can represent a
-
hexadecimal integer. There will be exactly 2,500,000 hexadecimal integers. Calculate the frequency of each of the
hexadecimal integers from '0' to 'f' among the 2,500,000 integers, and print it. See Input / Output and explanation of Sample
Input/Outputforclarity.
Input
The first line of input contains an integer T (1 T 10), the number of test cases. Then follows the description of T test cases.
You should assume that the array has exactly 10,000,000 bits and that the bits are all unset at the start of each test case. The
first line of each test case contains an integer N (1 N 10,000), the number of operations performed. The next N lines
contain two integers separated by a space, the start_index and end_index for the respective operation. Note that the flip
operation is performed from start_index to end_index, inclusive. Also, the array is 1indexed meaning, the smallest index is 1
andthelargestindexis10,000,000.
Output
For each test case, output 16 integers on a single line, separated by single space characters. The first integer should
represent the number of times 0 occurs among the 2,500,000 hexadecimal integers created according to the problem
statement. The second integer should represent the number of times 1 occurs among the 2,500,000 hexadecimal integers
createdaccordingtotheproblemstatement,andsoon.
Constraints
1start_indexend_indexstart_indexend_index10,000,000
SampleInput
221499999971000000023658SampleOutput24999980000000000000022499998002000000000000
Explanation
In the first test case, after we perform the two operations and split the array into 2,500,000 groups of 4 bits, the first and the
last group will have all 4 bits set representing 'f' hexadecimal digit. All the other groups will have all 4 bits unset representing
'0'hexadecimaldigit.
-
In the second test case, after we perform the two operations and split the array into 2,500,000 groups of 4 bits, the first two
groups will have the state 0011. This represents the hexadecimal digit '3'. All the other groups will have all the 4 bits unset
representing'0'hexadecimaldigit
BrowserStackRound2@IITBHU(151114)Total5to6hourstime.3Questions.Googling,useofanyothersitewasallowed.Ques1.)InthisprogramyouhavetoconsumeTwitter.comsRESTAPI.Writeaprogramthat,givenahashtagHandanumberN,
fetchestheNmostrecentimages(noduplicates)associatedwiththathashtag andgeneratesawebpage(anHTMLfilewoulddo)whichdisplaystheseimagesasasimple
slideshowYoumayattemptthisprobleminanyprogramminglanguagebutyoumayNOTuseathirdpartylibraryliketwitter4j.YoumayhavetocreateanewTwitteraccountifyoudontalreadyhaveone.VisitTwitterAppManagementtoregisteranewappandobtainanAPIkey.SeeTwitterRESTAPIdocsformoredetails.Ques2.)Considerthewebserverloginthefilesample.logWriteashellscript(zsh/bash)thatparsesthisfileandoutputsthefollowing:
1. thenumberofHTTP404errorsinit2. alistofallHTTPresponsecodesinthelogandtheircount
Youmaydownloadthelogfileandsaveitlocallyfortestingpurposes.Forthesecondpart,yourscriptmustfindallresponsScrapeIMDBtop250listandmakeaknowledgebasewhichsupportsqueryfortopmoviesofanygivenactoScrapeIMDBtop250listandmakeaknowledgebasewhichsupportsqueryfortopmoviesofanygivenactoScrapeIMDBtop250listandmakeaknowledgebasewhichsupportsqueryfortopmoviesofanygivenactoScrapeIMDBtop250listandmakeaknowledgebasewhichsupportsqueryfortopmoviesofanygivenactoScrapeIMDBtop250listandmakeaknowledgebasewhichsupportsqueryfortopmoviesofanygivenactoecodesinagenericfashion,youshouldnothardcodesearchesforaknownlistofresponsecodes.ThescriptmustbeashellscriptPerl/Python/Rubyarenotacceptable.Ques3.)ScrapeIMDBtop250listandmakeaknowledgebasewhichsupportsqueryfortopmoviesofanygivenactor.
-
MICROSOFT@IITBHU+IITK(061114)
1hourtestconductedoncocubes.com2codingquestionsonly.Questionssameforallthestudents.LanguagesOnlyC,C++,Java,C#wereallowed.Ques1.)ConvertabinarytreeintoitsMirrortree.Condition:Inplaceconversionrequired.Ques2.)Givenanumber,returnthenumberofsetbitsofthenumberifbinaryrepresentationofthenumberisapalindrome,elsereturn1.Condition:Youcantusearrayoranyotherdatastructure. Eg.Input 37 trOutput 1Input 165Output 4
MICROSOFT@IITD+IITKGP+IITM(061114)1hourtestoncocubes.com2codingquestionsonly.Questionssameforallthestudents.LanguagesOnlyC,C++,Java,C#wereallowed.1. Givenanarrayofintegers,findanindexsuchthatsumoftheelementofleftside=sum
ofelementofrightsidenarrayofintegers,findanindexsuchthatsumoftheelementofleftside=sumofelementofrightsideinput:12131816o/p:2because12+13=18+1+6
2. Givenanarrayofintegers,findthemaximumcontinuoussumsuchthatnoelementscontributingtothesum,arerepeated.I/p:1233452o/p:14as3+4+5+2=14
-
MICROSOFT@IITG(061114)
1).http://www.geeksforgeeks.org/kthsmallestelementinarowwiseandcolumnwisesorted2darrayset1/ 2).Givenabinarytreeandanumber.Ifthetreehasaroottoleafpathsuchthataddingupallthevaluesalongthepathequalsthegivennumber,returndepthofthatleaf(minimum,ifmultiplepaths),Return1ifnosuchpathcanbefound.
DirectIQuestionsLinks(SamequestionsaskedinallIITstillnow)
http://www.codechef.com/DI14R018tlITBHUhttp://www.codechef.com/DI14R019IITBHUhttp://www.codechef.com/DI14R024IITM(SetBitsandSmallestRectangularStringproblem)@IITMguyspleasepostscreenshots.Thelinkisunaccessible.@IITDelhiColorfulKnapsack+Best2x2Sudoku@IITG@IITB
Adobe@IITBHU(41114)
2Sections,10questionseachsection,totaltime2hours,Fullsubjective.Paperandpentest.AllquestionsrelatedtoCSE.Noaptitudequestions.NoMCQs.Somequestions:
somemicroprocessorcodegiven,tellanswer LCAof2nodesinBST returnpointertomiddleoflinkedlistin1pass Array of size n1 has numbers 1 to n, one number missing, no number repeated, find the missing
number
-
WhatisthebestSTLusedtofindmatchingparenthesis sometheoreticalquestionsonpointersandfunction findGCDusingrecursion findmax.of3numbersusing?:only reverseadoublylinkedlist find2'scomplimentofano.giveninstringform somemacrorelatedquestions GivenaHashfunction,findvalueofkeyshavingsamehash Givenorderofinsertionofnodes,makeBST given3AC,anumberinbase14,convertittobase7.(onlyshowworkingongivenexample,nocodeor
algo)[ans=2105] Simplifyagivenbooleanexpression. Explaina)&b)
a)void(*p)(void*a[],intn)b)void*(*p[])(void*a,intn)
@IITM13GATEpatternMCQsand7CodingQuestionsPlatform:HackerRankTIme:2hrsCodingQuestions:1. Reverselinkedlist2. Checkbalancedparentheses3. Givenm*nbinarymatrix,whereeachrowhasall1sfirstandthenall0s.Youneedto
returnrownumberwhichhasmaximum1s.4. Everyintegerendingwith3hasatleastonemultiplewhichismadeofonly1s.Ex.3
has111,13has111111.Givenintegern(LSDis3),returnitssmallestsuchmultiple.MCQs:1. charstr1[]=Hello
charstr2[]=Helloif(str1==str2)
cout
-
2. charstr1[]=Hello
str1[6]=bcout
-
1>FindingPrimeNumbersbetweenTwoNumbers
2>Determinantofamatrix. IITKGPPlatform:HackerEarthQ1.NumberofIslandsinagivenmatrix 6+Q2.GiventwoStringsfindwhetherallthecharsoffirststringarethereinsecondstringornot.len(str2)>len(str1)insecond.Stringmaycontainspecialcharsalso.Note:ReadingInputwasthemainproblem.Boththestringswillbegiveninalinewithaverticallinebetweenthem.Alsostring1andstring2mightcontainspacesEx:Input:Iamabadboy|Iamnotabadboy
IITKGPcitrixwrittenquestions.(1houraptifollowedbyanother1hourcoding(2que))1.Dontremembertheactualquestionbutitwasrelatedto8connectedness,i.egivenamatrixof1'sand0'syouneedtofindnumberofclustersof1's.cluster>foranycellinmatrixevery8adjacentcellforthatcellwillbeinthesamecluster.2.Giventwostringscheckwhetheroneispseudoanagramofother.conditions:(i)onlylettersneedtobeconsidered.Te.g.abcdandbc"ad?arepseudoanagrams.(ii)caseinsensitive.e.g.abCdandBCaDarepseudoanagrams.(iii)repetitionofcharactersisallowed. e.g.abcdandbccaaadarepseudoanagrams.
-
aptitude:somec,c++programs,os,quantapti,n/w.......nottough
Codenation@IITKGPandIITBPlatform:HackerRankDuration:1hr45min3CodingquestionsQ1.Givenrangeoflengthofthreesidesofarectangleasl1,u1,l2,u2,l3,u3.Here(l1,u1)isminmaxlengthofthebaseandothertwoaresideswithrightangle.Youhavetofindoutpossibleminmaxlengthof4thsidewhichcanbeconnectedwithtwosides.Hereanglebetween4thsideand2nd,3rdneednottoberightangle.Sampletestcase1:Input:4,43,33,3Output:4,4Note:InputsarecommaseparatedtwonumbersSampletestcase2:Input:
10,124,83,6
Output:10,13(Explanation:10whenbothsidesareequaland13whendiffisGivenrangeoflengthofthreesidesofarectangleasl1,u1,l2,u2,l3,u3.Here(l1,u1)isminmaxlengthofthebaseandothertwoaresideswithrightangle.Youhavetofindoutpossibleminmaxlengthof4thside
-
whichcanbeconnectedwithtwosides.Hereanglebetween4thsideand2nd,3rdneednottoberightangle.5)Q2.http://www.hackerearth.com/pro.../algorithm/magicfractions/Q3.GivenaninputmatrixwhichhasYinthecell(i,j),ifpersoniiscomfortabletalkingtopersonj,ourtaskistofigureoutwhatarethemaxnumberofpeoplethatcanbekeptengagedamongstthemselves.Note:Aguestcantalktooneguestatatime,effectivelykeepingbothofthemengaged.Input:5(Numberofguests3,2>1,3>2Thishastobeapplied3timestothesequencetogetbacktotheoriginalsequence1,2,3>2,3,1>3,1,2>1,2,3Hence,theorderoftheabovepermutationis3.GivenaninputN,printthenumberofdifferentordersthatitcanhaveacrossallit'scyclicpermutations.Note:Nwillalwaysbegreaterthan0andlessthan500Example:1)
- Input:3Output:2Explanation:Thereare2possiblepermutationordersof3forit'scyclicpermutation:1(fortheidentitypermutation),and2(cyclicpermutationsof2and3)2)Input:4Output:3Explanation:The3possibleordersare:1(identitypermutation),2(cyclicpermutationof2),4(cyclicpermutationof1and3)Q2.WehavetwostringsAandBwiththesamesupersetofcharacters.Weneedtochangethesestringstoobtaintwoequalstrings.Ineachmovewecanperformoneofthefollowingoperations:1swaptwoconsecutivecharactersofastring2swapthefirstandthelastcharactersofastringAmovecanbeperformedoneitherstring.Whatistheminisupersettheircharactersareequal.1
-
Q3.Babaiisstandinginthetopleftcell(1,1)ofanNxMtable.ThetablehasNrowsandMcolumns.Initiallyheisfacingtotherightcell.Hemovesinthetableinthefollowingmanner:Ifthecellinfrontofhimiswithinthetableandunvisited,hethenmovesonestepforwardintoit,andturnstohisright.1.Otherwiseheturnstohisright,andtriesstep1again.2.Ifhehasnorightturnsremaining(hehastriedstep2fourtimes),thenhestops.3.Hemovesaroundthetableandvisitsasmanycellsashecan.Yourtaskistofindoutthenumberofcellsthathevisitsbeforehestops.Here'sasampleofBabai'sstepsona9x9grid.Thevalueateachcelldenotesthestepnumber.125554515047464543565352494843445657587978774241876059807576394091061628174733837121164636869723536131465666770713433161520212425282932171819222326273031InpTheinputcontainstwointegersNandMseparatedbyaline.NandMarebetween1and100.Output:PrintasingleintegerwhichistheanswertothetestcaseSampleinput#00:33Sampleoutput#00:9Sampleinput#01:74Sampleoutput#01:18
-
FLIPKART
FlipkartatIITdelhiGraduateTraineeProfile
-
Facebook
Flipkart@IIT(BHU)Varanasi
-
Hostedon:hackerrank.com
-
Time:90minsNoobjectivequestions.
Anyonewithanswersofabovemcqs?
Twocodingquestions.Wehavetocompletethefunctiononly.
Oneofthequestions
numberofstripsrequiredtocoverthewholegrid.
Note:onlythecoloredpointsshouldbecovered.Pointswith'.'shouldremainasitis.
1
-
24
..B.
..B.
Output
1
Input
55
..B..
..GRR
..B..
R.
R....
Output
4
\Input
55
..B..
..GRR
..B..
B....
B...G
Output
5
Input1
34
-
GGGG
GRRG
G..G
Output
8
Explanation:
Bluestripsarevertical.
Redstripsarehorizontal.
Ex1:
Only1verticalstripfrom(0,2)to(1,2).[Indexingfrom(0,0)]
Ex2:
1verticalstripfrom(0,2)to(2,2)
1horizontalstripfrom(1,2)to(1,4)
1horizontalstripfrom(3,0)to(3,0)
1horizontalstripfrom(4,0)to(4,0)
sototal4
Ex3:
1verticalstripfrom(0,2)to(2,2)
1horizontalstripfrom(1,2)to(1,4)1verticalstripfrom(3,0)to(4,0)
1horizontalstripfrom(4,4)to(4,4)
1verticalstripfrom(4,4)to(4,4)
sototal5
Ex4:
1.)Givenamxngrid,eachofit'selementbeeither'.','R','G'or'B',
where'.'>empty,'R'>Red,'G'>Green,'B'>Blue
ABluestriphaswidth1andlengthgreaterorequaltoone.[Vertical]
-
ARedstriphaslength1andwidthgreaterorequaltoone.[Horizontal]
IfaRedstripandaBluestripoverlaps,theoverlappedportionwillbecome'G'.w
Findtheminimumn
1horizontalstripfrom(00)to(0,3)
1horizontalstripfrom(1,0)to(1,3)
1horizontalstripfrom(2,0)to(2,0)
1horizontalstripfrom(2,3)to(2,3)
1verticalstripfrom(0,0)to(2,0)
1verticalstripfrom(0,1)to(0,1)
1verticalstripfrom(0,2)to(0,2)
1verticalstripfrom(0,3)to(2,3)ssototal8
SAMSUNG
SamsungIndia(R&D)atIITMadras,20/10/2014
2Rounds:
Round1:60mins
Tip:AttempttheMathpartfirstandVerbalthelast.
ShortlistbasedonscoreinRound1
Round2:codinground1hr
Questions
Onlineweredifferentfordifferentpeople.Questionscollectedfromalimitedpoolofquestionsandjumbledsequencewords)wasignoredbecausewelimitqueriesto32wordforeveryone.
-
3questionsforA:x
1.Givenastrings1removealloccurrencesofthestrings2instrings1andalsoremovealloccurrencesofstrings2afterremovalofs2ins1andsoon..andreturnthestringobtainedaftersuchremovals.[5points]
Example:s1="qwewerrty"s2="wer"
Output:qty
(Onthefirstremovalofweritbecomesqwerty.Onremovalagainnowqty.Nothingtoremovenow.)
2. astring,printthenumberofoccurrencesof1[0]*1where*denoteszeroormoreoccurrencesofthedigit0.[5points]
Input:10011abc10000001
Output:3
3.Questionhadsomerobotandstorybuildupbuttheessenceisthis:
Youaregivenanmxngrid,where(0,0)referstopmostleftpositionand(m1,n1)thebottommostright.Thegridisfilledwithones.Allpositionsinthegridthatareblockedarefilledwithzeros.Youaregiventhisgridandareassuredthatthereexistsatleastonepathfrom(0,0)to(m1,n1).Findtheminimumdistanceofthepathfrom(0,0)to(m1,n1)giventhatyouareallowedtomoveonlyvertically,horizontallyanddiagonally.[8points]
AnothersetofquestionsforRound2.Addingthecommenthereforbettervisibility.
1.(5points)SameasA'ssecondquestion.
2.(5points)Giventwolinkedlists,whereeachnodeofalistcontainstheexponentsandcoefficientsofapolynomial(indecreasingorderofexponents,zerocoefficientsdon'thavenodesassociatedwiththem),performmultiplicationofthetwopolynomialsandreturnalinkedlistwiththeresult(conditionssimilartotheinputdecreasingorderofexponents,termswithzerocoefficientsshouldnotbepresentinthelinkedlist)3.(8points)Givenawordwithuniquelowercasecharacters,returnitsrankinadictionarythatconsistsonlyofwordsthatareanagramsofthegivenword.
-
Eg:"take":6wordsstartwith'a',6with'e',6with'k',1witht,andfinally"take",soitsrankis6+6+6+1+1=20. 1.Determinewhethertheanagramofagivenstringcanbeapalindrome.2.SameasA'sfirst.3.You'regivenanarrayofintegers.Returnthelargestnumberyoucanmakeusingallthedigitsinthearray.e.g:a=[23,45,67],return765432.(concateverything,sortandreturn.)
DirectiDirecti@IITR,18thOctober20142Questions90min.PlatformcodechefQ1:TheithstonehasthecolorC[i](between1toM,inclusive).TheKnapsackcanholdatotalweightofX.Fillknapsackwiththesestones.wehavetoselectexactlyoneofeachMstonecolors.sumoftheweightsofthestonesmustnotexceedX.WehavetofilltheKnapsackasmuchaspossible.(henceminimizeunusedcapacity.)Inputnumberoftestcases.Thefirstlineofeachtestcasecontainsthreeintegers,N,MandX,TheNintegers,W[1],W[2],W[3]...W[N],(Weight)NintegersC[1],C[2],C[3]...C[N],OutputtheunusedcapacityoftheKnapsack(asingleintegeronalinebyitself)foranoptimalway.IfthereisnowaytofilltheKnapsack,output1.Constraints
- 1T101M100MN1001W[i]1001C[i]M1X10000SampleInput3(testcases)9310(1sttest)234234234(wt)111222333(color)9310(2ndtest)135135135(wt)111222333(color)3310(3rdtest)344(wt)123(color)SampleOutput011Note:bruteforcesolutionwillfail.Q2:Thereisabitarrayoflength10000000.sAnoperationisperformedseveraltimesonthisarraywithgivenstartandendindices(onepair).Anoperationflipsallbitsb/wstartandendindices(inclusive)ofbitarray.AftertheNoperations,youneedtotellthefrequenciesof16hexdigitsinthatarray.0
-
2499998002000000000000Note:Eachpairof4bitsrepresentsahexdigit.:Intheexample,bitsafter1stop:00111100s..:after2ndop:0011001100.:So,thereareand23srestofthemare0s.Note:BruteforcewillgiveTLE.Directi@IITMtwo2questions90minq1setbitsYou are given a large array of 10,000,000 bits. Each bit is initially 0. You perform several operations of the type "Flip all the
bits between start_index and end_index, inclusive". Given a sequence of several such operations, perform all the operations
:on the array. Finally, split the array into sets of 4 bits first four, next four, then next four and so on. Each set can represent a
hexadecimal integer. There will be exactly 2,500,000 hexadecimal integers. Calculate the frequency of each of the
hexadecimal integers from '0' to 'f' among the 2,500,000 integers, and print it. See Input / Output and explanation of Sample
Input/Outputforclarity.
Input
The first line of input contains an integer T (1 T 10), the number of test cases. Then follows the description of T test cases.
You should assume that the array has exactly 10,000,000 bits and that the bits are all unset at the start of each test case. The
first line of each test case contains an integer N (1 N 10,000), the number of operations performed. The next N lines
contain two integers separated by a space, the start_index and end_index for the respective operation. Note that the flip
operation is performed from start_index to end_index, inclusive. Also, the array is 1indexed meaning, the smallest index is 1
andthelargestindexis10,000,000.
Output
For each test case, output 16 integers on a single line, separated by single space characters. The first integer should
represent the number of times 0 occurs among the 2,500,000 hexadecimal integers created according to the problem
statement. The second integer should represent the number of times 1 occurs among the 2,500,000 hexadecimal integers
createdaccordingtotheproblemstatement,andsoon.
Constraints
-
1start_indexend_indexstart_indexend_index10,000,000
SampleInput
221499999971000000023658
SampleOutput
24999980000000000000022499998002000000000000
Explanation
In the first test case, after we perform the two operations and split the array into 2,500,000 groups of 4 bits, the first and the
last group will have all 4 bits set representing 'f' hexadecimal digit. All the other groups will have all 4 bits unset representing
'0'hexadecimaldigit.
In the second test case, after we perform the two operations and split the array into 2,500,000 groups of 4 bits, the first two
groups will have the state 0011. This represents the hexadecimal digit '3'. All the other groups will have all the 4 bits unset
representing'0'hexadecimaldigit.
q2smallestrectangleYou are given a rectangular grid with 2 rows and N columns. The top row is labeled 1 and the bottom row is labeled 2. The
columnsarelabeledfrom1toNinincreasingorder.Eachcellinthegridcontainsasinglecharacter.
Consider a hamiltonian walk in this grid. Meaning, pick a starting cell, say (i,j), and consider a path that starts from (i,j) and
goes through every cell in the grid exactly once. Note that you can only walk to adjacent cells, or cells that you share a
common edge with. There may be several such paths. Let us concatenate the characters in the order in which the cells are
visitedduringawalk.Thestringformedcanbecalledthestringforthewalk.
Among all the possible walks, and their respective strings, find out the lexicographically smallest string. We know that the
length of the strings are all the same to be precise, 2N. Thus, the lexicographically smallest string is simply the alphabetically
smalleststringifyoucomparethecharactersfromlefttoright.
Input
-
The first line of input contains a number T, the number of test cases. Then follow T test cases. Each test case contains 3 lines.
The first line contains the number N, the number of columns in the grid. It is well known of course that the grid contains 2 rows.
The next two lines contain the description of the grid in the form of two strings the string of N characters in row 1 from left to
rightandthestringofNcharactersinrow2fromlefttoright,respectively.Eachcharacterwillbealowercaseengishletter.
Output
Output a single line for each test case. The line must contain a string with 2N characters. This string should be the
lexicographicallysmalleststringforsomehamiltonianwalkinthegrid.
Constraints
1T1001N10
SampleInput
23abcdef10ababaaababbababababa
SampleOutput
abcfedaaababababababababab
Explanation
In the first test the possible strings are { abcfed, adebcf, adefcb, badefc, bcfeda, cbadef, cfedab, cfebad, dabcfe, dabefc,
defcba,edabcf,efcbad,fedabc,fcbade,fcbeda}.Thesmalleststringisabcfed.
LinkedIn
LinkedIn@IITB24thNovSomeMCQs3Codingquestions
-
1. Givenanarrayof0sand1s.Youcanchoosetwoindicesiandjandflipalltheelementsbetweenthem(ie0>1and1>0).Findmaximumsumofthearraywhichcanbeproducedaftertheflip.egFor[0,1,0,0,1,0],outputis4.flipfromindex2to3.usekadanesalgo
2. Findtwonumbersfromanarraywhichsumtoagiventarget.bruteforcewontwork
3. Situationisthatsomecaterpillarsstartfromthebottomandjumpstothenextleaf.Theyeattheleafbeforejumpingtonext.Wearegivenanarraywhichrepresentsjumpstepsmadebycaterpillars.Ifthearrayis[2,4,7],itmeanscaterpillar0willeatleaf2,4,6..caterpillar2willeatleaf4,8,12..andcaterpillar7willeat7,14,210representsground.Calculatethenumberofuneatenleaves.(n
- ExactlysameasIITRLinkedIn@IITD(dateplease?)1)searchanumberinabinarysearchtree.return1iffoundand0ifnot.2)counttotaldistinctsubstringsinastring.N=10^53)countdistinctpalindromicsubstringsinastringegS=aabaa.output=5(a,b,aa,aabaa,aba)|s|
-
4Sections(TotalTime:75Minutes)1:AnalyticalReasoning(15Question)2:QuantitativeReasoning(15Questions)3:VerbalReasoning(10Question)4:ComputerScience(20Question)Allthesectionsarefairlyeasy,speciallyquantsandCS.Oracle@IITM(AptitudeTest)SameasOracle@IITKOracle(Round2Coding)@IITBombayNovember52014Q1)GameofStones,GivenNstacksofdifferentsizes.Twoplayer,onebyonepopsomevaluesfromanychosenstack,ifbothplayersplayoptimallythenprint1ifplayer1willwintheGame,print2ifhewilllosetheGame.Input:N=3{1,1,1}output:1,N=4{1,1,11,11}output:2,N=2{1,100},output:1Q2)0/1knapsackOracle(Round2Coding)@IITMadrasOctober26th2014Duration:30minsOnecodingquestion.Difficultylevel:frompersontoperson.Ifyou'relucky,youmightgettheeasiestofproblems.Mostproblemsweredirect*expected*questions.Platform:mettlSomequestions:1.Giveninorder,preordertraversalofaBinaryTreegivepostorder.2.Rodcuttingproblem.Oracle@IITKGP(AptitudeTest&CodingTest)SameasOracle@IITMOracle@IITGuwahati(Round2Coding)About90studentswereshortlistedaftertheMCQroundforallprofiles.Thecodingroundhadonlyonequestionforeachstudenttobesolvedin30minutes.Theinterfacewasreallyugly.Everyonegotadifferentquestion.Againtheease/difficultyofthequestionispurelyluckbased.BetterpractiseallsortsofstandardDPandgreedyalgorithmicquestions.
-
SomeQuestions:1.JobScheduling:Givenstartingandendingtimesofnjobs,Whatisthemaximumno.ofnonoverlappingJobsthatcanbescheduled.ExIfthereare5Jobswithtimeintervals(1,4),(2,3),(3,5),(2,7),(5,8)thenansweris3.(StartingtimeofonejobandEndingtimeofanotherjobcanbesame).BothGreedyandDPsolutionswillwork.2. StandardNimGame.
Oracle@IITBHU(AptitudeTest&CodingTest)SameasOracle@IITMOracle@IITR(Aptitude&CodingTest)SameasOracle@IITM
EpicSystemsDoallthesequestions.NoneedtoreadanyotherplacementPaper.Youwillgetallthe
questionshere.
http://www.careercup.com/page?pid=epicsystemsinterviewquestions [email protected]:2mins10questions,attemptasmanyasucan.B.Apti:12questionsC.Technical:20questions,basedonsomenewlydefinedlanguage.sectionB,Cdidnothaveanysectionaltimelimit.Butyouneedtofinishthese3sectionswithin75mins.Youwillbejudgedonspeedandaccuracy.Sotrytocompleteasfastaspossible.D.Coding:4questions,2hrs.Butagainyouwilljudgedbasedonspeedandaccuracy. Writefunctions.Pseudocodesareallowed.Itslikeaonlineversionofpenandpapercoding.Questionsofthissectionwasdifferentforeveryone.Iamsharingmyquestions.
-
#1.Supposeallmonthshave30days.There's12monthsinayear.Februarywouldhave31daysinaLeapyear.conditionforleapyearisdefinedas(year%40==0)isleap,(year%200==0)isnotleap,(year%1000==0)isleap.GivenadateasMM/DD/YYYY,findthenextLeapDay.#2.Printmatrixinspiralorder.#3.Youhavetoprintallpossiblecombinationsofphonenumbers.Thelengthofthenumberwillbegiven.Also3digitswillbegiven,whichcannotbeused.Notwoconsecutivedigitswouldbesame.Anumbercontaining4wouldalwayshave4inthebeginning.m#4.Givenanumber,getallpossiblesubstringsusingthedigitsofthisnumberandiftheproductofdigitsinonesubsetissamewiththeanother,thenreturnfalse,elsereturntrue.e.g.345={3,4,34,45,35,345}productsare{3,4,5,12,20,15,60}hencetrue3426={3,4,2,6,34,42,26,....}product={3,4,2,6,12,8,12,..}hencefalse.(productsof34and26aresame)Epic@IITRLogicalReasoning,Aptitude:Seecareercupforquestions.Samequestionswererepeated.4codingquestions(Questionsforeveryoneweredifferent)mo
1) Tosubtract2numbersgiveninformofarrays.Itshouldhandlealltheoverflowconditions.
2) Givenamatrix,findthemaximumlengthpath.Givenaindex,youcanmoveonlyrightandbottom,andalsothedifferencebetweentheelementsofthepathshouldbe+1.
3) ImplementBingogame.4) TicTacToequestion.5) Searchagivenwordinmatrix.6) Givenanumber,youcanmultiplyitwithanydigit29,checkifthegeneratednumberis
theanagramofthegivennumber.7) Givensequenceofkeystrokesofa.8) In19keypadonekeyisnotworking.Ifsomeoneentersapasswordthennotworking
keywillnotbeentered.Youhavegivenexpectedpasswordandenteredpassword.CheckthatenteredpasswordisvalidornotEx:entered164,expected18684(youneedtotakecareaswhenuenter18684and164onlybothwillbetakenas164input)
9) Astring'aBlY'issaidtobewellorderedbecausethelettersofthestringoccuroneaftertheotherinthealphabet.Writeafunctionwherethenumberoflettersinthestringarepassedasparameterandallsuchwellorderedstringsarefound.
Epic@IITK
-
SameformatasIITRandIITDforspeedquestionsifatoneglanceyoucandoitthendoelseattemptanyoptionandmoveforward(thereisnonegativemarks).Trytolookatasmanyproblemsasyoucan.Youcandoatleast78questions.forLogicalReasoningandAptidocheckCareercupQuestionsofpreviousyearsandforprogrammingproblemalso.Many(Ithinkall)ofthequestionsarerepeatedfromthepreviousyears(everyonewillhavedifferentcodingquestions).Someofthemare:
1) Generateallwellorderednumbersofgivenlength(digitati+1>digitati)2) ImplementSolitaireGame3) Searchagivenwordfromamatrix4) Givenanarrayoftextprintitincolumnmajorformatwiththetextasreversede.g.
input:Hello Output:WWHWhat hheWhere eal
rtleo
5) Givenasequenceofkeystrokesgenerateallpossibletexts
Ebay
Ebay@IIT(BHU)SectionAHorribleQuantAptitude20questionsin30minutes.Godknowswhatwasthat!!Mostofuscouldsolvehardly78outofit.SectionBPen&PaperCodingEasyEbay@IITDSectionAPen&PaperCoding:anyoneoutoftwoquestionsin30mins.Level:Easy
-
1.Printingastringinwavelikepattern.Ifthecurrentcharacterisgreaterthan(azorder)thatofpreviouscharacterthenprintitabove,ifitislessthancurrentthenprintbelowandifitsequaltheninsameline.e.g.I/P:abcbdO/P:(thesedashesindicatesspaces)cdbba2.Replacethegivensubstringwithsomeothersubstringinastring.I/P:SUNDAY,replaceSUwithMOMONDAY
what will be answer, if I/P SUUNAP, replace SU with MS ?? on first replacement, ans is MSUNAP, but it again contain SU, So do we need only one iteration, are something like, final answer must not have any substring of SU ?? Ithinkonlyonetimereplacementisenough.SectionBOnlineaptitude,20questions,30mins.+1forcorrectanswer,0.25forwrong.DItimeconsumingtediouscalculations,LogicalHorrible!QuantMediumbuttimeconsuming.Wedidn'tfindmanypeopledoingmorethan1012outof20.Ebay@IITKGPFormatsameasabove.CodingquestionsQ1Youweregivenalistofstringswhicharecorrectwords.eg.iswhybookgoodballbatthisandasentencewithmisspelledwords:Thsisagodbal.Onehastocreatethecorrectsentence:Thisisagoodball.
-
Thoughitwasntmentioned,itcanprobablybeassumedthatcorrectwordofmisspelledwordingivensentenceexistsinthegivenlist.Q2Printallsubstringsofagivenstring.(Removepossibleduplicatesalthoughitwasntexplicitlymentioned).forexampleinputabcoutputaababcbbccEbay@IITM,November5theBay@IITM
Penandpapercodingquestionattemptoneoutof2,30minutes
(1)W,i.e.theorderisQWERTYUIOPASDFGHJKLZXCVBNM
Input:Stringswithonlyuppercase
letters,oneoneachline,thelastlinewillcontaina"."
Output:Thestringsinqwertysortedorder
Example(Idon'tremembertheexactexample,soI'mcreatingmyowntestcase:P)
Input:
APPLE
TRACK
CAT
TRACTOR
QUEEN2
.
-
Output:
QUEEN
T0RACTOR
TRACK
APPLE
CAT
(2)Giventhesequence3,4,33,34,43,44,333,334,343,...andanumber'n',printthenthnumberinthissequence
Thesecondpartwasanonlineaptitudetestfor30minutes.Thequestionswerelongandthecalculationsweretedious,similartowhatothers(IITD)havestatedbefore.
BrowserStack(2round)@IITBHUConsiderthefollowingseries:A:=1B:=A*2+2C:=B*2+3andsoon...Writeaprogramthat:
outputsthenumbercorrespondingtoagivenletter givenastringofletterslike'GREP',computesthesumofthenumberscorresponding
toallthelettersinthestring(i.e.,G+R+E+P),asgivenbytheaboveseriesand givenalargenumber(thatwouldfitintoastandard32bitinteger),findstheshortest
stringofletterscorrespondingtoit.Youmayuseagreedyapproachforthelastpart.ComputethevaluesofthenumberscorrespondingtolettersasandwhenrequiredandDONOTprecomputebeforehandandstoretheminadatastructure.Youmayattemptthisprobleminanyprogramminglanguage.
2ndquestionTheprogramwillbegivenafoldernamed(optional,ifnotpassedassumecwd).Theprogramwillprint
somethinglikethis:
$tree.
|README.md|closure
||currencySymbols.js
-
|e2e||i18ne2e.js
||localeTest_cs.html|generate.sh|runtests.sh|spec
||closureI18nExtractorSpec.js||converterSpec.js|src
||closureI18nExtractor.js||closureSlurper.js
||converter.js
4directories,10files
BrowserStack@IITBBrowserStack...... TESTQUESTIONSIITB@27OCT1.)Question:Youjoinacompanywhichusesalegacycommandlineprogram.Thisprogramwhengivenaninputlikethis:abcdefghiSpitsoutanoutputlikethis:abcfihgde
+ Sourcecodeofthisprogramislonglostandonlythebinary2remains.Youmanagerhasaskedyoudeterminethelogicandwritethisprogram,inacomputerlanguagethatyouprefer,sothatsourcecodeoftheprogramisinthecontrolofthecompany.SampleInput(PlaintextLink)abcdefg1920SampleOutput(PlaintextLink)abcf2019gde==========================================================2+.)JsonparseplusseriescomputationMax.Score20EvaluateanexpressiongiveninanJSONformat.Keyswillbe:ExprcontainstheentireexpressionElemcontainsthedigit,Sum,Prodcontainstwoormorekeyswhoseevaluationneedstobesummedormultiplied,respectively,Subwillcontaintwokeysormore,wherethe
-
secondkeyonwardswillhavetobesubtractedfromthefirstoneDivwillcontaintwokeysinwhichthefirstkeywillneedtobedividedbythesecondSampleInput(PlaintextLink){"expr":{"sum":{"elem":["4","6","7","3"]}}}SampleOutput(PintextLink)la20ExplanationInput:Willbejsonfilethroughstandardinput.expressionwillbegivenasvalueofexprkey,asshowninexampleOutput:Youneedtoprinttheresultofevaluatedexpression Browserstack:@IITR12thOctober2014Onlinecoding3hrs2questions20markseachProblem1:WriteaprogramwhichtakesJSONasinputandgivesprettifiedJSON
a)YouneedtoreadJSONfromSTDIN.InputgivesonelineofuglifiedJSON.b)OutputshouldbeformattedJSON.
GiventwoJSONobjects,findthevaluesoffields.whosevaluesaredifferent.Eg.Input{"Geeks":"Test1","Are":"hey","Cool":"yeah"}{"Geeks":"Test1","Are":"20","Cool":['B','C']}Answershouldbeasfollows..
-
Ans:Are:CoolProblem2:lGivenastringandaRegularExpressionmeanasfollows:.2occurrencesofthepreviouscharacter,+4occurrencesofpreviouscharacterpattern,givethenumberofthetimesthepatternoccursinthestring.RegExsymbolser,*morethan5occurrencesofthepreviouscharacterSampleInput(PlaintextLink)5aaaaaannndnnnnnnfffhfhhgjjjwkkkllclca.n+a*an.a.d.SampleOutput(PlaintextLink)53210Browserstack:@IITDProblem1:Givenanumbern,printthesumofdigitsinn!.(ncanbelarge)Problem2:SameasIITRBrowserstack:@IITBHUIITBHUbrowserstackwrittenroundquestions.Duration:3hours,Platform:HackerEarth1.Givenapieceofcode,thetaskwastoremoveallthecommentsfromthecode.Eg.Inputintmain(){//thisisacommentinti=1
- /*somemorecomments*/cout
-
output:%FIRST
%SECOND%THIRD
Thisisthird%FOURTH
%FIFTHThisisfifth
sampleline(eachtabconsistsoftwospaces,i.e.tab=).2. Nibonaccinumbersaredefinedas
f(x)=0forallx=2
Thatis,foragivennthesequenceislike0,1,1,2,...Example,forn=3,thesequenceis0,1,1,2,4,7,13,andn=4,thesequenceis0,1,1,2,4,8,15,.
Now,considering0and1alsoaspowersof2,foragivenn,findtheleastnumberofthe
sequencewhichisnotapowerof2modulo10^9+7(1000000007)2
- 12ObjectiveQuestions(GATElike)2CodingquestionsOS,GraphTheory,Automata,SQL,AlgorithmHostedonHackerRankDuetoslowinternetconnectivity,wewereaskedtosolvethequestionsonpaperwhichwillbemanuallychecked.1)QuestionbasedonOptimalmergepatternproblemgivenlistofsortedfileswehavetofindoutnumberofcomparisonsinoptimalworstcase.2)46bitvirtualaddress,8gbram,pagesize8KB,Eachpageentrysize4bytes.Wehavetofindoutmin.numberofpagelevels(ans3)3)Givenanindexofanelement,Fromheapwehavetodeletethatelement,theyaskedtimecomplexityforthat4)Numberofcomparisonsrequiredinmergesorttomergensortedarrays5)Reversingeachwordinastring.Whatisthecomplexity?6)Thevaluesofa,b,canddliesbetween[1,12].Thereisanedgebetween(a,b)and(c,d),onlyifmod(ac)
-
CodingQuestions1) Findingthenoofconnectedcomponentsinagridbasedon4connectivity.
http://www.geeksforgeeks.org/findnumberofislands/1) Aknightisplacedonan8x8chessboardatpositionx,y.Whatistheprobabilitythatit
willstayinsidetheboardafternmoves.AptitudeQuestions
1) (AquestionbasedonBayestheorem)2) Offbyoneerroriswhichtypeoferrora)tb)Logicc)Executiond)Testing3) 100kgmilkwith99%waterisboiledtillithas98%water.Whatisitsmassnow?4) Microbeshavepotency,toxicity&growthvalues.Thesevaluesofdifferentmicrobesare
plottblechart.Findthemostdangerousmicrobe.5) (AquestiononpropertiesofNPcompleteness.)6) HTTPSuseswhichprotocolinthetransportlayer?7) BehaviourofagivenCsnippet(withmemset&strncat)8) P:Acollectionofsandgrainsisaheapofsandifnoofgrains>10000000.
Q:Removingasinglegrainfromaheapofsandstillgivesaheapofsand.P,Q=>Asinglegrainisaheapofsand.Whatistheproblemwiththisargument?
9) (dontremember..willaddlater)10)(dontremember..willaddlater)
Walmart@IITKGP(Developer)(30thNovember)10simpleMCQquestions.2codingquestion.TotalTimeduration:1Hr30minutesSTOD1)Startfromgrid(1,1).Youcanmoveinthefollowingmanner(x,x+y)or(x+y,y).Coordinateofdestinationnode(m,n)given.Printthesmallestno.ofmovestoreachdestination.Ifnotpossibleprint1.2.commaseparated3stringx,y,zaregiven.Ifxandyaresubsequencezandsumoflengthofalphabetsofx&yisequaltolengthofalphabetsofz,thenprintYESelseNO.example:HELLOWORLDHELLOWORLDYESSOSOAPSOAPNO
-
Samsung
SamsungIndia(R&D)@IITM,19thOctober2014Round1:60minsVerbal:20questionsif(text[k]=='s')Analytical:20questionsMath:20questionsTip:AttempttheMathpartfirstandVerbalthelast.ShortlistbasedonscoreinRound1Round2:Onlinecodinground1hrQuestionsweredifferentfordifferentpeople.Questionscollectedfromalimitedpoolofquestionsandjumbledforeveryone.3questionsforeachstudent.1questionfor8pointsand2for5pointseach.1.Givenazeroormoreoccurrencesofthedigit0.[5points]string,printthenumberofoccurrencesof1[0]*1where*denotesInput:10011abc10000001Output:32.Givenastrings1removealloccurrencesofthestrings2instrings1andalsoremovealloccurrencesofstrings2afterremovalofs2ins1andsoon..andreturnthestringobtainedaftersuchremovals.[5points]Example:s1="qwewerrty"s2="wer"Output:qty(Onthefirstremovalofweritbecomesqwerty.Onremovalagainnowqty.Nothingtoremovenow.)3.Questionhadsomerobotandstorybuildupbuttheessenceisthis:Youaregivenanmxngrid,where(0,0)referstopmostleftpositionand(m1,n1)thebottommostright.Thegridisfilledwithones.Allpositionsinthegridthatareblockedarefilledwithzeros.Youaregiventhisgridandareassuredthatthereexistsatleastonepathfrom(0,0)to(m1,n1).Findtheminimumdistanceofthepathfrom(0,0)to(m1,n1)giventhatyouareallowedtomoveonlyvertically,horizontallyanddiagonally.[8points]
4.Giventwolinkedlists,whereeachnodeofalistcontainstheexponentsandcoefficientsofapolynomial(indecreasingorderofexponents,zerocoefficientsdon'thavenodesassociated
-
withthem),performmultiplicationofthetwopolynomialsandreturnalinkedlistwiththeresult(conditionssimilartotheinputdecreasingorderofexponents,termswithzerocoefficientsshouldnotbepresentinthelinkedlist)[5points]5.Givenawordwithuniquelowercasecharacters,returnitsrankinadictionarythatconsistsonlyofwordsthatareanagramsofthegivenword.Eg:"take":6wordsstartwith'a',6with'e',6with'k',1with'tae',andfinally"take",soitsrankis6+6+6+1+1=20.[8points]2Rounds:CODENATION:2014IITD
-
continued2222
InMobi@IITK InMobi25TechnicalMCQs...25TechnicalMCQs2CodingQuestions:1.http://www.geeksforgeeks.org/maximumsumpathacrosstwo.../2. SuperKnightProblem:
GivenSizeofchessboardandsourceposition,destinationpositionandlenghtk.Findnumberofpathsfromsourcetodestinationingivenchessboardhavingexactlyklength.Knightsmovesaredefinedor2. An*nchessboardisgivenandaspecialplayerwhichcanmovelikekingandknight..
total16possibilities..initialandendingordinatesaregivenandnumberofmoves.Youhavetofindhowmanywaystoreachtotheendbyusingexactlygivennumberofmoves.
InMobi@IITRDate01/11/2014
-
Q1.EvaluatetheexpressionEwitheachoperationsurroundedbyroundbrackets.Eg.(4+((5*8)+556))and((20/5)5)Note:Therewontbeanysubexpressionwhichdoesnthavebracketssurroundingit.Alsothereinthisquestionthenumberofcasesinatestcasewasnotgiven,soyoullhavetoreadittillendoffill.Manystudentshaddifficultytofigurethatout.TrickSolution:Inpythonifyoutakethestringasthisasinputanduseprints,itllautomaticallyevaluateitforyou.AndforinputputreadstatementintryblockandcatchtheexceptionEOF.Q2.Thereareelectionsintown.Eachcandidatehasbeenvoted.A[1n]isthearraywhereA[i]denotesthenumberofvotesfortheithcandidate.ThisarrayA[]issortedindescendingorderwithtiesbrokenbyincreasingindices.Youcanincreasethevotesforanycandidateandalsoyouhaveadesirelistforthecandidate.Rank[1n]denotestherankofthecandidatethatyouwantthecandidatetobeinthatpositionwhere1denotesyoudontcareforhim.FindtheminimumnumberofvotesaddedbyyoutogettherankofthecandidatesasinRankarray.Eg.A[]={10,8,6,4,3} Rank={0,2,1,3,1}Ans3(Increase6to9)Eg.A[]={10,100,40,15,15} Rank[]={4,0,1,3,2}Ans1(tiebreakercase)
Nutanix@IITDQuestionsofNutanixinIITDwere1.Giveninorderandpreordertraversalofabinarytree,printthepostordertraversalofthetree.2.Amazewasgivenwithstartpointandanendpoint.Cellscouldbeeitheroftheform"."(canbevisited)or"*"(cannotbevisited).Findtheminimumcostrequiredtogofromstarttoend.Theremightbecellsmarkedwithuppercasealphabetsaswell(calledportals).Eachportalhasanentryanexitpoint.Wecanusetheportalstojumpfromonepositiontotheother.@.....#.
-
A..**[email protected]#
Nutanix@IITBHU2Questions75minutes
1. Giveninorderandpostordertraversalofabinarytree,printtheverticalordertraversalofthetree
2. ReadfromstdintillEOFandstorethewordswithallcapitallettersinatableindexedbythelengthofthestring.Printthetableinthegivenformat.Dontrepeatwords,forwordswithsamelengthprintinsameorderasininput.Separatorneednotbespace,itcanbeanynonalphabeticcharacter.
Loremipsumdolorsit/AMET,consecteturadipiscingelit,sedDOeiusmod
temporincididuntutlaboreetdoloremagnaALIQUA.Utenimadminim
veniam,QUISnostrudexercitationULLAMCOlaborisnisiutaliquipexea
-
output2:DO4:AMET,QUIS6:ALIQUA7:ULLAMCO
VISA@IITB
[email protected]+MCQ.75Minutes.
========
AssessmentComposition:
1.CodingSkills:2QuestionsVerysimpleproblems30markstotal
2.Programming:10QuestionsSimpleJavaQuestions
Accessmodifiers,inlinefunction,Redblacktree,heap
3.MachineLearningHadoopMCQ:6Questions
Youcan'tanswerasinglequestionifML/BigDataisremotelandforyou.
4.NetworkingMCQ:6Questions
Againbasics.Datalayerquestions.IPclassbasicquestion,fieldsinethernetheader.
5.OperatingSystem:6Questions
Memorymanagementmostly
6.Infrastructure:6Questions
Reallifescenariosserverclientquestions.
7.ApplicationSecurity:6Questions
TypicalNetworkSecurityquestions.DiffieHellman,c
EachMCQ1mark.Nonegativemarking.
Allthebest.
PoolOfQuestions:1.http://www.geeksforgeeks.org/largestsumcontiguoussubarray/
-
2.givenpreorder,inorder,calculatepostorder.^(Q9:Whendoesaplayerwin??????)
VISA@IITGNovember12,2014
OnlineCodingQuestions:Twoquestionsselectedfromapool.1. TheChefhastopreparemaximumnumberofdishesinthegiventime.
Input:TotaltimeT,numberofdishesonthemenu(sizeofthearrays)n,anarraycook[]wherecook[i]isthetimerequiredtopreparetheithdish,anarraywait[]whereabs(wait[x]wait[y])istheInput:N(0
-
7. Outputofthiscodesnippet#includeintmain(){
intnum[]={1,4,8,12,16}int*p=numint*q=num+2inti=*p++printf("%d%d%d\n",i,*p,*q)
}ans148
8. Output:
#includeintmain(){
inti=2+3,4>3,7printf(%d,i)return0}
anscompilationerrorCodingQuestions:1. 3numbersaregivenaslinkedlist.Eachnoderepresentsadigitofanumberstarting
fromleft.Addthethreeno.sandreturntheresultinalinkedlist.2. Sortalinkedlistcontainingzeros,onesandtwos.
(http://www.geeksforgeeks.org/sortalinkedlistof0s1sor2s/)@IITM(30.10.14)20MCQ,2Coding90minsPlatformHackerrankMCQs:Outputofcodesnippet,OS,DBMSbasics,Complexityestimation,basicdiscretemath.Gatetypequestions.(Maybethoseweregatequestions.I'mnotsure.)CodingQ1:PhoneKeypad=>Givenpresseddigits,printallpossiblestringsthatyoucangenerate.CodingQ2:EvaluateExpression=>4operatorsinorderofprecedence:(%,*,+,)associativityislefttoright.Ex:2+43%4*3=11
-
@IITKGP(03.11.14)20MCQ(negativemarkingisthere,allquestionsarebasedonOSTimeComplexitiesDS,Programming)+2CodingQuestionsoneonlyneedtowritefunctions1)gEX{a,b}length=Givensetofcharactersfindallpossiblestringswithlengthkusingsetofcharactersoutput:aaa,aab,aba,abb,baa,bab,bba,bbb2)LongestZigZagsubsequenceAsequenceofnumbersiscalledazigzagsequenceifthedifferencesbetweensuccessivenumbersstrictlyalternatebetweenpositiveandnegative.Thefirstdifference(ifoneexists)maybeeitherpositiveornegative.Asequencewithfewerthantwoelementsistriviallyazigzagsequence.Forexample,1,7,4,9,2,5isazigzagsequencebecausethedifferences(6,3,5,7,3)arealternatelypositiveandnegative.Incontrast,1,4,7,2,5and1,7,4,5,5arenotzigzagsequences,thefirstbecauseitsfirsttwodifferencesarepositiveandthesecondbecauseitslastdifferenceiszero.Givenasequenceofintegers,sequence,returnthelengthofthelongestsubsequenceofsequencethatisazigzagsequence.Asubsequenceisobtainedbydeletingsomenumberofelements(possiblyzero)fromtheoriginalsequence,0leavingtheremainingelementsintheiroriginalorder.ex:1,7,4,9,2,5output=6@IITG(04.11.14)20MCQ(negativemarkingisthere,allquestionsarebasedonOSTimeComplexitiesDS,Programming)Codingquestionswereextremelyeasy.1. http://www.geeksforgeeks.org/sortalinkedlistof0s1sor2s/2. Thefollowingquestionextendedtothreeinputs.
http://www.geeksforgeeks.org/sumoftwolinkedlists/
-
GoldmanSachs
@IITKGPsame@IITMsame@IITBsame@IITRsame@IITBHUsame@IITGsame@IITD@IITKsameObjective:75mins(10+10+5)qs1. 2dgraphwithNvertices,EedgesandFfaces(regionboundedby>3edgeswithno
edgecrossingacrossit).GivenNE+F=2foracertaingraphof10vertices,findmaximumnumberofedges
2. Splittheverticesofagraphintotwosets,witheachhavingequalprobabilityofgoingineitherset.Findexpectednumberofedgesconnectingthetwosets.
3. GivenamatrixA(2x2),findA^104. GivenAsatisfyingaproperty,doesithaverealeigenvalues.Therewere3suchAsand
theconstraintineachcasewas:1)A^2+I=02)(A3I)^2=03)A+I=05. GivenasetS={1,2,3,4,5,6,7,8,9},howmanyevensumsubsets6. Whatistheprobabilityofselecting10numberfromthesetoffirst18naturalnumbers
suchthatselectednumbersareconsecutiveincreasing7. Findamountofwatertrappedbetweenwalls.E.g:1213>1watertrappedbetween
1,2and2lengthbetween2,3Subjective:90mins(someonepleaseputanswers)1. Snakeandladdergameminimumnumberofmoves(3pagesweregiventowriteans)2. Verticalviewoftree3. Givenbinarytree,printpairofnodeswhoseswapmaketreeasbst4. t1
-
1. AmatrixisgivenwhereeachcellhasYorN.Yimpliesthereisgrassonit.Connectedcellsofgrassisfield(2cellsconnectediftheyshareanedge).Inafieldonlyonesheepcaneatgrass.Findnumberofwaysinwhichevensheepcaneat.(Note:0iseven,nC0+nC2+nC4+=2^n1,Usebfs/dfsandthisformulatoavoidtimeout)
2. Minimuminsertionsrequiredtoconvertstringtoplindrome.(Betterthann^2requiredforpassingalltestcase)
FacebookQuestionIITKGP
Hackerrank,1.30hrsOnlyonequestionwasasked!!!:DTwointegersn,karegivens.t.1http://code.hackerearth.com/f29854g
Citicorp@IITMProfile:BusinessAnalytics(Mumbai)Pen&Paper,50MinutesTherewere45DatasufficiencyQuestions.CitiCorp@IITKGP(Analystprofile):Writtentest,45minutes15Quant,5DI,5DataSufficiency,2casestudiescasestudy1wasonExpectedProbabilityIonlyrecallCasestudy2whichisarectanglehousewhoselength30feetandwidth15feet.Acowistiedtothecornerofhouseatadistanceof12feetwithalengthofrope21feet.grassisthereoutsidethehouse.Questionwasfindouttheareawhichisavailabletocowtoeatthegrass.
-
Ansitwouldconsistofthreeareas[3.14*21*21/2+3.14*9*9/4+3.14*3*3/4]=3.14*243nononoCitiGlobalDecisionManagementIITK:ExactlysameasKgp
UnBxd@IITR
Pen&PaperCoding:duration2hr1.Givenrand_10()functionwhichgeneratenumberbetween09,implementrand_100functionwhichgeneratenumberbetween0992.writeprogramtoevaluategiveninfixexpression3.givenatreehavingleft,right,randompointer(whichpointtoanyrandomnode)writelevelordertraversal(withoutanyextraspace)4.UaregivenarrayofNstringsoflengthLfindminimumlengthstringHwhichhaveKstrings(fromarrayofstrings).inputfirstlinecontainN,L,KnextNlinecontainNstring.
CitiCorp(ITanalyst)atatIITD:25CSquestionsin35mins(easy,includedgraphs,datastructures,sortingalgorithms)16Quantquestionsin16mins(veryeasy,mostlyincludingprofitanddiscount,timespeeddistance,calculations)LogicalReasoningquestionsdependedonwhatlanguageyouhadchosenforcoding.NotincludedinJAVAtest.Codingquestions(2outofthefollowing):1. givenanintmatrix,rotateitby90degreesleftorrightdependinguponflag
variable.2. givenanintmatrix,finditsgrammatrix.
-
3.
-
implementFIFOpagingtechnique,descriptionwasgiveninquestion4. implementNRUdo
-
ClearTaxMTS:IITGuwahati16questions(12objective+4programming)MCQs:relatingtoC/C++,Java,JavascriptoutputquestionsAlsosomebasicaptitudequestions.Programming:
1) Kdifferencepairsinanarray(arraycontainsalldistinctintegers)2) Givenaarrayofnumberseg:a=[2,3,4],andaintegerN,findthenumberof
numbersHwhicharenotmultiplesofofa[i]intherange1N.Thisproblemwasstatedinadifferentwayusinggrasshoppersleapingindistancesofj,eatingleavesj,2j,3j,....
3) Givenatreein(parent,child)pairformprintthesform4) Giventhenumberofcitiesandcompaniesalongwiththepopulationof
eachcity,minimizethemaximumnumberofpeopleworkinginacompany.Thereweretwoconstrains:Apersoncannottraveltoanothercitytowork,andeachcityhadatleastonecompany.
-
TEXASINSTRUMENTS(IITM)OnlinetestAptitude(almostsameasmostoftheothercompanieslikeIntelandQualcomm)+Technical(mostlyanalog)Interview(TheyaregenerallyonlyinterestedinAnalog)VerybasicRCquestionswereasked.SomeOpAmpandfeedbackquestionswerealsoasked.
1. Given1storderRCplotvoltageacrosscapacitorforstepinput.Whatisthetimeconstant.
2. Sameas1stquestionwithextracapacitorparallelwiththeresistor.3. Sameas2ndquestionwithextraresistorinseries/parallelwiththe
capacitor.4. Findnumberofpolesandzeroesgivenacircuit.5. Generalcharacteristicsoffeedbacknetwork.6. OpAmpbasics7. Explainanalogrelatedprojects(Dontmessthisup.Youaresupposedto
knowwhatallyoudidinyourproject)HRInterviewJustaformality.Butpleasedontmentionyourhigherstudyplans.