Exercises/#99 Next Greater Element
#99

Next Greater Element

MediumπŸ“š Stack & Queue
70 XP

Problem

Given a circular array, for each element find the next greater element. If none, return -1.

Examples

Input: nums=[1,2,1]
Output: [2,-1,2]

Input: nums=[1,2,3,4,3]
Output: [2,3,4,-1,4]
stackmonotonic-stackarray
AI Assistantβ€” powered by AI

Unlock hints progressively β€” start gentle, go deeper only if needed.

πŸ’‘

Level 1: Gentle Nudge

A subtle direction

πŸ—ΊοΈ

Level 2: Approach

The algorithm to use

πŸ”

Level 3: Detailed

Step-by-step guidance

99 / 150

Your Solution

⚑ JavaScript

to save progress and use AI features