2278. Percentage of Letter in String 發表於 2023-02-13 | 分類於 leetcode problemsolution12345678910class Solution {public: int percentageLetter(string s, char letter) { int count=0; for(char &c:s) count+=(c==letter); int ret=count*100/s.size(); return ret; }}; analysis time complexity O(n) space complexity O(1)