728x90
https://leetcode.com/problems/percentage-of-letter-in-string/
class Solution:
def percentageLetter(self, s: str, letter: str) -> int:
return floor(s.count(letter) / len(s) * 100)
728x90
'IT > 코딩테스트' 카테고리의 다른 글
[Leetcode] 485. Max Consecutive Ones (0) | 2023.08.19 |
---|---|
[Leetcode] 1523. Count Odd Numbers in an Interval Range (0) | 2023.08.18 |
[Leetcode] 175. Combine Two Tables (0) | 2023.08.16 |
[Leetcode] 2042. Check if Numbers Are Ascending in a Sentence (0) | 2023.08.14 |
[Leetcode] 27. Remove Element (0) | 2023.08.11 |