Skip to content

Commit 8a4b97d

Browse files
add 1025
1 parent b3eb2c4 commit 8a4b97d

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ _If you like this project, please leave me a star._ ★
384384
|1033|[Moving Stones Until Consecutive](https://leetcode.com/problems/moving-stones-until-consecutive/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1033.java) | |Easy|Math|
385385
|1030|[Matrix Cells in Distance Order](https://leetcode.com/problems/matrix-cells-in-distance-order/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1030.java) | |Easy|
386386
|1029|[Two City Scheduling](https://leetcode.com/problems/two-city-scheduling/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1029.java) | |Easy|
387-
|1025|[Divisor Game](https://leetcode.com/problems/divisor-game/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1025.java) | |Easy|
387+
|1025|[Divisor Game](https://leetcode.com/problems/divisor-game/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1025.java) | |Easy|Math, DP, Brainteaser, Game Theory|
388388
|1022|[Sum of Root To Leaf Binary Numbers](https://leetcode.com/problems/sum-of-root-to-leaf-binary-numbers/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1022.java) | |Easy|
389389
|1021|[Remove Outermost Parentheses](https://leetcode.com/problems/remove-outermost-parentheses/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1021.java) | |Easy|
390390
|1020|[Number of Enclaves](https://leetcode.com/problems/number-of-enclaves/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1020.java) | |Medium|Graph, DFS, BFS, recursion|

src/main/java/com/fishercoder/solutions/_1025.java

+7-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,14 @@
22

33
public class _1025 {
44
public static class Solution1 {
5+
/**
6+
* After writing out a few examples, beginning from n = 1, up to n = 5, the logic flows out naturally:
7+
* 1. when N deduced to 1, whoever plays now loses because no integers exist between 0 and 1;
8+
* 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;
9+
* 3. all numbers N will eventually be deduced to either 1 or 2 depending on whether its odd or even.
10+
*/
511
public boolean divisorGame(int N) {
6-
//TODO: implement it
7-
return false;
12+
return N % 2 == 0;
813
}
914
}
1015
}

0 commit comments

Comments
 (0)