Trying to solve the zero-sum problem described here, where two opponent players at each turn can choose to collect 1, 2 or 3 stones with different values, with the objective of getting more points at the end of the game (and assuming each player is playing optimally).
All presented solutions based on recursion suggest to save at each position in an array (memoization) the points difference between the 2 players, thus deriving the current step as the number of stones taken minus the difference at the following position.
I tried instead a different approach, where I save at each array position the best score any player get starting from that position onward. I then compute a single recursion step as the number of points collected in the current turn plus the best score the same player might get from here on (recursion), taking into account the player are alternating.
My solution fails with some test cases and I wanted to understand if there is a problem with the theory (or if I just have to counter check the implementation).