samsamsamv2
BAN USER
Comments (3)
Reputation 0
Page:
1
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
0
of 0 vote
This is a greedy solution and I think it will fail for some case. Even I think K is irrelevant here. The question could have been phrased as upto L stones can be selected every turn. The challenge is to identify which player would win the game. In that case, consider N=2,L=2. Player 1 wins if he selects 2 stones and loses if he selects 1. In this way, either of the players can win so the answer should be both p1 and p2.
- samsamsamv2 September 11, 2017Comment hidden because of low score. Click to expand.
0
of 0 vote
A simple HashMap mapping string to integers should do it.
- samsamsamv2 September 11, 2017Page:
1
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
this is O(n^2)
- samsamsamv2 September 15, 2017