Practice Alice and Bob Playing Flower 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
Two flower lanes initially contain x and y flowers. Alice moves first, and the players alternate removing one flower from either nonempty lane. The player removing the last flower wins. Given n and m, count the pairs (x, y) with 1 <= x <= n and 1 <= y <= m for which Alice wins.
Source: Alice and Bob Playing Flower Game on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
n = 3, m = 2
Output
3
# Example 2
Input
n = 1, m = 1
Output
0
Constraints
1 <= n, m <= 10^5
Related LeetCode Problems
Practice more problems similar to Alice and Bob Playing Flower Game.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.