Counter game, is a HackerRank problem from Bit Manipulation subdomain. In this post we will see how we can solve this challenge in Python

Problem Description

Louise and Richard have developed a numbers game. They pick a number and check to see if it is a power of . If it is, they divide it by . If not, they reduce it by the next lower number which is a power of . Whoever reduces the number to wins the game. Louise always starts.

Given an initial value, ....

You can find the full details of the problem Counter game at HackerRank

Solution: Please check the counter-game.py snippet for the solution.

This solution originally posted at: Github by @srgnk