Approach

this weeks weekly, problem 1 is simple, we maintain unordered_set to check how many unqiue values and chekc hte current length.

Code

class Solution {
public:
    int residuePrefixes(string s) {
        unordered_set<char> st;
        int resi = 0;
        for(int i = 0 ; i < s.size() ; ++i) {
            st.insert(s[i]);
            if(st.size() == (i+1) % 3) ++ resi;
        }
        return resi;
    }
};