Strong Password

  • + 0 comments

    Here is my c++ solution, the explanation is here : https://youtu.be/t0O-Knlq4lQ

    char getNature(char c){
        if(c >= '0' && c <='9') return 'n';
        if(c >= 'a' && c <= 'z') return 'l';
        if(c >= 'A' && c <= 'Z') return 'u';
        return 's';
    }
    
    int minimumNumber(int n, string password) {
        map<char, int> mp;
        for(char c: password){
            mp[getNature(c)] = 1;
        }
        return max(4 - (int)mp.size(), 6 - n); 
    }