Stone Game III
Alice and Bob play a game with piles of stones. There are a number of piles arranged in a row, and each pile has a positive integer number of stones piles[i]. The objective of the game is to end with the most stones.
Alice and Bob take turns, with Alice starting first. Each turn, a player takes the entire pile of stones from either the beginning or the end of the row. This continues until there are no more piles left.
The player with the most stones at the end wins and the other player receives nothing. If the players have the same number of stones at the end, the game is a draw.
Given an array piles of length n, where piles[i] is the number of stones in the ith pile, return the maximum number of stones Alice can get.
I want to discuss a solution
Help me solve this
Give more examples
What's wrong with my code?
How to use 'for loop' in javascript?