Amazon Coding Interview (2019) – Most Common Word



DISCORD CHANNEL
—————————————————————————————————————-
To join the Discord channel use the following link and join the “Member” tier: https://www.patreon.com/KevinNaughtonJr
In this Discord channel, you will be able to…
1. Ask me questions directly (as well as other members)
2. Ask about and discuss previous interview experiences
3. Find mock interview partners
4. Share helpful videos for interview preparation, and more!

Most Common Word LeetCode coding solution. This is one of Amazon’s most commonly asked interview questions according to LeetCode!

Coding Interviews Most Common Word (LeetCode) question and explanation.

This question is a commonly asked by the following companies: Amazon and Microsoft

Link to problem: https://leetcode.com/problems/most-common-word/

Intuition behind solution: Add all banned words to a hash set. Create a hash map that will store the number of occurrences of each word that is not banned. Iterate through all the words in the paragraph parameter, ignoring things like case and punctuation. For every word, if it doesn’t exist in the list of banned words, add it to the hash map or increment its count in the hash map. Once you have gone through all the words in the paragraph, iterate through all keys in your hash map updating a return variable to key that maps to the largest value. Once you have iterated through all the keys and updated your return value accordingly, return your return value.

SOCIAL
—————————————————————————————————————-
Support me on Patreon: https://www.patreon.com/KevinNaughtonJr
Follow me on Twitter: https://twitter.com/KevinNaughtonJr
Follow me on Instagram: https://www.instagram.com/KevinNaught…
Follow me on GitHub: https://github.com/kdn251

MUSIC
—————————————————————————————————————-
xo bored llif3 by KORONADOH


source

Reply

Do NOT follow this link or you will be banned from the site!