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 comments
Loading...
Problem Recent Solvers18
Suggested Problems
-
Make the vector [1 2 3 4 5 6 7 8 9 10]
52832 Solvers
-
How to find the position of an element in a vector without using the find function
2814 Solvers
-
The Hitchhiker's Guide to MATLAB
3406 Solvers
-
Find the largest value in the 3D matrix
1666 Solvers
-
236 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!