# Problem solving Interview Questions

interview questions shared by candidates

## Problem solving Interview Questions

How many tennis balls are in this room and why? There is no correct answer to this question. It's all based on your problem solving abilities. The method for "solving" this involves making assumptions and then calculating an answer. The assumptions could be wrong, which isn't as important, and the interviewer will likely help guide your assumptions if they felt it was necessary. The assumptions here would be about the approximate size of a tennis ball, the approximate volume of the room, etc. Getting fancy, you might begin discussing how the weight of the tennis balls would begin compressing the lower levels, giving more potential room at the top, as well as how the second level of tennis balls would rest in a lattice structure on the first level, sitting in the gaps, and thus not being as high as simply multiplying the diameter of the tennis ball by 2 to get the height of two layers. I agree with both prior posts. An interviewer asking this question is trying to determine your problem solving skils. The worst thing you could do is blurt out an actual number without explaining your thought process. I'm not sure the interviewer is as interested in the quantity as much as how you arrive at it. The worst answer "Wow, I have no idea". Show More Responses |

Most of them were expected. Almost all are problem solving questions. 1. Given a BST with following property find the LCA of two given nodes. Property : All children has information about their parents but the parents do not have information about their children nodes. Constraint - no additional space can be used |

You are a parking lot attendant in a lot that has one open spot, and you want to move the cars from their original positions into a new arrangement. Create a program that will print out instructions on how to move the cars most efficiently. |

I have a log that consists of more than 100 million lines. Each line is just a data about user login, login time, etc. I want to sort them based on user login, and then if there is a tie based on login time, etc. However, I have limited memory, so don't think of storing all of them in an array. The memory can only hold n data where n is much smaller than 100 millions. You can access the disk though although it is much slower. How will you do it so that it is as efficient as possible? |

Please write a function that accepts a floating number and returns its square-root. You may not use built-in square root function from your language. However, basic operators like addition, subtraction, multiplication are allowed. Please take into consideration the floating precision. |

One of the software engineers asked me the question about the colored chameleons bonking into each other question. Basically, there are 15 red, 17 green, and 19 blue chameleons on a desert island. Whenever two chameleons of different colors collide, they both become chameleons of the third color. Can it ever be that all the chameleons on the island are the same color? |

You have 25 horses, and you want to know which are the top 3 fastest, but you don't have a stopwatch. You can race the horses, but the track is only big enough to fit 5 horses at a time. How do you find the first, second and third fastest horses using the least amount of races possible? |

Problem Solving #2 - You have 3 light switches and 1 light bulb controlled by only 1 switch in a room you can't see into. You can flip any or as many switches as you want and can check the room once. The next time you go into the room, you have to know for sure which switch controls the light bulb. |

Problem Solving #1 - Given a 5 gallon bucket and a 3 gallon bucket with no measures. Measure exactly 4 gallons. |

If you had 9 marbles, all the same size. One is heavier than the rest. You have a balance scale. How do you determine the heavy marble in the least number of moves. |

**1**–

**10**of

**100**Interview Questions