Stock Span Problem

Help me identify, where is my code wrong?
Code: https://ide.codingblocks.com/s/590088

(One thing i observed is, that my price[] array is updating after the function call stockSpan(). Even though i am making no changes in the array price[].)

https://ide.codingblocks.com/s/590103 i have corrected ur code… try running it

Hey, the output of your code is same as mine. Please check it once.

ok so ur logic was also correct… u were getting wrong o/p bcoz
image
here u were not specifying the size of span array… just write span[n] and u would get correct o/p

1 Like

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.