- Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Copy path_1025.java
15 lines (14 loc) · 684 Bytes
/
_1025.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
packagecom.fishercoder.solutions.secondthousand;
publicclass_1025 {
publicstaticclassSolution1 {
/*
* After writing out a few examples, beginning from n = 1, up to n = 5, the logic flows out naturally:
* 1. when N deduced to 1, whoever plays now loses because no integers exist between 0 and 1;
* 2. when N deduced to 2, whoever plays now wins because he/she will pick one and the next player is left with nothing to play;
* 3. all numbers N will eventually be deduced to either 1 or 2 depending on whether its odd or even.
*/
publicbooleandivisorGame(intN) {
returnN % 2 == 0;
}
}
}