Skip to content

Commit 07b911d

Browse files
committed
Create README - LeetHub
1 parent 99aee1f commit 07b911d

File tree

1 file changed

+68
-0
lines changed
  • 3775-reverse-words-with-same-vowel-count

1 file changed

+68
-0
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<h2><a href="https://leetcode.com/problems/reverse-words-with-same-vowel-count">3775. Reverse Words With Same Vowel Count</a></h2><h3>Medium</h3><hr><p>You are given a string <code>s</code> consisting of lowercase English words, each separated by a single space.</p>
2+
3+
<p>Determine how many vowels appear in the <strong>first</strong> word. Then, reverse each following word that has the <strong>same vowel count</strong>. Leave all remaining words unchanged.</p>
4+
5+
<p>Return the resulting string.</p>
6+
7+
<p>Vowels are <code>&#39;a&#39;</code>, <code>&#39;e&#39;</code>, <code>&#39;i&#39;</code>, <code>&#39;o&#39;</code>, and <code>&#39;u&#39;</code>.</p>
8+
9+
<p>&nbsp;</p>
10+
<p><strong class="example">Example 1:</strong></p>
11+
12+
<div class="example-block">
13+
<p><strong>Input:</strong> <span class="example-io">s = &quot;cat and mice&quot;</span></p>
14+
15+
<p><strong>Output:</strong> <span class="example-io">&quot;cat dna mice&quot;</span></p>
16+
17+
<p><strong>Explanation:</strong>​​​​​​​</p>
18+
19+
<ul>
20+
<li>The first word <code>&quot;cat&quot;</code> has 1 vowel.</li>
21+
<li><code>&quot;and&quot;</code> has 1 vowel, so it is reversed to form <code>&quot;dna&quot;</code>.</li>
22+
<li><code>&quot;mice&quot;</code> has 2 vowels, so it remains unchanged.</li>
23+
<li>Thus, the resulting string is <code>&quot;cat dna mice&quot;</code>.</li>
24+
</ul>
25+
</div>
26+
27+
<p><strong class="example">Example 2:</strong></p>
28+
29+
<div class="example-block">
30+
<p><strong>Input:</strong> <span class="example-io">s = &quot;book is nice&quot;</span></p>
31+
32+
<p><strong>Output:</strong> <span class="example-io">&quot;book is ecin&quot;</span></p>
33+
34+
<p><strong>Explanation:</strong></p>
35+
36+
<ul>
37+
<li>The first word <code>&quot;book&quot;</code> has 2 vowels.</li>
38+
<li><code>&quot;is&quot;</code> has 1 vowel, so it remains unchanged.</li>
39+
<li><code>&quot;nice&quot;</code> has 2 vowels, so it is reversed to form <code>&quot;ecin&quot;</code>.</li>
40+
<li>Thus, the resulting string is <code>&quot;book is ecin&quot;</code>.</li>
41+
</ul>
42+
</div>
43+
44+
<p><strong class="example">Example 3:</strong></p>
45+
46+
<div class="example-block">
47+
<p><strong>Input:</strong> <span class="example-io">s = &quot;banana healthy&quot;</span></p>
48+
49+
<p><strong>Output:</strong> <span class="example-io">&quot;banana healthy&quot;</span></p>
50+
51+
<p><strong>Explanation:</strong></p>
52+
53+
<ul>
54+
<li>The first word <code>&quot;banana&quot;</code> has 3 vowels.</li>
55+
<li><code>&quot;healthy&quot;</code> has 2 vowels, so it remains unchanged.</li>
56+
<li>Thus, the resulting string is <code>&quot;banana healthy&quot;</code>.</li>
57+
</ul>
58+
</div>
59+
60+
<p>&nbsp;</p>
61+
<p><strong>Constraints:</strong></p>
62+
63+
<ul>
64+
<li><code>1 &lt;= s.length &lt;= 10<sup>5</sup></code></li>
65+
<li><code>s</code> consists of lowercase English letters and spaces.</li>
66+
<li>Words in <code>s</code> are separated by a <strong>single</strong> space.</li>
67+
<li><code>s</code> does <strong>not</strong> contain leading or trailing spaces.</li>
68+
</ul>

0 commit comments

Comments
 (0)