Doubt in one question

I am solving one dp question from leetcode.
1140. Stone Game II

This is my solution…


But it is showing wrong answer.
Could you look into this please.

hello @ashishnnnnn
pls explain ur logic.