Skip to content
TryAlgoViz
Algorithms
Articles
CS Fundamentals
Problems
Roadmap
Dashboard
Theme
Next Greater Element I — TryAlgoViz
Next Greater Element I
easy
Visualize
Description
Hints
Discussion
Visual examples
Example 1
Input
4
0
1
1
2
2
nums2
1
0
3
1
4
2
2
3
Output
[-1,3,-1]
Example 2
Input
2
0
4
1
nums2
1
0
2
1
3
2
4
3
Output
[3,-1]
Python
Reset
Run
Ctrl+Enter
Loading editor…
Test Case 1
Test Case 2
Input
4
0
1
1
2
2
nums2
1
0
3
1
4
2
2
3
Visualize
Expected Output
[-1,3,-1]