Practice Sum Game
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Alice moves first and the players alternate replacing one ? in even-length num with a digit from 0 through 9. When none remain, Bob wins if the sums of digits in the two halves are equal; otherwise Alice wins. Under optimal play, return whether Alice wins.
Source: Sum Game on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
num = "5023"
Output
false
# Example 2
Input
num = "25??"
Output
true
# Example 3
Input
num = "?3295???"
Output
false
Constraints
2 <= num.length <= 10^5
num.length is even.
num consists of only digits and '?'.
Related LeetCode Problems
Practice more problems similar to Sum Game.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.