Great video! Please I request to continue this DSA pattern identification series ❤
@barath-vz5bq9 күн бұрын
Thank you👏
@XoloVibes16 күн бұрын
Please continue DSA related videos
@IntenseMovieClips18 күн бұрын
This is really very helpful.
@sharathkumarhk426018 күн бұрын
Summary for myself: To find the next greater or smaller elements, previous greater or smaller, we can make use of the monotonic stack. Calculation wise, if you want the previous greater or smaller. You will start from the left, because you need to know those previous numbers to identify prev greater or smaller wrt current position. Similarly, for the upcoming greater or smaller, you're gonna start from the right. To find the next greater element, you're gonna maintain the stack in decreasing order. To find the next smaller element, you're gonna maintain the stack in increasing order. You need to balance the stack first and then read the value from the stack to identify the next greater or smaller value. If there is nothing in the stack. It means -1 not found.
@sohansingh202218 күн бұрын
Thanks
@ankurrajput236718 күн бұрын
If in the bruteforce approach we are using nested loop then we can use stack.