Search
⌘K

Leetcode 3096. Minimum Levels to Gain More Points

Given a binary array where playing a level gives +1 for 1 and -1 for 0, find the minimum number of initial levels Alice must play (at least 1 and leaving at least one for Bob) so her prefix score exceeds Bob's suffix score. This reduces to finding the smallest prefix length k with 2*prefix_sum > total_sum (return -1 if none).


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Your account is free and you can post anonymously if you choose.