Skip to content

Commit 123d307

Browse files
add 3232
1 parent dffd16f commit 123d307

File tree

2 files changed

+36
-0
lines changed
  • paginated_contents/algorithms/4th_thousand
  • src/main/java/com/fishercoder/solutions/fourththousand

2 files changed

+36
-0
lines changed

Diff for: paginated_contents/algorithms/4th_thousand/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
| # | Title | Solutions | Video | Difficulty | Tag
22
|------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------|------------|----------------------------------------------------------------------
3+
| 3232 | [Find if Digit Game Can Be Won](https://leetcode.com/problems/find-if-digit-game-can-be-won/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3232.java) | | Easy |
34
| 3226 | [Number of Bit Changes to Make Two Integers Equal](https://leetcode.com/problems/number-of-bit-changes-to-make-two-integers-equal/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3226.java) | | Easy |
45
| 3224 | [Minimum Array Changes to Make Differences Equal](https://leetcode.com/problems/minimum-array-changes-to-make-differences-equal/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3224.java) | | Medium |
56
| 3223 | [Minimum Length of String After Operations](https://leetcode.com/problems/minimum-length-of-string-after-operations/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3223.java) | | Medium |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package com.fishercoder.solutions.fourththousand;
2+
3+
public class _3232 {
4+
public static class Solution1 {
5+
public boolean canAliceWin(int[] nums) {
6+
int aliceScore = 0;
7+
int bobScore = 0;
8+
//alice single digit, bob double digits
9+
for (int num : nums) {
10+
if (num > 9) {
11+
bobScore += num;
12+
} else {
13+
aliceScore += num;
14+
}
15+
}
16+
if (aliceScore > bobScore) {
17+
return true;
18+
}
19+
//now alice double, bob the rest
20+
aliceScore = 0;
21+
bobScore = 0;
22+
for (int num : nums) {
23+
if (num > 9) {
24+
aliceScore += num;
25+
} else {
26+
bobScore += num;
27+
}
28+
}
29+
if (aliceScore > bobScore) {
30+
return true;
31+
}
32+
return false;
33+
}
34+
}
35+
}

0 commit comments

Comments
 (0)