Don’t Think too much.It’s simple.
view my solution here:CodeChef: Practical coding for everyone
Have any questions,you are welcome.
i couldn’t comprehend why in last if condition we compare (min>0) can you please take test cases to explain that.please.