Alice and Bob are playing a turn-based game with a numeric string.
You are given a string num of even length, consisting of digits and '?' characters.
The rules are as follows:
1. Players take turns — Alice goes first.
2. On each turn, if there’s still at least one '?', the player:
o Chooses any index i where num[i] == '?'
o Replaces it with a digit from '0' to '9'.
3. The game ends when all '?' are replaced.
Once the game ends:
• Let the first half of num be the left side and the second half be the right side.
• Bob wins if the sum of digits on both halves are equal.
• Alice wins if the sums are not equal.
Both players play optimally.
Your task:
Return true if Alice will win, and false if Bob will win.
Input: num = "5023"
Output: false
Input: num = "25??"
Output: true
Accepted:
Submission: