LeetCode Most Common Word Solution Explained - Java

preview_player
Показать описание


Preparing For Your Coding Interviews? Use These Resources
————————————————————

Other Social Media
----------------------------------------------

Show Support
------------------------------------------------------------------------------

#coding #programming #softwareengineering
Рекомендации по теме
Комментарии
Автор

Nice video and thanks. But, i think the third loop is unnecessary because you can iterate the max value through second loop while getting "getOrDefault(..)" value -> if latest value is greater than max, then it is the max. i liked the video anyway, thanks for your effort.

cankaraman
Автор

Great videos Nick. I have been learning algorithms from your videos for long time. Thank you for making all these great videos.

zzzppp-dfex
Автор

I did my work with this video,
thanks dude !

tire
Автор

one comment from my side - why you need a hashSet separately ? from the questions already 'banned words' are in list, so we can check List.Contains() - right? then we can reduce space complexity. what you say ?

akhilp
Автор

This is a great one Sir. Can you pls do a tutorial on "Top k frequent words" using map as well as heap approach. Thank you

shubhamkhurana
Автор

What's the time complexity of your solution? From what I see, it's O(1) for result. two loops are (N) but not directly impacting the result itself. So is it O(1)? I checked the solution in leetcode and it's O(1), I thought it was O(N). And get well soon!

meepable
Автор

String class is immutable. How are you able to assign value to it again and again in the last for loop? I have exactly the same solution but the output gives the whole paragraph appended to the result String. This solution is wrong.

aishwaryamajumdar