SIGTUPLE Hiring On-Campus OA (2024) | Problem Percentage of Letter in String

Question · Posted Jun 2026

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 Explanation: Number of occurrences of 'o': 2 Length of string: 6 Percentage: (2 × 100) / 6 = 33.33 Rounded down: 33 Test Cases Test Case 1 Input: s = "foobar" letter = 'o' Output: 33 Test ...

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

Log in Create a free account