Count N | Function to count N - length strings consisting of vowels only sorted lexicographically ; Initializing vector to store count of strings . ; Summing up the total number of combinations . ; Return the result ; Function Call
def findNumberOfStrings ( N ) : NEW_LINE INDENT counts = [ ] NEW_LINE for i in range ( 5 ) : NEW_LINE INDENT counts . append ( 1 ) NEW_LINE DEDENT for i in range ( 2 , N + 1 ) : NEW_LINE INDENT for j in range ( 3 , - 1 , - 1 ) : NEW_LINE INDENT counts [ j ] += counts [ j + 1 ] NEW_LINE DEDENT DEDENT ans = 0 NEW_LINE for c in counts : NEW_LINE INDENT ans += c NEW_LINE DEDENT return ans NEW_LINE DEDENT N = 2 NEW_LINE print ( findNumberOfStrings ( N ) ) NEW_LINE