Python. One liner solution. O(1) time & space.
Some combinatorics:\nIt is known that the characters should appear in ascending lexicographic order.\nIt is known that there are a total of 5 characters.\nConcl
Some combinatorics:\nIt is known that the characters should appear in ascending lexicographic order.\nIt is known that there are a total of 5 characters.\nConclusion: There are only 4 places where the character is replaced by the one followed by the sorted order.\nWe have n + 4 locations in total.\nHence, the answer is (using a binomial coefficient): n + 4 C 4\nAfter we simplify the above expression, we will get the solution in front of you.\n\n\t\n\tclass Solution:\n\t\tdef countVowelStrings(self, n: int) -> int:\n\t\t\treturn ((n + 1) * (n + 2) * (n + 3) * (n + 4)) // 24\n\nI sincerely hope you understood.\nIf there are any more questions, feel free to ask.
['Python', 'Python3']