24 May 2020

A puzzle from my nephews in Kolkata

Reeling under the lack of power, water supply and all that the devastating cyclone Amphan left behind, apparently my nephews hunkered down and started doing puzzles. They could not wait for power to come back – so that they could recharge their phones and send me this problem thru Whatsapp.

Good problem. About 2 years back, I had posted a similar version of the problem.

Posted May 24, 2020 by Rajib Roy in category "Puzzles


  1. By Santosh on

    This has been doing the rounds on WhatsApp groups. I got lazy and wrote a simple Java program for it. It satisfies the condition of working for any ‘n’ but is hit and trial

  2. By Rajib Roy (Post author) on

    Santosh, I assume you just iterated till the last person was left. That would be a O(n) algorithm, right? This can be solved in programming with O(1) algorithm.

  3. By Santosh on

    Yes. With constant time it’s just math on paper no need for computer. Your solution is elegant

    1. By Rajib Roy (Post author) on

      Exactly. Glad you liked the problem. I will post some more soon. (My nephews are feeding me with lots of them).


Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.