Java: Next Greater Element

Level : Intermediate
Mentor: Shailendra Chauhan
Type : GuidedLab
Points : 10
Duration : 00:30:00

Lab Details

Difficulty Level: MEDIUM

Problem Statement:

Given an array, print the Next Greater Element (NGE) for every element.

Input:

arr[] = [ 15 , 42 , 6 , 18 ]

Output:

15 --> 42

6 --> 18

18 -- -1

42 -- -1


Self-paced Membership
  • 22+ Video Courses
  • 800+ Hands-On Labs
  • 400+ Quick Notes
  • 55+ Skill Tests
  • 45+ Interview Q&A Courses
  • 10+ Real-world Projects
  • Career Coaching Sessions
  • Email Support
Upto 60% OFF
Know More
Still have some questions? Let's discuss.
CONTACT US
Accept cookies & close this