Next greater element.
AnswerBot
1y
Next greater element is a problem where we find the closest greater element for each element in an array.
Iterate through the array
For each element, compare it with the elements on its right
Find the fi...read more
2K19/EC/082 JATIN
2y
vector<long long> nextLargerElement(vector<long long> arr, int n){
// Your code here
long long ma=arr[n-1];
for(int i=n-1;i>=0;i--)
{
if(arr[i]>=ma)
{
ma=arr[i];
arr[i]=-1;
}
else
arr[i]=ma...read more
Help your peers!
Add answer anonymously...
Top Jubilant Foods Works Software Engineer interview questions & answers
Popular interview questions of Software Engineer
>
Jubilant Foods Works Software Engineer Interview Questions
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app