Re:HackerRank aims to build a fun place for programmers to h...
by jaredsohn on Friday June 29, 2012 @04:11PM
(#4178803)
>No idea how people are winning 20+ games.
I won over 20 games by just spending a few minutes manually running the algorithm described elsewhere here and I imagine anyone who hasn't won hundreds or thousands of games probably did the same. (If you're going to write a bot, might as well let it run for awhile and see if you can max out the leaderboard.)
Re:HackerRank aims to build a fun place for programmers to h...
by learc83 on Friday June 29, 2012 @04:16PM
(#4178826)
All you have to do is hand the computer a number that is divisible by 6 each time.
If you start with 61 pick one and the computer has 60, say it picks 4 and you have 56 pick 2 so you hand it 54. Repeat until you win.
A few observations:
- If you start <= 6, you will always lose, since you have to choose 1 less than the starting number.
- Whoever gets 6 on their turn will always lose.
- If you start between 7 and 11, you'll always win.
- If you start at 12 or higher, you'll usually lose, since the computer will try to get you to 6.
Still fun for a few minutes atleast. No idea how people are winning 20+ games.