human
Find the winner of a game of removing at most 3 stones from a pile in each turn | Function to find the maximum score of Player 1.
Base Case.
If the result is already computed , then return the result.
Variable to store maximum score.
Pick one stone.
Pick 2 stones.
Pick 3 stones.
Return the score of the player.
Function to find the winner of the game.
Create a 1D table , dp of size N.
Store the result.
Player 1 wins.
PLayer 2 wins.
Tie.
Given Input.
Function Call"
Solution in Python:

=====
Write me a code to find the winner of a game of removing at most 3 stones from a pile in each turn and the other steps required?
assistant
#Here is code to find the winner of a game of removing at most 3 stones from a pile in each turn and the other steps required.
 def maximumStonesUtil ( arr , n , i , dp ) :
	if ( i >= n ) :
		return 0
	ans = dp [ i ]
	if ( ans != - 1 ) :
		return ans
	ans = - 2 ** 31
	ans = max ( ans , arr [ i ] - maximumStonesUtil ( arr , n , i + 1 , dp ) )
	if ( i + 1 < n ) :
		ans = max ( ans , arr [ i ] + arr [ i + 1 ] - maximumStonesUtil ( arr , n , i + 2 , dp ) )
	if ( i + 2 < n ) :
		ans = max ( ans , arr [ i ] + arr [ i + 1 ] + arr [ i + 2 ] - maximumStonesUtil ( arr , n , i + 3 , dp ) )
	return ans
def maximumStones ( arr , n ) :
	dp = [ - 1 ] * n
	res = maximumStonesUtil ( arr , n , 0 , dp )
	if ( res > 0 ) :
		return " Player1"
	elif ( res < 0 ) :
		return " Player2"
	else :
		return " Tie "
arr = [ 1 , 2 , 3 , 7 ]
n = len ( arr )
print ( maximumStones ( arr , n ) )