Ezvor

3616. Number of Student Replacements

MediumArray Preparing judge… LeetCode
ArraySimulation

Hints

Hint 1
Iterate through the array from left to right, keeping track of the current best (minimum) rank.
Hint 2
Whenever you see an element strictly lower than your current best, update the best to that element and increment the replacement count.