less than 1 minute read

You are given a list of integers candies and are playing a game against a friend. In each round, a person can remove any two consecutive candies with the same value. Given that whoever can’t pick up a candy loses and that you start first, return whether you will win.

Constraints

  • n ≤ 100,000 where n is the length of candies

https://binarysearch.com/problems/Candy-Race-with-Different-Types

Examples

Example 1

Input

  • nums = [4, 4, 3]

Output

  • answer = True

Explanation

If you pick the 4s the other person can’t pick any candies.

Solution

Categories:

Updated:

Leave a comment