I was able to pass all the test-cases here but , when I tried to submit the same code to the same question on GFG (link : https://practice.geeksforgeeks.org/problems/maximum-rectangular-area-in-a-histogram/0 ) , it failed .
To cross check , I even unlocked the editorial ( c++ code ) and copy pasted the code on GFG , but it seems to fail there too. Can you help Identify the error ?