What is your favourite solution?
source link: https://www.codeabbey.com/index/forum_topic/a17b6bd8575e2719413b224d74b63da5
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
What is your favourite solution?
Back to General discussions forum
I am genuinely curious what people consider their favourite own solution here on CodeAbbey. It could be their solution to a particularly challenging problem, or something where they learnt something new, a clever algorithm, a short solution, and so on. I really like to look at and understand the solutions of others to learn and get inspired.
Obviously don’t post any solutions themselves here.
I make a start: one-line Python code for #33 Parity Control. That was the first time I thought that I might like Python after all. :)
it was posted in this topic and replied to message there, but admin decided to try moving post manually as experiment, sorry for inconvenience
I'd say in general life we prefer to write clear, not clever :)
I've had a few arguments about this. :) My reason for writing terse code is not because I like clever for clever's sake and not because I think it would run faster. The reason is that writing short code gives me fewer chances to make mistakes.
Some of the arguments are summarized here (not by me): http://wiki.c2.com/?OnceAndOnlyOnce
Anyway, speaking of our own favorite solutions (and also one-liners), for me, this is
My favorite solution amongst my own would be for the Dungeons And Dragons Dice (#53) problem. Because, at least as I understand, my solution perfectly models the probability that a sequence is generated by a particular dice set (well, okay, not actually 100% perfectly because there will be rounding errors with representation of probabilities as doubles, but it models it fairly precisely when there haven't been many rolls). It could also do with some refactoring, but at least I'm very happy with the core idea for the solution.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK