Picking up stones | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Picking up stones

Two people (A & B) play this game. There is a pile of stones. A plays first, followed by B. They take turns picking up 2, 3 or 5 stones. If there is only 1 stone left, the person can pick it up. The person who picks up the last stone wins the game. Both players are experienced and play the best move available to them. Can anyone write a program which takes number of stones as input and prints who is the winner?

28th Feb 2018, 3:20 PM
Tejaswi Hegde
Tejaswi Hegde - avatar
3 Answers
+ 4
This can be a good assignment in the coding challenge. Please post this as a Assignment in lesson factory. https://www.sololearn.com/discuss/1082512/?ref=app
28th Feb 2018, 3:32 PM
Akash Pal
Akash Pal - avatar
+ 6
Thanks a lot and may the assignment gets published soon. Best of luck.
28th Feb 2018, 3:44 PM
Akash Pal
Akash Pal - avatar
+ 3
@Akash I have created the assignment. Thanks for the suggestion.
28th Feb 2018, 3:40 PM
Tejaswi Hegde
Tejaswi Hegde - avatar