Intern Interview Questions
intern interview questions shared by candidates
Top Interview Questions
How to implement a queue simply using two stacks and how to implement a highly efficient queue using two stacks. Declare two stacks called in and out. queue.insert() calls in.push() queue.remove() if (out.notEmpty) out.pop() else { while(in.notEmpty) out.push(in.pop) } Don't get how this would be two questions. Because that is the simple implementation, pretty much the exact same answer I gave them, there apparently is a more efficient way of modelling it. Queue should implement FIFO. Let's have a group of task 1 -10 to be performed //declare two stacks Stack S1, S2; //feed stack S1 with the tasks 1 - 10 for(int i=1; i<=10;i++) { S1.push(i); } //Now S1 contains {10,9,8,7,6,5,4,3,2,1} where the top is 10 //Transfer all from S1 to S2 while(!S1.isEmpty()) { S2.push(S1.pop()); } //Now S2 contains {1,2,3,4,5,6,7,8,9,10} where the top is 1 You can now pop tasks from S2. Task 1 will be the first to pop and so on... Therefore, you just simulated FIFO using two stacks Show more responses One or more comments have been removed. |
The first three questions are mental math. I still remember the hardest one is calculating the 39% of 569 without any pen or paper. The next question is a simple probability: pick 2 cards from a set of poker without 2 Jokers, what is the probability that both cards are Ks. The last one is brain teaser: what is the angle between the minute hand and hour hand on a clock when 9:30. |
Calculating the max execution time of a program that had to fit into a certain size of memory on an embedded device. |
given a list of pairs (parent, child) navigate the list of pairs and fill the supplied data structure: class Entry{ String data; Set |
How much experience do you have with pre-production research? |
what kind of projects have you worked on |
Overall experience and Excel abilities. |
Behavioural questions about failures and challenges etc |
you and a friend are playing a coin tossing game. You will be tossing a coin and tracking the results. You each have a sequence you're looking for. Your sequence is HTT, your friends sequence is HHT. the player whos sequence appears first in the game wins. Would you want to play? What is your probability of winning? |
It was asked me to talk about my previous experiences |