3096. Minimum Levels to Gain More Points
You are given a binary array
possibleof lengthn.Danielchandg and Bob are playing a game that consists of
nlevels. Some of the levels in the game are impossible to clear while others can always be cleared. In particular, ifpossible[i] == 0, then theithlevel is impossible to clear for both the players. A player gains1point on clearing a level and loses1point if the player fails to clear it.At the start of the game, Danielchandg will play some levels in the given order starting from the
0thlevel, after which Bob will play for the rest of the levels.Danielchandg wants to know the minimum number of levels he should play to gain more points than Bob, if both players play optimally to maximize their points.
Return the minimum number of levels danielchandg should play to gain more points. If this is not possible, return
-1.Note that each player must play at least
1level.