Class Solution
java.lang.Object
g2301_2400.s2309_greatest_english_letter_in_upper_and_lower_case.Solution
2309 - Greatest English Letter in Upper and Lower Case.<p>Easy</p>
<p>Given a string of English letters <code>s</code>, return <em>the <strong>greatest</strong> English letter which occurs as <strong>both</strong> a lowercase and uppercase letter in</em> <code>s</code>. The returned letter should be in <strong>uppercase</strong>. If no such letter exists, return <em>an empty string</em>.</p>
<p>An English letter <code>b</code> is <strong>greater</strong> than another letter <code>a</code> if <code>b</code> appears <strong>after</strong> <code>a</code> in the English alphabet.</p>
<p><strong>Example 1:</strong></p>
<p><strong>Input:</strong> s = “l<strong>Ee</strong>TcOd<strong>E</strong>”</p>
<p><strong>Output:</strong> “E”</p>
<p><strong>Explanation:</strong></p>
<p>The letter ‘E’ is the only letter to appear in both lower and upper case.</p>
<p><strong>Example 2:</strong></p>
<p><strong>Input:</strong> s = “a<strong>rR</strong>AzFif”</p>
<p><strong>Output:</strong> “R”</p>
<p><strong>Explanation:</strong></p>
<p>The letter ‘R’ is the greatest letter to appear in both lower and upper case.</p>
<p>Note that ‘A’ and ‘F’ also appear in both lower and upper case, but ‘R’ is greater than ‘F’ or ‘A’.</p>
<p><strong>Example 3:</strong></p>
<p><strong>Input:</strong> s = “AbCdEfGhIjK”</p>
<p><strong>Output:</strong> ""</p>
<p><strong>Explanation:</strong> There is no letter that appears in both lower and upper case.</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 <= s.length <= 1000</code></li>
<li><code>s</code> consists of lowercase and uppercase English letters.</li>
</ul>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
greatestLetter
-