Stock span Problem

Why are we pushing the element to stack at the end i.e s.push(i) ?

Hey @vanshikasharma1645
Dry run in some expamples and you will understand why we ae doing that in the end :slight_smile:
If u think there is some other way then share you code and I will loook into it

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.