Skip to content

Brainteasers

  1. How many degrees angle between hour, minute hand when time is 3:15?
    7.5°
    360° full circle, therfore (360°/12 hrs) = 30° /hour.
    At 3:15,  minutes hand points to the 3, hour hand is ahead of 3 by 1/4th (15/60),  which is 7.5° apart. (30°/4)=7.5°
  2. Why are manhole covers round?
    – Round covers can be easily rotated
    – It’s easier to dig a circular hole
    – Round castings are easier to machine using a lathe
    – Easier to manufacture than custom-made covers
  3. How will you generate random number between two given numbers
    Assuming n1, n2 random number between them would be n1 + Math.random() * (n2 – n1)
  4. How will you sort a million integers?
    Split them into meaningful subsets, sort each subset, merge subset back
    http://neopythonic.blogspot.com/2008/10/sorting-million-32-bit-integers-in-2mb.html
  5. How many windows will be open in a 100 window room if you go around  a 100 times toggling each window you come across? All windows are closed initially.
    100 windows,  all closed.
    1st round, you toggle all windows i.e. all windows are opened
    2nd round, you close all even-numbered windows – 2, 4, 6, …
    3rd round, you open, close odd numbered winodws – 3, 6, 9,…
    So after 100 times, windows open are windows who have been toggled odd number of times. For e.g. consider window 12, round 1 will make it open, 2 will make it closed, 3 will make it open, 4 closed, then directly 12 will make it open. Consider again, window 20 – 1 (open), 2 (close), 4 (open), 5 (close), 10 (open), 20 (close). Consider 7 – 1 (open), 7 (close). So window 12 got touched 5 times, window 20 got touched 6 times, window 7 touched 2 times.
    So, in order to find “open” windows between 1-100, we have to find number having “odd” number of factors, which means numbers who have one repeated factor i.e.  factor by same factor gives the number e.g. 16 has 1, 2, 4, 8, 16 – open window. It has 4 which means 4×4= 16. Consider 20 has 1, 2, 4, 5, 10, 20. No factor is repetitive.
    Therefore, let us find numbers which are below 100, but are having square products, similar to 4×4 = 16 starting with 1, which gives 12=1, 22=4, 32=9, 42=16, 52=25, 62=36, 72=49, 82=64, 92=81, 102=100
    So open windows are 1, 4, 9, 16, 25, 36, 49, 64, 81, 100 = 1o open windows
  6. A party of four travelers comes to a rickety bridge at night. The bridge can hold the weight of at most two of the travelers at a time, and it cannot be crossed without using a flashlight. The travelers have one flashlight among them. Each traveler walks at a different speed: The first can cross the bridge in 1 minute, the second in 2 minutes, the third in 5 minutes, and the fourth takes 10 minutes to cross the bridge. If two travelers cross together, they walk at the speed of the slower traveler. What is the least amount of time in which all the travelers can cross from one side of the bridge to the other?
    Obvious (but incorrect)
    Incorrect answer

    Not  so obvious (correct answer)
    Correct answer

  7. Next…

A party of four travelers comes to a rickety bridge at night. The bridge can hold the weight of at most two of the travelers at a time, and it cannot be crossed without using a flashlight. The travelers have one flashlight among them. Each traveler walks at a different speed: The first can cross the bridge in 1 minute, the second in 2 minutes, the third in 5 minutes, and the fourth takes 10 minutes to cross the bridge. If two travelers cross together, they walk at the speed of the slower traveler.

What is the least amount of time in which all the travelers can cross from one side of the bridge to the other?

Leave a Reply

Your email address will not be published. Required fields are marked *

16 − thirteen =