본문 바로가기

IT/코딩테스트

[Leetcode] 2278. Percentage of Letter in String

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