Hacker News new | ask | show | jobs
by father_of_two 4080 days ago
Here's a variant of the last solution the author presented, using a Counter of each word, instead a sorted list of words' chars, as normalization.

  cnt=Counter(tuple(Counter(w).iteritems()) for w in words)
  print [w for w in words if cnt[tuple(Counter(w).iteritems())] > 1]
This is just code golfing, I don't even think it's clear. The last solution of the author is nice, though.
1 comments

This is actually quite nice. A little hard to see, but I see what you did there. You'd get an earful from the algorithm-nazis though ;)