Menu

1 / 2

LeetCode 819: Most Common Word — Simple Explanation with Carry Logic (Java)

DEV Community·Jerin·6 months ago
#4WDbvnIr
#java#example#algorithm#leetcode#word
Reading 0:00
15s threshold

Difficulty : Easy

Topics : Array, Math, Hash Table, String, Counting

Platform : Leetcode

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.

Problem Statement Simplified

If in the paragraph string have the word in banned array, then discard it. If the paragraph string have ‘.’ or ‘ ’ then remove it. Make everything lowercase.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.