Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 36c9b5c

Browse files
committed
Added README.md file for Find Most Frequent Vowel and Consonant
1 parent 6cf5bc6 commit 36c9b5c

File tree

1 file changed

+53
-0
lines changed
  • 3872-find-most-frequent-vowel-and-consonant

1 file changed

+53
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<h2><a href="https://leetcode.com/problems/find-most-frequent-vowel-and-consonant">Find Most Frequent Vowel and Consonant</a></h2> <img src='https://img.shields.io/badge/Difficulty-Easy-brightgreen' alt='Difficulty: Easy' /><hr><p>You are given a string <code>s</code> consisting of lowercase English letters (<code>&#39;a&#39;</code> to <code>&#39;z&#39;</code>). </p>
2+
3+
<p>Your task is to:</p>
4+
5+
<ul>
6+
<li>Find the vowel (one of <code>&#39;a&#39;</code>, <code>&#39;e&#39;</code>, <code>&#39;i&#39;</code>, <code>&#39;o&#39;</code>, or <code>&#39;u&#39;</code>) with the <strong>maximum</strong> frequency.</li>
7+
<li>Find the consonant (all other letters excluding vowels) with the <strong>maximum</strong> frequency.</li>
8+
</ul>
9+
10+
<p>Return the sum of the two frequencies.</p>
11+
12+
<p><strong>Note</strong>: If multiple vowels or consonants have the same maximum frequency, you may choose any one of them. If there are no vowels or no consonants in the string, consider their frequency as 0.</p>
13+
The <strong>frequency</strong> of a letter <code>x</code> is the number of times it occurs in the string.
14+
<p>&nbsp;</p>
15+
<p><strong class="example">Example 1:</strong></p>
16+
17+
<div class="example-block">
18+
<p><strong>Input:</strong> <span class="example-io">s = &quot;successes&quot;</span></p>
19+
20+
<p><strong>Output:</strong> <span class="example-io">6</span></p>
21+
22+
<p><strong>Explanation:</strong></p>
23+
24+
<ul>
25+
<li>The vowels are: <code>&#39;u&#39;</code> (frequency 1), <code>&#39;e&#39;</code> (frequency 2). The maximum frequency is 2.</li>
26+
<li>The consonants are: <code>&#39;s&#39;</code> (frequency 4), <code>&#39;c&#39;</code> (frequency 2). The maximum frequency is 4.</li>
27+
<li>The output is <code>2 + 4 = 6</code>.</li>
28+
</ul>
29+
</div>
30+
31+
<p><strong class="example">Example 2:</strong></p>
32+
33+
<div class="example-block">
34+
<p><strong>Input:</strong> <span class="example-io">s = &quot;aeiaeia&quot;</span></p>
35+
36+
<p><strong>Output:</strong> <span class="example-io">3</span></p>
37+
38+
<p><strong>Explanation:</strong></p>
39+
40+
<ul>
41+
<li>The vowels are: <code>&#39;a&#39;</code> (frequency 3), <code>&#39;e&#39;</code> ( frequency 2), <code>&#39;i&#39;</code> (frequency 2). The maximum frequency is 3.</li>
42+
<li>There are no consonants in <code>s</code>. Hence, maximum consonant frequency = 0.</li>
43+
<li>The output is <code>3 + 0 = 3</code>.</li>
44+
</ul>
45+
</div>
46+
47+
<p>&nbsp;</p>
48+
<p><strong>Constraints:</strong></p>
49+
50+
<ul>
51+
<li><code>1 &lt;= s.length &lt;= 100</code></li>
52+
<li><code>s</code> consists of lowercase English letters only.</li>
53+
</ul>

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /