SIT Placement NBSP Knowledgebase
SIT Placement NBSP Knowledgebase
Given a string B like 'qqwwett7' u have to write a code which will return a string A whose length is given by the number given at last. Like here u will return qqwwett. 3. 3. Given an array of integers 1 to N-1 where N is the array length. Two of the two ints in the array are set to 0. You have to write code to find these two numbers. 4. 4. Find if there is a loop in a linked list. It should be O(N) Written Test 2 1. Given a matrix of 0's and 1's. You have to find the maximum area of a rectangle containing only 1's. 2. Given a binary tree u have to find the diameter of the tree. i.e maximum distance between two nodes. Interview Questions: Round 1: 1. Given an array of integers which can be -ve, 0 or +ve. U are given a number S. You have to find two such integers x and y such that x+y=S. find the complexity. Code for constant time and another for constant space. 2. Given a min heap. Give an algorithm to find sorted linked list from this Heap. 1) You can destroy the contents of the nodes like rearrange them. 2) You cant modify the heap. 3) Answer should be time & space efficient. Round 2: 1. Given an array of integers with N number they can be -ve 0 or +ve. Only one of them is repeated. You have to find that number in constant space n time efficient manner. 2. Suppose these numbers in problem 1 are from 0 to N-1 then how you will do. 3. Write a code for binary tree in-order traversal without recursion..
Company : FAIR ISAAC Source : Ranjith Contains 20 quest ----some 1hr duration mostly from Aptitude and algorithms Quetions: 1 related to algo output of 1+F((m&(m-1)) recursive function 2 one is related to --a lady has 2 children- one is boy whats the probability of second ki woh boy ho --1/3 3 sorting on 3's and 9's in an array--O(n) 4 probability of 7.....(any 8 no. from 0 to 9).....7 ki yeh prime ho --->0 5 a equation is being given find value of P (a const)if roots are identical 6 question on a table which was given ( bahoot easy the you can do them easily) 7-->201 no's are there 99 are identical and come twice, and the one other no comes 3 times fastest algo to find the one no which is coming 3 times 8-->one question ( given 3 equations and asked what these are doing) is having ans---> swapping 9-->some probability questions. 10-->one puzzle in which --- A B C is standing C can see A & B , B can see A and A can't see any one. P came and put a cap on each of them from 3 black and 2 white caps.. find the colour of A's cap 11--> a matrix 4*4 and having 16 prime no how many magical matrix can be made from it. 12-->one probability qustion is having answer .95 < P >.9 -------------this is all i remembered hope this will help you enjoy........
Company : Microsoft Source : Nitin - Eliminate substrings from a string which are adjacent to each other and are duplicates. Like abcabc... abc is a substring which will be eliminated and the resultant will be abc. There may be any no. - Define a data struct for the search engine which will represent whether given word is there in the document or not is should be fast. Source: Ranjith
Use a queue of length n(each node contains 1 line). When u end print the queue - Print last n lines of a file in one pass, u cant go back in the file. You have one function that returns one line after other. U have to do in constant space. - Find max of n numbers without using comparison operator, any kind of comparison operator is not allowed. Every other operator is allowed. Round1
Round 2
Convert a number to base -2 representation. 5 horses can run at a time in a race and u can figure out which are the top 3,but can't note their individual timings. So the minimum number of races to find top 3 horses among 25 horses . Ans 7 evaluate a postfix expression. Soln- i did using stack. then he asked to check whether the user has given me a correct pattern (in postfix form) ...straight forward implement a queue using 2 stacks ... asked me to check wheter it worked in parallel environment .. i said no aksed to improve it for such env ... i said using shared memory ....
asked me questions on TCP 3 way handshake, some equation (i dont even know the name) ...etc etc ... couldnt ans much ... Round 3- propose DS for a T-9 dictionary(basically in a mobile device)... so an open ended prob . soln i proposed was making a tree with key values the number of the key and maintaining a linked list associated with each node ... - asked me some os stuff .... wat is paging ? .. thrashing ?? ... wat replacement policies ..etc - some network stuff... TCP stack ... diff b/w TCP & UDP ... window etc ... - which sorting algo to be used and when ? - gave me a puzzle to solve and for a big puzzle write the code ... Round 4 - once again an open ended prob .... given 10k docs each having some words (words are not much in number)... some articles/docs match ... given a document req to find the names of the docs with almost same words. - an array of N-1 numbers from to N-1 ..find the missing number in O(n) time ... no extra space available and the data bus is of 8 bits only(this is hint that u cant use summation) soln -- Xor the numbers !!! exam Questions:
remove all possible adjacent duplicates in a string. Ex: abbabcc --> ababc --->abc Time alloted:45 mins Having got the logic within 20 mins or so, i started writing the psuedo-code for it. you are given N documents(possibly in millions) with words in them. design datastructures such that the following scenarios take optimal time: a. print all the the docs having a given word b. print the docs having both of 2 given words Time alloted: 45 mins This seems no tough question.Used balanced binay search trees with words arranged according to lexicographic order and each node pointing to a list of sorted sequence of document ids.There could be others possible answers too.
one more exam. - represent a number is base (-2). ex:2 is 110 -2 square + -2 + 0 time alloted:30 mins first 20 mins of brain storming.I was getting tensed as the time was running out.Somehow got it by the end by looking at different examples. Ans: while(N!=0) { A[L++]=N%2; if(N<0 and odd) N=(1-N)/2 Else N=-N/2 } By the end, array A contains (-2) representaion of N in reverse order. - 25 horses are in a race.5 can compete at a time. We only know the order in which the horses win.I mean among the five, which came first,which one second...and so on.NOW, find the least no of races to find the top 3 fastest horses?( I sincerely advice to try this one your own before seeing the solution) Ans: 7 minimum 5 races to cover first round. take the top 3 of each race, say call ,them(1.1,1.2,1.3) (2.1,2.2.2.3)....(5.1,5.2,5.3) 6th race: (1.1,2.1,3,1,4.1,5.1) let us assume without any loss of generality, 1.1 2.1 3.1 are the top 3 in the race in that order.1.1 is overall FASTEST. 7th and final race: (1.2,1.3,2.1,2.2,3.1) top 2 among these are the 2nd and 3rd overall FASTEST.and we are done now.(Why this particular 5 tuple? Food for thought...think urself) 3 panels and technical rounds and no HR.isnt that great to hear abt? no HR..yeah. no more ansering to Qs like what is ur weakness? what are ur short-term goals?(What does any aam kgpain has other than bhat,movies, sleep and tolerating mess food..huh!) 3 panels in parellel and interviewing all the 10 at random one by one haphazardly. With every guy coming out of a panel room, we pounced on the poor guy coming out to know what they were asking. There was lot of waiting to do for all of us.Each panel took avg 30 mins per person. My experince with the panels:
panel 1: Only 1 guy.young, handsome and looked irritated.May be he had a bad day.Asked only one question in 40 minutes.Baap rey! - print last n lines from a file in a single pass optimally.size could be of any size.each line could be of any size.write proper working C code. A: use circular Queue of size n ,getchar and mallocs of 100 bytes extra weneve u need d extra space to store the line.(line cud be 100Bytes or 1Gb..).It took so much time as he wanted working C code and i was stuck with the 100 Bytes idea.it dinn click to me.He gave the idea after i asked him for a hint.Observe that we donot know before hand the size of any line of the file. panel 2: the guy kept on shooting Qs.Asked me where i was from? my passionate topics in CS? - what are semaphores(OS funda)? he gave an inorder traversal sequence from A to F and preorder traversal sequence of the same sequence and asked me to draw the unique binary tree.? - count the no of ones in a number in constant time(not even logN)? (For this i told him that i saw the code in the net but couldnt understand it.) it basically involved series of shift and or logical operations on N. - given 2 linked lists...one increasing order and other decreasing order, write code to merge them without extra space and constant time such that the merged list is increasing order? - 5 petrols pumps are located on a circular road. P[1...5] is petrol available at these pumps...and D[1...5] is distance between these pumps.Let the mileage be M Km/L.A person starts from one petrol pump with 0 fuel. He may not be able to complete the trip if he starts from some petrol pumps. Identify a petrol pump where he can start his tour so that he completes it, if it exists. Generalize and device a method for general N pumps. asked me whether i knew abt 3 color problem.I said yes.So he dinn ask the Question. At the end, he asked out of Qs asked above,how many i knew before.I had to tell a lie. actually it was 2.I told i knew only 1. Panel 3: The senior most guy and he put the most exciting Qs. He too asked how 2 count no of binary rep of N is constant time. .how 2 find the fibanaco number index i,where the fib Fib(i) no ends with 0000?the catch here is that the number is even bigger than what a double can represent. A. A little brain work and answer is not than tough.As we are only dealing with last 4 digits, only keep track of last 4 digits of any fib no. its f(n)=f(n-1)%10000+f(n-2)%10000 2nd Q: what abt the no with 9 0s at the end. A. use two integers one storing last 5 and other storing the 9th to 5th numbers.even fib no is now a tuple(a,b) where a*10000+b represnts last 9 digits of number. 3rd Q: find max of A,B,C without using if,while,<,> symbols.U can use standard math funtions if u want like sine,tan,log,+,-. A. for this i had to break my head for 15 mins.No sol yet.I asked him for a hint. He laughed and said to try harder. then the bulb in my brain grew bright and i said. x=MAX(A,B)= ((A+B)+(modulus(A-B))/2 similarly, find max of x and C
Company : Oracle Source : Alok Here are some of the questions/Important points for oracle interview......... thought it might help you... 1. CV is a MUST 2. Be very careful while entering subjects/projects in the CV. The interview mostly consists of questions based on the subjects/projects you write in CV 3. They ARE asking puzzles. Though the puzzles are simple. 4. Some of the puzzles they asked me were: a. you have nine points. Join them with four lines: soln: o ------- o -------- o-------|\ / | \ / | \ / | \ o o o | \ / | \/ | / \ o o o | / | / |/ b. You are given three bags with fruits having labels "apple" "oranges" and " apples & oranges" . The labels are DEFINITELY false. Can you pick just one fruit from only one bag and tell correct answer. soln: Pick a fruit from the bag labelled "apples and oranges" c. Out of eight balls one is heavier. you can weigh only twice. find the heavier ball. Source : Nitin Last round program input: <file name> <word> file contains the correct words and the <word> is a not correct word
because of some typo error. find all the closest word from the file. they have not defined the closest (they were a bit confused about it) but the result should be closest. example given was APLE APPLES CPPLE BPPLE APPLES APPLED is closest to APPLE. 1. define 2 problems that you find most interesting and how will you solve them give answer also. 2. treverse the Binary tree and print the nodes with indentation depends on level of the node.(more the level more will be the space from left) 3. convert a Binary tree into Doublely link list. 4. 4 ants at the corners of the square what is the probability that they will not collide 1/8.
Company: IBM Source: Dhaval IBM interview Asked About 1. Abt Paper How it is and how u did? I told it is easy and not related to any thinking oriented question. 2. Have u taken Cluster and Grid?... Yes.// 3. Serious Question : It seems that either u or some one have copoied..... answer sheet.... this makes me nerve and i feel bad. I didn't answer any thing after that,. Stress Question: It was a serious question from his side. But really I was cool at that time.. but 4. Question printf("%d %d",sizeof("1"),sizeof(1)); What is output ? and why? At Last when pradipta didnt ask me any thing except above question and told me to go, I hesitated
Company: Google Source: Ranjith - Find the number of ways of selecting k items from total of n such that no consecutive items are selected. O(nk) in time O(n) in space. - write code for finding nth element in inorder traversal - There was one more algorithm on arrays which I dont exactly remember now. It dealt with row and column multiplication. - A few questions on fields because my project involved some of it.Ex.why does field exist for primes and not for compsites of two primes. - Given a coin in which head has probability of .33 and tail .66 find a fair trial.You can do anething u like. - Given an integer grid with lattice points from (0,0) to (n,n), find the no. of paths from (0,0) to (n,n), using only right and up steps. Find the closed form solution. - How to randomly permute (uniform) a very large sequence of elements (say 40GB) - Find the recurrance for choosing r elements out of n, such that no two elements are consecutive. Write a program for this and find space, time complexity. (ans: space complexity is O(3n)=O(n)) - Code to get the kth node in an inorder traversal of a binary tree. - Find the maximum sum subsequence in an array. - If data is coming infinitely and you can store only k elements. Design a method such that probability of any element which has appeared till that time of being in the array is the same. - Write C code for doing BFS on a nary tree. Suggest efficient Data structure you will use - Polygon Triangulation - Find the set of non-intersecting chords which will break a polygon down into triangles. Find the triangulation of minimum total perimeter of triangles. - Break a number down into any number of parts which sum up to that number and whose product is maximum. - In a singly linked list, exchange the odd and even nodes. - In a DAG, print the maximal paths. - In a hundred floor building, there is a threshold floor value(say 26). If you throw an egg from >= 27th floor, it will break but will remain intact <=26 floors. You have 2 eggs. Find the worst-case minimum number of drops you would have to make to find the threshold value. You can re-use an egg in case it doesn't break. (ans 14) - When we find the minimum value in an array by replacing the 'min' variable. Find the expected number of times you would have to replace in an array containing N random integers. (ans ln N) - Synchronization mechanisms in Operating Systems.
COMPANY:VERIZON Source : Amit Kumar Mandal Written Test: The test was about 1hr 15 min long. The test have few separate parts, Each part have its time limit., 1. English and Reading Comprehension In English section some sentences were given with some fill in the blanks, you have to fill up the preposition s in those blanks. Reading Comprehension was purely technical passages, If you want to solve all the questions in this section you should not waste time in reading the passages, because you can easily guess the answer by looking at the options of each question. 2. Mental Ability: 3. C and C++ Test 4. Verbal Ability I exactly dont remember the questions Exactly, But I was quite similar with the Question Paper mentioned in the following site, http://www.freshersworld.com/papers/verizon/verizon1.htm http://www.freshersworld.com/papers/verizon/verizon2.htm
Interview : There are two round of interviews: First Round: Initially they asked howz IIT kharagpur, and HOWz ur life going on in IIT. Then he asked only one Q which is as follows: Suppose your Boss have discussed with you one problem and asked you to solve it. You have to write a email to your boss stating the problem properly and a proper technical reason why the problem is not feasible? Second Round : Its a HR interview, It was very cool. Qs are as follows: 1. 2. 3. 4. 5. 6. Tell me about yourself and ur family. Do you have any problem relocating in Chennai. Do you have any wrong feeling about the Tamil peoples. What are the qualities that make you different from others. Have you taken part in any Competitions in IIT like in ksithij etc. etc. Any Questions you have.