LeetCode
Stone Game II
Click
here
for an explanation.