396.Coins in a Line III

There are n coins in a line. Two players take turns to take a coin from one of the ends of the line until there are no more coins left. The player with the larger amount of money wins.
Could you please decide the first player will win or lose?
Example
Given array A = [3,2,2], return true.
Given array A = [1,2,4], return true.
Given array A = [1,20,4], return false.
Challenge
Follow Up Question:
If n is even. Is there any hacky algorithm that can decide whether first player will win or lose in O(1) memory and O(n) time?

```

https://aaronice.gitbooks.io/lintcode/content/dynamic_programming/coins_in_a_line_iii.html

上一篇:UUID already exists


下一篇:论文《PaletteNet: Image Recolorization with Given Color Palette》部分笔记