Class Solution
java.lang.Object
g2201_2300.s2278_percentage_of_letter_in_string.Solution
2278 - Percentage of Letter in String.<p>Easy</p>
<p>Given a string <code>s</code> and a character <code>letter</code>, return <em>the <strong>percentage</strong> of characters in</em> <code>s</code> <em>that equal</em> <code>letter</code> <em><strong>rounded down</strong> to the nearest whole percent.</em></p>
<p><strong>Example 1:</strong></p>
<p><strong>Input:</strong> s = “foobar”, letter = “o”</p>
<p><strong>Output:</strong> 33</p>
<p><strong>Explanation:</strong></p>
<p>The percentage of characters in s that equal the letter ‘o’ is 2 / 6 * 100% = 33% when rounded down, so we return 33.</p>
<p><strong>Example 2:</strong></p>
<p><strong>Input:</strong> s = “jjjj”, letter = “k”</p>
<p><strong>Output:</strong> 0</p>
<p><strong>Explanation:</strong></p>
<p>The percentage of characters in s that equal the letter ‘k’ is 0%, so we return 0.</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 <= s.length <= 100</code></li>
<li><code>s</code> consists of lowercase English letters.</li>
<li><code>letter</code> is a lowercase English letter.</li>
</ul>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
percentageLetter
-