Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It's nice to have this version for testing the faster, more complicated one from OP. I can attest that they indeed produce the same answers.

Two fixes: - If you use `(Counter(digits)-Counter(e)).elements()` in the last line, you can support repeated digits. - Reduce is `reduce(function, sequence[, initial]) -> value` so you should move the lambda to the first argument.

All in all I think this is a very nice, succinct use of Python. The combinatorial parts of `itertools` are extreamly handy :)



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: