Browsing the archives for the numbers tag

The Fox and The Duck

Tweet Question: A duck that is being chased by a fox saves itself by sitting at the center of circular pond of radius r. The duck can fly from land but cannot fly from the water. Furthermore, the fox cannot swim. The fox is four times faster than the duck. Assuming that the duck and […]

2 Comments

Tunnel Trouble

Tweet Question: A man needs to go through a train tunnel to reach the other side. He starts running through the tunnel in an effort to reach his destination as soon as possible. When he is 1/4th of the way through the tunnel, he hears the train whistle behind him. Assuming the tunnel is not […]

Chess Squares

Tweet Question: How many squares are on a chess board? Answer: If you thought the answer was 64, think again! How about all the squares that are formed by combining smaller squares on the chess board (2×2, 3×3, 4×4 squares and so on)? A 1×1 square can be placed on the chess board in 8 […]

2 Comments

How Strong is an Egg?

Tweet Question: You have two identical eggs. Standing in front of a 100 floor building, you wonder what is the maximum number of floors from which the egg can be dropped without breaking it. What is the minimum number of tries needed to find out the solution? Answer: The easiest way to do this would […]

81 Comments

Sub-Array with the Largest Sum

Tweet Question: You are given an array with integers (both positive and negative) in any random order. Find the sub-array with the largest sum. Answer: This is an all-time favorite software interview question. The best way to solve this puzzle is to use Kadane’s algorithm which runs in O(n) time. The idea is to keep […]

How Old Are My Children?

Tweet Question: Two old friends, Jack and Bill, meet after a long time. Jack: Hey, how are you man? Bill: Not bad, got married and I have three kids now. Jack: That’s awesome. How old are they? Bill: The product of their ages is 72 and the sum of their ages is the same as […]

22 Comments

Trailing Zeros in 100 Factorial

Tweet Question: How many¬†zeros¬†are there in 100! (100 factorial)? Answer: For those who don’t know what factorial is, 100! = 100 * 99 * 98 * … * 2 * 1 Ok, let’s look at how trailing zeros are formed in the first place. A trailing zero is formed when a multiple of 5 is […]

0 Comments