We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
//eliminate repeated calls with dp
int gos(int n, int cur)
{
if(n less than 2)
return cur;
if(cur==0)
return (gos(n-2,1) || gos(n-3,1) || gos(n-5,1) );
else
return (gos(n-2,0) && gos(n-3,0) && gos(n-5,0) );
}
Such a good problem :)
Game of Stones
You are viewing a single comment's thread. Return to all comments →