Sunday, July 4, 2010

Amoeba population

A jar begins with one amoeba.Every minute , every amoeba turns into  0 ,1,2 or 3 with 25% probability for each case (dies, does nothing,splits into 2 , splits into 3).What is the probability that amoeba population eventually dies out?

Saturday, March 20, 2010

Interview Questions: Flipkart

Flipkart Interview Questions

1) Linked List reversal , without using any extra memory. (Code Insertion)

2) M 0's N 1's M>N. No. of possible permutations of String of length M+N.

3) Count no of characters/words/lines in a file. Given file handle definition.

4) Merge two trees into a new tree.
Example: (1,(2,null))and (1,(null,3)) results in (1,(2,3))
(1,(2,null))and (1,(3,null)) results in null (Not a valid operation)

5) Consider linked list {1,2,3,4,5,6}
return {2,1,4,3,6,5}. Write a function that does this without using any extra memory.

6) func(){
fork();
fork();
fork();
print("Saikacollection\n");
}
Output = ?

7) Suppose process process p1 creates a child process p2. If p1 gets killed then what happens to p2?

8) Output?
sum = 0;
for(int i = 0;i<12;i++){ j =" i+1;j<10;j++){" k =" j+1;k">8;k++){
sum++;
}
}
}
printf("%d",sum);

9) Monty Hall Problem Card variant.


10) Simple probability question. 6 Organges and 4 Apples. prob of Picking two oranges?


Thanks to chirag for this post.

Thursday, February 25, 2010

Hungry Elephant


This one is easy and most famous puzzle.
But I have a doubt here which I would post later after getting answers .

There are 2 cities A and B, distance between them is 1000 Km.
we have 3000 bananas in city A and a elephant
can carry max 1000 bananas at any given time and it needs to eat a banana every 1 Km.

How Many Max. No. of bananas you can transfer to city B ?.

Wednesday, February 24, 2010

Boat and Dock


You are Sitting in a small boat holding the end of a rope.The other end of the rope is tied to the top of
a nearby pier (See figure) , such that the it is higher above the water than your end of the rope,Causing your boat to move towards the pier,stopping directly underneath the pier.As you pull on the rope, which is moving faster :boat or the rope?
i.e the speed of the boat moves across the water or the speed the rope moves through your hands.

Looks like difficult one but not exactly.

Tuesday, February 23, 2010

PJ Puzzle


In which direction is the bus moving?
Right or Left?

Monday, February 22, 2010

Blind Man and Cards


A blind man is handed a deck of 52 cards and told that exactly 10 of these cards are facing up. How can he divide the cards into two piles, not necessarily of equal size, with each pile having the same number of cards facing up?

Sunday, February 21, 2010

Adobe Interview Round2

Only 2 questions where asked.
we had to write complete algorithm for them.

1) int a[]= {1,1,1,2,2,3,3,3,3,4,5};
o/p shud be 1,3,2,2,3,4,4,1,5,1

i.e 1 followed by how many times 1 is repeated.

2) a ={1,1,1,2,2,3,3,3,4,4,5};
b={1,2,2,3,6};

o/p c = {6,5,4,3,2,1};