You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/main/java/com/fishercoder/solutions/_464.java
-26Lines changed: 0 additions & 26 deletions
Original file line number
Diff line number
Diff line change
@@ -3,32 +3,6 @@
3
3
importjava.util.HashMap;
4
4
importjava.util.Map;
5
5
6
-
/**
7
-
* 464. Can I Win
8
-
*
9
-
* In the "100 game," two players take turns adding, to a running total, any integer from 1..10.
10
-
* The player who first causes the running total to reach or exceed 100 wins.
11
-
* What if we change the game so that players cannot re-use integers?
12
-
* For example, two players might take turns drawing from a common pool of numbers of 1..15 without replacement until they reach a total >= 100.
13
-
* Given an integer maxChoosableInteger and another integer desiredTotal, determine if the first player to move can force a win, assuming both players play optimally.
14
-
*You can always assume that maxChoosableInteger will not be larger than 20 and desiredTotal will not be larger than 300.
15
-
16
-
Example
17
-
18
-
Input:
19
-
maxChoosableInteger = 10
20
-
desiredTotal = 11
21
-
22
-
Output:
23
-
false
24
-
25
-
Explanation:
26
-
No matter which integer the first player choose, the first player will lose.
27
-
The first player can choose an integer from 1 up to 10.
28
-
If the first player choose 1, the second player can only choose integers from 2 up to 10.
29
-
The second player will win by choosing 10 and get a total = 11, which is >= desiredTotal.
30
-
Same with other integers chosen by the first player, the second player will always win.
0 commit comments