Because in the holders[i] array, each address only appears once. You can use a loop to find the addresses you want to delete. Once found, swap with the last element of the array and then delete the last element. At this time, you can exit the for loop directly, which can save money. A lot of gas.
https://github.com/Cyfrin/2023-12-the-standard/blob/main/contracts/LiquidationPool.sol#L97-L101
After finding the _holder address, you can jump out of the loop directly. There is no need to judge the subsequent address situation, because the addresses of this array are all unique.
Manual review
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.