Quant, Math & Computer Science Puzzles for Interview Preparation & Brain Teasing
A collection of ~225 Puzzles with Solutions (classified by difficulty and topic)

Feb 5, 2013

Broken Clock Puzzle

Source: http://www.ocf.berkeley.edu/~wwu/riddles/medium.shtml

My fancy new digital alarm clock is broken! The time 'jumps' around.

When I reset it, it reads 12:00:00. Then it runs as it should, but after 12:04:15 it resets back to 12:00:00. It counts up to 12:04:15 again and then it jumps to ... 12:08:32 ! Weird stuff.

Do you know what's wrong with my alarm clock?

Update (12/02/2013)
Solution posted by Saumya Gupta, Abhimanyu Dhamija (CSE IITB 2011 Alumnus, Citibank Analyst) and Naga Vamsi Krishna in comments!


  1. I don't know much about alarm clocks, but I am guessing that this is how a clock would store time, as this is what computers do:
    It uses 17 bits (or maybe less, if it's a 12-hour clock instead of a 24-hour) to store the number of seconds that have passed since 12:00:00. So, 00000000000000101 means 5 seconds has passed since 12:00:00, and the time is 12:00:05.
    Your clock records time correctly upto 255 (=2^8 - 1) seconds, then resets to zero, and starts reading correctly after 512 (=2^9) seconds. So the 9th bit from right is at fault.
    It reads correctly upto 00000000011111111 (=255), then as 1 second passes, it should store 00000000100000000, but since the 9th bit is not working, it reads 00000000000000000, hence it reads as 12:00:00. But when 512 seconds pass, it stores 00000001000000000, (the 9th bit is 0 again), so shows the correct time.

  2. 04 minutes 15 seconds is 255 Seconds.
    So, rather than a 16-bit structure, the programmer of the clock has erroneously used an 8-bit structure?

  3. 4min15sec is 255sec. which is 2^16 - 1 . something related to a 16bit counter?

  4. You all guessed it right. The 9th bit of the clock is not working. Thanks