You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Understand what the interviewer is asking for by using test cases and questions about the problem.
Q
What is the desired outcome?
To determine if the message contains every letter of the English alphabet at least once.
What input is provided?
A string containing lowercase English letters and whitespace.
P-lan
Plan the solution with appropriate visualizations and pseudocode.
General Idea: Use a set to track the unique letters in the message and compare it with a set of all letters in the alphabet.
1) Create a set of all letters in the English alphabet.
2) Create a set from the input message, removing any whitespace.
3) Check if the alphabet set is a subset of the message set.
4) Return `True` if it is a subset, otherwise return `False`.
⚠️ Common Mistakes
Forgetting to remove whitespace from the message before checking.
Not accounting for possible empty messages which should return False.