Skip to content

Commit e754d6d

Browse files
add skeleton for 1025
1 parent 017b6e4 commit e754d6d

File tree

3 files changed

+57
-0
lines changed

3 files changed

+57
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ _If you like this project, please leave me a star._ ★
8686
|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|
8787
|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|
8888
|1029|[Two City Scheduling](https://leetcode.com/problems/two-city-scheduling/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1029.java) | |Easy|
89+
|1025|[Divisor Game](https://leetcode.com/problems/divisor-game/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1025.java) | |Easy|
8990
|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|
9091
|1021|[Remove Outermost Parentheses](https://leetcode.com/problems/remove-outermost-parentheses/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1021.java) | |Easy|
9192
|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|
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package com.fishercoder.solutions;
2+
3+
/**
4+
* 1025. Divisor Game
5+
*
6+
* Alice and Bob take turns playing a game, with Alice starting first.
7+
* Initially, there is a number N on the chalkboard. On each player's turn, that player makes a move consisting of:
8+
* Choosing any x with 0 < x < N and N % x == 0.
9+
* Replacing the number N on the chalkboard with N - x.
10+
* Also, if a player cannot make a move, they lose the game.
11+
* Return True if and only if Alice wins the game, assuming both players play optimally.
12+
*
13+
* Example 1:
14+
* Input: 2
15+
* Output: true
16+
* Explanation: Alice chooses 1, and Bob has no more moves.
17+
*
18+
* Example 2:
19+
* Input: 3
20+
* Output: false
21+
* Explanation: Alice chooses 1, Bob chooses 1, and Alice has no more moves.
22+
*
23+
* Note:
24+
* 1 <= N <= 1000
25+
* */
26+
public class _1025 {
27+
public static class Solution1 {
28+
public boolean divisorGame(int N) {
29+
//TODO: implement it
30+
return false;
31+
}
32+
}
33+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.fishercoder;
2+
3+
import com.fishercoder.solutions._1025;
4+
import org.junit.Before;
5+
import org.junit.Ignore;
6+
import org.junit.Test;
7+
8+
import static org.junit.Assert.assertEquals;
9+
10+
@Ignore
11+
public class _1025Test {
12+
private static _1025.Solution1 solution1;
13+
14+
@Before
15+
public void setup() {
16+
solution1 = new _1025.Solution1();
17+
}
18+
19+
@Test
20+
public void test1() {
21+
assertEquals(true, solution1.divisorGame(2));
22+
}
23+
}

0 commit comments

Comments
 (0)