Please enter your email address or userHandle.
Given an array of integers, find the nearest smaller number for every element such that the smaller element is on left side.If no small element present on the left print -1.
The first line of input contains T test cases.
The first line of each test case contains the number of elements in the array.
The second line of each test case contains the elements of the array.
Print the n elements.
1 6 2
1 5 0 3 4 5
-1 1 1
-1 1 -1 0 3 4
We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?
Login to access your submissions.
Please choose 'ReadOnlyMode' if you needn't to 'Edit' the problem e.g. viewing OJ's solution, TestCase Files (TCFs), TimeLimit etc.