Getting wrong answer

I am solving this question from leetcode…
650. 2 Keys Keyboard

Here i have come up with the only recursive approch(Late i will memoize it).
But here i am getting wrong answer.
This is my code…


Please check this, i am not able to find the Bug.
Thanks

Hey @ashishnnnnn
Your logic is incorrect, refer to the solution provided on the leetcode platform for the same.
You will understand why its wrong.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.