Gabbar and his Sambha are fond of playing number games. But as usual, if Sambha loses the game, he dies. Gabbar and Sambha take their turn to call out a number between 1 to n. They follow the following rules while playing the game:
- Anyone of them can start the game by calling a number between 1 to 10.
- The person who’s chance in next, should must call a number by increasing the last number by 1 to 10, both inclusive.
Whosoever, from Gabbar and Sambha calls out “101” first wins. Sambha tries to win this game, as it’s the run for his life. Can you help him by providing the right strategy to win the game?
Solution :Sambha wants to call 101 first. He can do this if Gabbar calls any integer between 91 and 100 (both included), which will happen if he calls 90. He can go ahead, if Gabbar calls any integer between 80 and 89 (both included), which will happen if he calls 79. If he goes on like this, he would find out that he should call 101, 90 (=101-11), 79 (=90-11), 68 (=79-11), ….., 2.
Reverse, start with 2, let say that Gabbar calls the least one ahead, i.e. 3, then, 13, 14, 24, 25, 35, 36, 46, 47, 57, 58, 68, 69, 79, 90, 91, 101 are called by them alternatively. If incremented by 10 each time, then 101-2 falls at odd factor of 10 and Sambha starting at the odd turn will finish it at odd turn. By the above two explanations you can say that the right strategy to save his life ; he should start the game by calling 2.
This puzzle is contributed by Praveer Satyam. Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses
are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!