List Min Replacement
Given a list of integers nums
, replace every nums[i]
with the smallest integer left of i
. Replace nums[0]
with 0
.
Constraints
1 ≤ n ≤ 100,000
wheren
is the length ofnums
https://binarysearch.com/problems/List-Min-Replacement
Examples
Example 1
Input
- nums =
[10, 5, 7, 9]
Output
- answer =
[0, 10, 5, 5]
Explanation
nums[0] = 0
by definitionnums[1] = min(10)
nums[2] = min(5, 10)
nums[3] = min(7, 5, 10)
Leave a comment