Please tell him dont teach

Is there is vide explanation by Prateek Bhaiya for this topic .
I’m unable to understand the problem . What he is telling totally insane.

@rssrivastavarohan
Hi,
There is no video on this topic by Prateek Bhaiya

This question is similar to previous greater element ( just that we need to tell the index this time )
so we mantain a stack
while iterating the i/p array using index base 1

  1. while[ stack is not empty or prices[stack.top( ) ] < prices[i] )
    simply pop from stack
  2. now update the o/p array as
    if ( stack is empty ) then i+1 ( ie no price greater than this current price has been encountered in i+1 days)
    else i -st.top() [ present day - previous day when the stock price was higher ]
    3 push the current index in the stack

refer the below article to understand better

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.