@@ -64,65 +64,6 @@ sum(piles) is odd.
64
64
## 代码
65
65
66
66
``` js
67
- /*
68
- * @lc app=leetcode id=877 lang=javascript
69
- *
70
- * [877] Stone Game
71
- *
72
- * https://leetcode.com/problems/stone-game/description/
73
- *
74
- * algorithms
75
- * Medium (60.46%)
76
- * Total Accepted: 21.4K
77
- * Total Submissions: 35.3K
78
- * Testcase Example: '[5,3,4,5]'
79
- *
80
- * Alex and Lee play a game with piles of stones. There are an even number of
81
- * piles arranged in a row, and each pile has a positive integer number of
82
- * stones piles[i].
83
- *
84
- * The objective of the game is to end with the most stones. The total number
85
- * of stones is odd, so there are no ties.
86
- *
87
- * Alex and Lee take turns, with Alex starting first. Each turn, a player
88
- * takes the entire pile of stones from either the beginning or the end of the
89
- * row. This continues until there are no more piles left, at which point the
90
- * person with the most stones wins.
91
- *
92
- * Assuming Alex and Lee play optimally, return True if and only if Alex wins
93
- * the game.
94
- *
95
- *
96
- *
97
- * Example 1:
98
- *
99
- *
100
- * Input: [5,3,4,5]
101
- * Output: true
102
- * Explanation:
103
- * Alex starts first, and can only take the first 5 or the last 5.
104
- * Say he takes the first 5, so that the row becomes [3, 4, 5].
105
- * If Lee takes 3, then the board is [4, 5], and Alex takes 5 to win with 10
106
- * points.
107
- * If Lee takes the last 5, then the board is [3, 4], and Alex takes 4 to win
108
- * with 9 points.
109
- * This demonstrated that taking the first 5 was a winning move for Alex, so we
110
- * return true.
111
- *
112
- *
113
- *
114
- *
115
- * Note:
116
- *
117
- *
118
- * 2 <= piles.length <= 500
119
- * piles.length is even.
120
- * 1 <= piles[i] <= 500
121
- * sum(piles) is odd.
122
- *
123
- *
124
- *
125
- */
126
67
/**
127
68
* @param {number[]} piles
128
69
* @return {boolean}
0 commit comments