1)extra memory str['a']..str['z']=0; scan the first word,update array str. scan the 2nd ,update str.. 2)sort each word by itself,then string compare 3)assign the 1st ->26th prime number to 'a','b'...'z' get the result of multiply each letter for each word then compare.this may cause overflow
【在 c****s 的大作中提到】 : write function to check whether two words are anagram or not. : do you have good solution for this problem?
n*2
5 楼
这位器人姐姐也太不专业了,上述特点的 "新武侠小说"是这个位面的么?
T*t
6 楼
我知道的一点是去除胶里残留的APS和TEMED这些催化剂,避免它们影响蛋白特性。
b*g
7 楼
collect letters to set1 from word1 collect letters to set2 from word2 if set1==set2, then anagram ; otherwise not.
【在 l*****a 的大作中提到】 : 1)extra memory : str['a']..str['z']=0; : scan the first word,update array str. : scan the 2nd ,update str.. : 2)sort each word by itself,then string compare : 3)assign the 1st ->26th prime number to 'a','b'...'z' : get the result of multiply each letter for each word : then compare.this may cause overflow
c*s
10 楼
领教,领教。给你一个包子,请查收
【在 l*****a 的大作中提到】 : 1)extra memory : str['a']..str['z']=0; : scan the first word,update array str. : scan the 2nd ,update str.. : 2)sort each word by itself,then string compare : 3)assign the 1st ->26th prime number to 'a','b'...'z' : get the result of multiply each letter for each word : then compare.this may cause overflow
s*y
11 楼
u r so strong.
【在 l*****a 的大作中提到】 : 1)extra memory : str['a']..str['z']=0; : scan the first word,update array str. : scan the 2nd ,update str.. : 2)sort each word by itself,then string compare : 3)assign the 1st ->26th prime number to 'a','b'...'z' : get the result of multiply each letter for each word : then compare.this may cause overflow
l*u
12 楼
这个可以归类为 就是所有的anagram都会映射到同一个key上去。 比如 dog god 都能映射到dgo
【在 c****s 的大作中提到】 : write function to check whether two words are anagram or not. : do you have good solution for this problem?