Can someone explain the meaning of the sentence in question :" Player 1 picks one of the numbers from either end of the array followed by the player 2 and then player 1 and so on."


  • 1

    So, I don't understand what author want to say from " Player 1 picks one of the numbers from either end of the array followed by the player 2 and then player 1 and so on." Is there any mistake in this sentence?
    Player 1 picks either end of the array or what?
    Why player 1 should followed by player 2? I think player 1 pick first, right?


  • 0
    X

    The statement is correct but just a little bit arcane.

    1. either end = both ends.

    2. "followed by the player 2" means player 2 follows player 1

    Make it more readable:
    Player 1 picks either the first or the last element of the array, then player 2 picks and then so on.


  • 1

    @Xing_ Thanks for your replying. I think each player can pick a number from either head or tail, am I correct?
    Thanks again!


  • 0
    X

    @BHC that is correct. But once a player picks a number, it is removed from the sequence, which renders the end of the sequence changed.
    e.g [1,2,3,4,5], player 1 can pick 1 or 5, if P1 pick 1, then the array becomes [2,3,4,5]. Then player 2 can make the choice between 2 or 5.


Log in to reply
 

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