File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed
src/main/java/com/fishercoder/solutions Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change 13
13
14
14
public class _292 {
15
15
16
- /**1. If there are only 1 or 2 or 3 stones, you could always win by taking 1 or 2 or 3 stones;
17
- * 2. If there are 4 stones, you could never win because no matter you tak 1 or 2 or 3 stones, you could never take the 4th one;
18
- * 3. If there are 5 or 6 or 7 stones, you could always win because no matter how your opponent works, you'll always get the last one;
19
- * 4. Then we could deduce that as long as the number is not divisible by 4, you could always win.*/
16
+ public static class Solution1 {
17
+ /**
18
+ * 1. If there are only 1 or 2 or 3 stones, you could always win by taking 1 or 2 or 3 stones;
19
+ * 2. If there are 4 stones, you could never win because no matter you tak 1 or 2 or 3 stones, you could never take the 4th one;
20
+ * 3. If there are 5 or 6 or 7 stones, you could always win because no matter how your opponent works, you'll always get the last one;
21
+ * 4. Then we could deduce that as long as the number is not divisible by 4, you could always win.
22
+ */
20
23
21
- public boolean canWinNim (int n ) {
22
- return n % 4 != 0 ;
24
+ public boolean canWinNim (int n ) {
25
+ return n % 4 != 0 ;
26
+ }
23
27
}
24
-
25
28
}
You can’t perform that action at this time.
0 commit comments