Class Solution
java.lang.Object
g1601_1700.s1641_count_sorted_vowel_strings.Solution
1641 - Count Sorted Vowel Strings.<p>Medium</p>
<p>Given an integer <code>n</code>, return <em>the number of strings of length</em> <code>n</code> <em>that consist only of vowels (</em><code>a</code><em>,</em> <code>e</code><em>,</em> <code>i</code><em>,</em> <code>o</code><em>,</em> <code>u</code><em>) and are <strong>lexicographically sorted</strong>.</em></p>
<p>A string <code>s</code> is <strong>lexicographically sorted</strong> if for all valid <code>i</code>, <code>s[i]</code> is the same as or comes before <code>s[i+1]</code> in the alphabet.</p>
<p><strong>Example 1:</strong></p>
<p><strong>Input:</strong> n = 1</p>
<p><strong>Output:</strong> 5</p>
<p><strong>Explanation:</strong> The 5 sorted strings that consist of vowels only are <code>["a","e","i","o","u"].</code></p>
<p><strong>Example 2:</strong></p>
<p><strong>Input:</strong> n = 2</p>
<p><strong>Output:</strong> 15</p>
<p><strong>Explanation:</strong> The 15 sorted strings that consist of vowels only are</p>
<p>[“aa”,“ae”,“ai”,“ao”,“au”,“ee”,“ei”,“eo”,“eu”,“ii”,“io”,“iu”,“oo”,“ou”,“uu”].</p>
<p>Note that “ea” is not a valid string since ‘e’ comes after ‘a’ in the alphabet.</p>
<p><strong>Example 3:</strong></p>
<p><strong>Input:</strong> n = 33</p>
<p><strong>Output:</strong> 66045</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 <= n <= 50</code></li>
</ul>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
countVowelStrings
public int countVowelStrings(int n)
-