Can't understand where the code fails

Can you please check my optimised function (Line: 34). I can’t understand for which test case it fails. https://ide.codingblocks.com/s/339331

Also I tried downloading the test cases but I can’t open the file

hello @girishgargcool
iterate from end to start for computing next greater max

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.