Problem 59806. Replace with Lower
Given a list of integers, for each element, replace it with the minimum integer found in the sub-list to its strict right (excluding itself). The last element should be replaced with 'inf'. Return the modified list.
For example, if the input list is [17, 18, 5, 4, 6, 10], the output should be [4, 4, 4, 6, 10, inf].
Explanation:
- For the first element, the minimum integer to its right is 4.
- Similarly, for the second and third elements, the minimum integer to their right is 4.
- For the fourth element, the minimum integer to its right is 6.
- For the fifth element, the minimum integer to its right is 10.
- Since there are no elements to the right of the last element, it's replaced with 'inf'.
Solution Stats
Solution Comments
Show commentsProblem Recent Solvers17
Suggested Problems
-
Find state names that end with the letter A
1197 Solvers
-
Replace NaNs with the number that appears to its left in the row.
3057 Solvers
-
swap sign sum & multiply castles
222 Solvers
-
Replace all zeros and NaNs in a matrix with the string 'error'
103 Solvers
-
Determine the number of odd integers in a vector
811 Solvers
More from this Author53
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!