|
|
|
|
<[Alan]> This is definitely one of my favorite programming interview questions to ask. If they get it right, you can move on to golf...did I ever show you these?
|
|
|
|
Whole-word anagram finder:
|
|
|
|
$ perl -e 'sub f{join"",sort split//,pop};$w=f($/.pop);die grep f($_)eq$w,<>' /usr/share/dict/words bread
|
|
|
|
Partial-word anagram finder:
|
|
|
|
$ perl -e 'sub f{join pop,sort split//,pop};$w=f($/.pop,"");die grep $w=~(f($_,"+")."+"),<>' /usr/share/dict/words bread
|