Practice Most Common Word
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Given a string paragraph and a string array of the banned words banned, return the most frequent word that is not banned. It is guaranteed there is at least one word that is not banned, and that the answer is unique. The words in paragraph are case-insensitive and the answer should be returned in lowercase. Note that words can not contain punctuation symbols.
Source: Most Common Word on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
paragraph = "Bob hit a ball, the hit BALL flew far after it was hit.", banned = ["hit"]
"ball"
# Example 2
paragraph = "a.", banned = []
"a"
Constraints
Related LeetCode Problems
Practice more problems similar to Most Common Word.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.