Group Anagrams| group anagrams leetcode python | leetCode 49 | leetcode coding challenge day 6

preview_player
Показать описание
Please like the video, this really motivates us to make more such videos and helps us to grow. thecodingworld is a community which is formed to help fellow student and professionals looking to crack the “coding interviews”.

We love solving and sharing problems which are frequently asked in technical interviews and voted by community at various websites.

✅ For more and upcoming updates join our community

#leetcode #python
Рекомендации по теме
Комментарии
Автор

Please keep making these. Really helpful 👍

navanil
Автор

Do we need the last loop to return the dict values? Why don't we simply use return dict.values()

abeerkhan
Автор

Thanks for the lucid explanation and crisp answer. Waiting for more explanations to leetcode problems in Python!

soutrikmaiti
Автор

Thanks a lot for the videos with a great explanation. Very much appreciated. I'm learning a lot from your videos. Just one comment though. The background music is actually distracting :) otherwise great job.

sunkari
Автор

import collections
output = collections.defaultdict(list)
for i in strs:


print(output.values())

i took the logic from you, what do you think about the above solution? The time complexity is O(n).

naramukuriht
Автор

your video is good but your background music is worst and distracting.

rahulsawhney
Автор

return dict.values() without the last for-loop, also got accepted

yunfengzhao
Автор

Thanks for sharing :) Just curious if there's a more optimal solution.

_Sumeet
Автор

Its 2020 and leet coding challenge day 6 is still the same question "Group Anagrams"

MohammedAbdulKhaliq
Автор

"unicode object has no object append"
i have the exact code but i'm getting the above error.
class Solution(object):
def groupAnagrams(self, strs):
"""
:type strs: List[str]
:rtype: List[List[str]]
"""
d = {}

for word in strs:
sortedword = "".join(sorted(word))

if sortedword not in d:
d[sortedword] = word #sortedwordkey #wordvalue

else:

d[sortedword].append(word)

return d.values()



could you please help?

navyamittal
Автор

Thank youu, How can you make a program that counts these anagram groups?

sarabaldinelli
Автор

is there any way to directly msg u...i have doubts regarding this question

rajansharma
Автор

what is the time complexity for this? 0(n)

evelynanda-murillo
Автор

i got error
ana={}
result=[]
for i in words:
a="".join(sorted(i))

if(a in ana):
ana[a]=[i]
else:
ana[a].append(i)

for i in ana.values():
result.append(i)
return result

i got key error

prachigupta
Автор

Can't you talk clearly? It's super hard to understand each and every words

harsha