Wrong answer , i guess somewhat wrong in recursive case , please tell

have a look at this code and figure out the problem

mam i have done same , but still giving wrong ans for all

@Muskan-Gupta-598128740703036
i am not quite familiar with java
the same code works in c++
but java seems to be not working
everything is same
i cant help for java