Stock selling problem

why it is giving wrong output in testcase 0 and 1.

@rohit2299
actually your code is creating a stack overflow …refer to this code