Why "++++-++++++" is a TRUE?


  • 1
    Z

    Can anyone please confirm why the expected result for the following test case is TRUE?
    "++++-++++++"

    My code failed because my alg is giving 'false', but I am a little confused why the OJ gives 'TRUE'. No matter what the first player does, the second player can find a way to eventually win the game. Am I missing some critical info here?


  • 0

    Obviously, 1P can win.
    flip two consecutive "++" into "--"

    
    ++++-++++++  input
    --++-++++++   1P moved
    
    -----++++++   2P moved
    
    -------++++   1P moved
    
    ---------++   2P moved
    
    -----------   1P moved
    
    No room for 2P, 1P win
    
    

  • 0
    R

    @new2500
    If you are first player.

    2p moved:
    --++-+--+++

    you lose...

    The actual reason is: ++++---++++.


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.