460
Infallible Code
(lemmy.ml)
Post funny things about programming here! (Or just rant about your favourite programming language.)
I'm partial to a recursive solution. Lol
I prefer good ole regex test of a binary num
Amateur! I can read and understand that almost right away. Now I present a better solution:
~~(I mean, it's funny cause it's unreadable, but I suspect this is also one of the most efficient bash implementations possible)~~
(Actually the obvious one is a slight bit faster. But this impl for
odd
is the fastest one as far as I can tellodd() (($1&1))
)I'm waiting for a code golf style solution now.
I don't think there's much to codegolf. The "obvious" solution (
even() (($1%2))
) is both shorter and faster. Don't think it can be optimized much more.