While condition in the printspan condition

is the second condition in the while loop correct ?
the while condition is as follwos:
while(s.empty() == false && arr[s.top()] <currPrice)

I am talking about the second condition in the while i.e arr[s.top()]<currPrice, I assume that it is incorrect and must infact be s.top()<currPrice. Isn’t it? Correct me If I am wrong

@vikrantwaje96 No. we are storing the indices of the array in the stack, hence that condition is 100% correct.

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.