EMERSON ELECTRIC | On-Campus OA (2024) | Percentage of Letter in String

Question · Posted Jun 2026

Q1: Percentage of Letter in String Problem Statement Given a string s and a character letter, return the percentage of characters in s that are equal to letter. The percentage should be rounded down to the nearest whole number. Example Input s = "foobar" letter = 'o' Output 33 Constraints 1 <= s.length <= 100 Test Cases Test Case 1 Input: s = "leetcode" letter = 'z' Output: 0 Test Case 2 Input: s = "aaaa" letter = 'a' Output: ...

The full answer & interview discussion are available to premium members.

Log in Create a free account