Next Smaller Element

Given an integer array arg1, return an array of the same length where position i holds the first value to the right of i that is strictly smaller than arg1[i]. When no such value exists, store -1 at that position.

Examples
Input: [1,2,3]
Output: [-1,-1,-1]
Hints

Next Smaller Element

Given an integer array `arg1`, return an array of the same length where position `i` holds the first value to the right of `i` that is strictly smaller than `arg1[i]`. When no such value exists, store `-1` at that position.