@wz366 Is the time complexity O(nmlogm)?
thanks for clarify the demand of this problem!!!
Genius idea for using prime number as orthogonal bisis !
@jianchao.li.fighter thank u so much ,I have learnt a lot from your solution,and I update something , only need 28ms , no use multiset , but use a number to mark group ID
Anyone knows where does the magic number 1000000000000000007 come from??
Please see this post. I have updated the problem description and provided a clear example. I have also changed the return type to return list<list<strings>>.
Obviously LC changed its function signature recently.
@yanchao_hust didnt you get time exceeded limit, I did a similar one but I get the error?
it's very concise
hello, could you please tell me what's the difference between
sorted(strs, key = sorted)
You don't need first sort.
Hi @kamelzcs, I think in your 2nd solution. ans.extend(values) should be using ans.append(values). otherwise, you will end up with anagrams not grouped together.
Here is a similar implementation like your idea:
Good idea. The effective runtime is a compound of the string length though, so it can't just be O(n). It should be something more like O(mn) where m is an average string length.
It's too bad C#/.NET doesn't seem to include an implementation for getting a hashcode for an array using primitive types like Java does.
Sorry for the confusion. Please see this link for an explanation.
No one has replied
@kitt Similar idea here:
but this is not the answer for thisquestion, the answer should return vector<vector<string>>
Yaa you dont need group the strings differently. Just push it to a vector without considering string belonging to different groups.....
Disabled Categories are greyed out
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.