How can i solve this problem using stacks or queues? i cant be able to get any algorithm.
Find the greater element question
Mention problem link pls
Hey Abhishek, there is no need to use stack or queues, just write a simple function to find the next greater element for the element at given index, and then call this function for every element of the array. You just need to keep in mind that array given to you will be a circular array, so to handle that first you have to search in the element from given index to end index, if you are unable to find next greater element in that then search from index to 0 to given index-1 elements.
Hey Abhishek, as you are not responding to this thread, I am marking your doubt as Resolved for now. Re-open it if required.
Please mark your doubts as resolved in your course’s “Ask Doubt” section, when your doubt is resolved.