File tree 2 files changed +26
-0
lines changed
2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change 684
684
874|[ Walking Robot Simulation] ( ./0874-walking-robot-simulation.js ) |Medium|
685
685
875|[ Koko Eating Bananas] ( ./0875-koko-eating-bananas.js ) |Medium|
686
686
876|[ Middle of the Linked List] ( ./0876-middle-of-the-linked-list.js ) |Easy|
687
+ 877|[ Stone Game] ( ./0877-stone-game.js ) |Medium|
687
688
884|[ Uncommon Words from Two Sentences] ( ./0884-uncommon-words-from-two-sentences.js ) |Easy|
688
689
889|[ Construct Binary Tree from Preorder and Postorder Traversal] ( ./0889-construct-binary-tree-from-preorder-and-postorder-traversal.js ) |Medium|
689
690
890|[ Find and Replace Pattern] ( ./0890-find-and-replace-pattern.js ) |Medium|
Original file line number Diff line number Diff line change
1
+ /**
2
+ * 877. Stone Game
3
+ * https://leetcode.com/problems/stone-game/
4
+ * Difficulty: Medium
5
+ *
6
+ * Alice and Bob play a game with piles of stones. There are an even number of piles arranged in a
7
+ * row, and each pile has a positive integer number of stones piles[i].
8
+ *
9
+ * The objective of the game is to end with the most stones. The total number of stones across all
10
+ * the piles is odd, so there are no ties.
11
+ *
12
+ * Alice and Bob take turns, with Alice starting first. Each turn, a player takes the entire pile
13
+ * of stones either from the beginning or from the end of the row. This continues until there are
14
+ * no more piles left, at which point the person with the most stones wins.
15
+ *
16
+ * Assuming Alice and Bob play optimally, return true if Alice wins the game, or false if Bob wins.
17
+ */
18
+
19
+ /**
20
+ * @param {number[] } piles
21
+ * @return {boolean }
22
+ */
23
+ var stoneGame = function ( piles ) {
24
+ return true ;
25
+ } ;
You can’t perform that action at this time.
0 commit comments