Given an array of integers, find the nearest greater element to the right for each element. If no such element exists, consider it -1.
{
"arr": [
1,
3,
2,
4
]
}[
3,
4,
4,
-1
]{
"arr": [
11,
13,
21,
3
]
}[
13,
21,
-1,
-1
]{
"arr": [
4,
5,
2,
25
]
}[
5,
25,
25,
-1
]Sign in to Run Code and Submit