Help with error

sol: https://ide.codingblocks.com/s/420107

problem: https://leetcode.com/problems/coin-change/

as soon as I apply memoization the code stops working I would like to learn the exact reason why it is happening so that I can learn from it