educative.io

Problem Challenge 3

Hello,
Why do we check if the frequency of the right char in the map is >= 0 while we just can compare it to 0:
the number of occurrences of the right character reaches 0 => we have a complete match

if (charFrequencyMap[rightChar] >= 0) { // count every matching of a character

      matched++;

    }

We want to acquire every matching character first and then reduce the size of the character window.