top | item 32987791

(no title)

ikatson | 3 years ago

After reading the title of the article, I tried to solve it for fun before looking up the solution.

The logic followed what I learned at school about how to do it the long way, but of course with binary numbers it's so much easier.

I ended up with a shorter implementation that follows the same idea, but uses recursion [1]. The recursion is compiled away by Rust [2]

[1] https://play.rust-lang.org/?version=stable&mode=debug&editio... [2] https://godbolt.org/z/bq3fnrE4h

discuss

order

No comments yet.