http://www.perlmonks.org?node_id=537931


in reply to Re^5: Puzzle: Given an array of integers, find the best sequence of pop / shift...
in thread Puzzle: Given an array of integers, find the best sequence of pop / shift...

Okay, I understand what you are saying - but I'm still not sure if I buy it. Isn't this mistakenly assuming (like I did in my original reply) that each player (or at least player 2) will take the highest of the two available numbers at each turn?
  • Comment on Re^6: Puzzle: Given an array of integers, find the best sequence of pop / shift...

Replies are listed 'Best First'.
Re^7: Puzzle: Given an array of integers, find the best sequence of pop / shift...
by davidj (Priest) on Mar 20, 2006 at 14:01 UTC
    Sure the 2nd player will take the higher of the two. But that is irrelevant, because that player can be forced to take all odd or all even. With that, the outcome is known in advance, and the first player will know which one (odd or even) to take for herself.

    dave