Histogram Problem(Challenges:Stacks,Queue,Deque)

I am not able to understand how to proceed with this problem .None of the test case is giving a correct answer.
Here is the link of the code that I
have written.

Hi @vrindabansal05, your logic is absolutely correct. The only problem is with your data types. You are returning a value of type int from the function, but capturing it in a long long int type. You’re storing long elements in stack, but while removing from stack, you’re storing it in int.
Just change all data types to long long int. It will work.
If doubt persists, reply to this thread, else mark it as resolved.