I generally not hit like on youtube videos, but this guy nailed it. Thanks for your community contribution NIkhil.
@vikashsharma96783 ай бұрын
sir you explaination to any algorithm is the best explanation i had ever seen ...only your explanation is enough to solve the problem no need to see the code
@devprakash53203 жыл бұрын
loved your explanation . But 1 thing I would like to correct . The time complexity of method 1 will be O(n k log k ) , where k is the length of the string , n is total strings . This is because sorting a string would take (k log k ) . Any way awesome explanation . thanks
@WhosShamouz Жыл бұрын
I was missing ONE idea and it popped in my head when I saw your first method, amazing explanation!
@amitbhattacharya3562 жыл бұрын
I got really surprised by so a vivid and clear explanation. I appreciate your efforts.
@nikoo282 жыл бұрын
Glad I could help you out 😄
@ricardohernandezmendez42076 ай бұрын
At the beginning it was difficult to find out how to solve this problem, but with this explanation it make it easy to solve it. Thank.
@plutomessi21 Жыл бұрын
Dhanyavad bhaiya, you are the best teacher I have seen on youtube😭
@nikoo28 Жыл бұрын
So nice of you
@akashddeepchitransh453722 күн бұрын
Hey, you are super underrated, I didn't know about you channel but now I know and will be utilizing it in my preparation.
@mazthespaz15 ай бұрын
i'm new to python and this was my solution def smash(str): tmp = 1 orda = ord('A')-1 ls = len(str) for i in range( ls ): tmp = tmp * (ord(str[i]) - orda) return tmp def groop(wordlist): grope = {} for word in wordlist: hashy = smash(word) if hashy not in grope: grope[hashy] = [] grope[hashy].append(word) return [val for val in grope.values()] if __name__ == '__main__': # arr = [ 'cat','tea','tan','ate','nat','bat' ] arr = [ 'eat','cars','tea','scar','a','listen','silent'] print (groop(arr))
@mazthespaz15 ай бұрын
this solution worked in codewars but not leetcode. i need to refine the smash function to prevent duplicate hashes
@akshanshsharma81578 ай бұрын
In the sorting way, the time complexity is not O(nlogk) but rather O(n.klogk)
@Donkle3652 жыл бұрын
Hey, I found this video trough the article and thank you for all the work, it really helped me. The solution of method 2 at line 34 has a mistake: "freq++;", you can't ++ an array, so we need to do freq[c - 'a']++ :)
@Vishal-899511 ай бұрын
Premium Explanation
@nikoo2811 ай бұрын
🤘🏻
@shaileshsathe97792 жыл бұрын
Very well explained the techniques, code and dry-run. Great work Nikhil.
@shaileshsathe97792 жыл бұрын
I don't know why, I ran both techniques sorting and frequency but sorting is showing less time than frequency method. sorting => 15ms frequency = 29ms. I believe its random.
@aryamiraozdemir Жыл бұрын
@@shaileshsathe9779 I'm not sure but I think it might be because frequency string has to be sorted so it takes even longer to count everything and sort the letters alphabetically
@ramsidh22182 жыл бұрын
great explanation with animation step by step
@shahbazhussain2128Ай бұрын
If I use sorting logic will be my solution wrong? I am facing difficulty in understanding the HasMap and Frequency Concept.
@yusufnurwahid8985 ай бұрын
Very clear explanation! Keep up!!! 👍🏻
@ElinaAdibi-b1t2 ай бұрын
Thank you, you explained it very well!
@lofiboy7866Ай бұрын
We need to write getfrequency string string method also sep?
@TBVSAITEJA21BCE84012 күн бұрын
obviously
@hersheynohara5887 Жыл бұрын
That's an amazing explanation! 👏👏
@RohitSharma-q8j1p7 ай бұрын
great video and best ever explaination ever
@abinashpanda39311 ай бұрын
This might not pass all test cases, you have to add a delimiter like '#' while concatenating numbers in freq variable.
@nikoo2810 ай бұрын
passes all cases on Leetcode as per the problem constraints. If you have different strings patterns, it might need a little tweaking.
@abinashpanda39310 ай бұрын
@@nikoo28 You are right for ["bdddddddddd","bbbbbbbbbbc"] this will not going to pass. Probably new test cases have been added. Thank you for your response. Your tutorials are really helpful.
@cricworld58062 жыл бұрын
sir awesome explanation ...................
@edd_gos3 ай бұрын
bro, thank you for the video. it was very usefull (like all your videos)
@yfchina1438 ай бұрын
this there any better way for a frequency string algothrim?
@zanefalcao32303 ай бұрын
very nice explanation
@jst892211 ай бұрын
8:14 should be "nat", not sorted string "ant". Otherwise your tutorials are the best regarding leetcode problems, because you explain with examples what should the code do.
@cuteangel1726 Жыл бұрын
Appreciate your effort !!!
@sayanmanna251111 ай бұрын
But why light theme?? I am blind now..
@nikoo2811 ай бұрын
Light is easier for diagrams and animations. Will keep using light theme.
@hazerasarker2442 Жыл бұрын
Thank you Nikhil :D
@devansh_4u Жыл бұрын
beats 30% java codes, wonder what could be a better solution!
@nikoo28 Жыл бұрын
If you are concerned about having an overall faster solution, C++ should be the preferred language. Even with Java you can leverage some sort of caching and pre-processing of some results to obtain faster solutions. Generally not needed.
@devansh_4u Жыл бұрын
@@nikoo28 thanks sir
@mujeebbridgetown2 жыл бұрын
Nice explanation
@sysybaba420 Жыл бұрын
Great video as usual thanks for this! PS its not pronounced vo-i-la but just vo-la, hope this helps!
@abhishekshankar6305 Жыл бұрын
you are the best
@yogeshganpule26954 ай бұрын
tried watching but you just explained what the code does and its too confusing for me to undertsand what for each freq [c -'a']++; Does
@nikoo284 ай бұрын
c is the actual character…let us say it is character ‘k’ And we do c - ‘a’ What happens internally is both are converted to ascii Small ‘a’ has ascii 97 The character ‘k’ has ascii 107 So when you do c - ‘a’ we get 107-97 = 10 That means freq[10] This represents 11th character as array is 0 based indexing Means we are referring to frequency of 11th character in the English alphabet which is letter ‘k’
@yogeshganpule26954 ай бұрын
@@nikoo28 Thanks .
@MahiM-ze4hm3 ай бұрын
Awesome 👏✊👍
@studies39433 ай бұрын
your accent is sweet
@fourieruddin871 Жыл бұрын
Best
@himadripaul73322 жыл бұрын
Excellent ... But disheartened to see less subscribers ... ☹️😑🙂
@nikoo282 жыл бұрын
Yea…I don’t understand why my channel does not show up in results and suggestions. I have been doing everything possible: video descriptions, links etc.
@shaileshsathe97792 жыл бұрын
@@nikoo28 You can add keywords like Leetcode, Anagram, Interview Prep just like you added for String.Maybe it will work
@boomshakalaka85672 жыл бұрын
There's nothing correct about this video. Lol. Indian programmers lulz
@nikoo282 жыл бұрын
did you find some problem in the explanation or the method? Always up for improvement...
@Sarvy0012 жыл бұрын
@@nikoo28 I have found another solution here. Not explained in detail as you have done, but this one has less lines of code. kzbin.info/www/bejne/nHKtonSkerykZtE&ab_channel=ThatIndianCoder