Skip to content

Practice Percentage of Letter in String

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Easy#2278
LeetCode Problem

Percentage of Letter in String

Problem Statement

Given a string s and a character letter, return the percentage of characters in s that equal letter rounded down to the nearest whole percent.

Source: Percentage of Letter in String on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
s = "foobar", letter = "o"
Output
33

# Example 2

Input
s = "jjjj", letter = "k"
Output
0

Constraints

1 <= s.length <= 100
s consists of lowercase English letters.
letter is a lowercase English letter.

Related LeetCode Problems

Practice more problems similar to Percentage of Letter in String.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.