Skip to content

Latest commit

 

History

History
31 lines (24 loc) · 2.27 KB

Problem Solving.md

File metadata and controls

31 lines (24 loc) · 2.27 KB

Problem Solving - Interview Questions

Q1. Why are manhole covers round?

ANS: They're not. Some manhole covers are square.

Q2. I mean, why are there round ones at all? Is there some particular value to having round ones?

ANS: Yes. Round covers are used when the hole they are covering up is also rounded. It's simplest to cover a round hole with a round cover. Also the rounded covers will not fall into round hole.

Q3. There are three switches in one room and one light bulb in another. How can you tell which switch controls the bulb if you can only make one trip from the switch room to the bulb room?

ANS:

  • Set switch #1 to the on position and switches #2 and #3 to the off position.
  • Wait ten minutes.
  • Turn switch #1 off and switch #2 on.
  • Enter the room and examine the bulb. If the bulb is on, then it’s controlled by switch #2. If the bulb is off and warm or hot, then it’s controlled by switch #1 (because it was recently left on for ten minutes which caused it heat up). If the bulb is off and room temperature, then, by process of elimination, it must be controlled by switch #3.

Q4. If a plane crashes right on the border of the US and Canada, in which country would you bury the survivors?

ANS: Survivors don’t die so they don’t get buried

Q5. You have four people (A, B, C & D) who have to cross a bridge. One or two can cross at once and they travel at the speed of the slower person. There's one flashlight which is needed to cross the bridge. A takes one minute, B takes two minutes, C takes five minutes and D takes ten minutes to cross. How do you get all of the people across in 17 minutes?

ANS:

  • A,B goes time consumed 2 minute
  • A Came back time consumed 1 minute
  • C,D goes time consumed 10 minute
  • B came back time consumed 2 minute
  • A,B goes time consumed 2 minute

Q6. What will be angle of the hands of a clock at 3:15?

ANS: 12 hours on the clock make 360 deg. so one hour is 30 deg. the hour hand will be directly on the 3 when the minute hand is at 12 (3:00). After 15 minutes or 1/4 of an hour, the hour hand will be 1/4 * 30 deg = 7.5 deg. away from the minute hand.

Q7. What is the difference between Binary Tree and Binary Search Tree?

ANS: Binary tree where each node up to two leaves. In Binary Search Tree nodes are arranged in order.