FunctionRacerProblemsRace

Percentage of Letter in String

BeginnerStringsPython, JavaScript, TypeScript, Java, C++

Return the percentage of characters in s that equal the single character letter, rounded down to the nearest whole percent (an int).

Example 1

s "foobar"
letter "o"
returns 33

2 of 6 characters, which is 33.3%, rounded down to 33.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Strings problems