This function calculates number of unique characters using a associative array count [ ] . Returns true if no . of characters are less than required else returns false .
def isValid ( count , k ) : NEW_LINE INDENT val = 0 NEW_LINE for i in range ( MAX_CHARS ) : NEW_LINE INDENT if count [ i ] > 0 : NEW_LINE INDENT val += 1 NEW_LINE DEDENT DEDENT DEDENT