2278. Percentage of Letter in String
Question
Given a string
s
and a characterletter
, return* the percentage of characters ins
that equalletter
rounded down to the nearest whole percent.*
Solution
一次遍历,计算字符出现的次数。
返回字符出现的次数除以字符长度乘以100。
Code
1 | class Solution { |
2278. Percentage of Letter in String
https://xuanhe95.github.io/2022/05/22/2278-Percentage-of-Letter-in-String/