Showing posts with label questions. Show all posts
Showing posts with label questions. Show all posts

Sunday, February 15, 2015

I cried but it was late

I didn't cry on my wedding day.. I didn't, not during getting ready, not during walking to the stage, not during jaimala, not during phere, not during kanyadaan and not during vidaai. I didn't. What to do ? But I cried as soon as I sat inside the vidaai car, as soon as all the crying faces were behind me, I broke down but that is not recorded in the wedding video. It was considered late and I am now termed as an unemotional person for the rest of my life. I can't go back to them and tell them that I did cry for them!! And I cried even more on the first Diwali after marriage, when I was not home with my parents. I think that's when it actually hit me that I have a changed identity and that I have actually changed homes. But I can't go back to them and tell them that I did cry!!

Wednesday, May 11, 2011

Technical Interview Questions I

I have close to only 1.5 years experience as a Software Engineer (2 companies) and I have appeared for quite a few technical interviews! These 2 firms have been really rigorous and multiple attempts have made my question-bank grow well. Here are some of the questions I was asked -

1. You have 100 balls, out of which 1 is defective (heavier or lighter, you don't know). You have 1 scale (2 pans) and you can use it only once. So in just 1 weigh, identify a good (non-defective) ball.

2. You are given a N*M matrix. Starting from the top left cell, you have to reach the bottom-right cell, 1 cell at a time. You can only move right or bottom. In how many ways can you do this ?

3. There is a staircase with n steps. A boy can climb 1 step at a time, or 2 steps at a time, or 3 steps at a time...... or k steps at a time. In how many ways can he climb the staircase ?
Example (5 stairs, k = 3): {1,1,1,1,1}, {3,1,1}, {2,3},{1,3,1}... and so on.

4. Given an array, generate a random permutation and prove that it is random.

5. How many rectangles are there on a chess board ?

6. Given a set {1,2,3,4,....n}, write code to generate all subsets.

7. A needle (length l) drops on a page which has parallel lines drawn on that. Line spacing is s. The needle makes angle theta with the lines. What is the probability that the needle does not touch the lines ?

8. There are 2 linked lists that intersect at a point. How will you find the point of intersection ? (You can visit each node twice)

9. There is a beaker full of H2SO4 (100% conc). Now water is being poured in the beaker at the rate of r/sec. At the same time, the contents of the beaker are leaking at the rate of r/sec. In how much time, will the concentration of H2SO4 in the beaker become half ?

10. (a) Implement a queue using 2 stacks. (b) Design a data structure in which push(), pop() and max() functions are all O(1).