Maverickk's blog

By Maverickk, history, 9 years ago, In English

Alice and Bob are playing a game called "Stone Game". Stone game is a two-player game. Let N be the total number of stones. In each turn, a player can remove 1, 2 or 3 stones. The player who picks the last stone, loses. They follow the "Ladies First" norm. Hence Alice is always the one to make the first move. Your task is to find out whether Alice can win, if both play the game optimally.

I/P: 2 //testcases 1 3

O/P: No Yes

As I am just getting started in dp,I cannot think how I would build a table and store values.can anyone give me a hint?Thank You.

Full text and comments »

Tags dp
  • Vote: I like it
  • 0
  • Vote: I do not like it