Doubt in Digit dp problem

Hi, I was doing a fascinating problem — Link to the question
This is what I did — Link to my code
Can anyone tell what I’m doing wrong??