Given an array of integers, find the nearest smaller element to the left for each element. If no such element exists, consider it -1.
{
"arr": [
4,
5,
2,
10,
8
]
}[
-1,
4,
-1,
2,
2
]{
"arr": [
1,
2,
3,
4,
5
]
}[
-1,
1,
2,
3,
4
]{
"arr": [
5,
4,
3,
2,
1
]
}[
-1,
-1,
-1,
-1,
-1
]Sign in to Run Code and Submit