RECTSQ, am I unable to understand?

you don’t understand his function it seems :(. The actual result is already stored in global variable “ans” which he prints. Finder always returns 0.

oh yes,sorry i didn’t see that.he is adding k to ans.

@vehemos if you don’t know then try to learn from others but don’t tell that others are wrong without knowing” @hruday968 ok, I’m listening tell me where I’m wrong, but just 1 thing ans=finder WILL NOT WORK cuz it reutrn 0 when recursion is finished, I may not be better than you but I am aware of what I wrote, but if you still find it wrong tell me why it is and I will remove/improve on it Thanks.
@divyansh_gaba7 I didn’t know it was bad practice sorry, initially I was returning via that finder function only but afterwards I declared global to make it simpler, that’s why the int remained.

Okay got it @vijju123

@vehemos sorry i didn’t see this thing (ans+=k) and thought you was wrong.

@hruday968 np it happens, though you did make me bang my head over wall thinking why I should do ans = finder :stuck_out_tongue: I had to retest my code 3 times to gain my confidence back xD Happy Coding! :smiley:

1 Like