A exists when price and RSI move apart: the price makes a higher high, the RSI only a lower one (bearish) – or the other way round at lows (bullish). This shows that the move is losing momentum. Nothing more: a weaker rise is still a rise. A divergence only becomes valid with a confirmation in price.
Only visible once the high is fixed
A high is only a high once a few candles after it did not go higher – in the exercise 3. Before that, nobody can see a divergence. Pictures that mark highs in hindsight therefore look earlier than was possible at the time.
Confirmed or done
A common confirmation: the price closes below the swing low between the two highs. This breaks the sequence of . If the price rises above the second high first, the divergence is done – in strong trends this happens often, sometimes several times in a row.
What the exercise counts
The exercise only checks bearish divergences at the last two confirmed candle highs. Other distances or highs of the closes give other hits. There is no single definition – which is why divergences can only be tested honestly with rules set in advance.