Comment

Comment by naasking

> Then the majority come up with (a / 2) + (b / 2) until they run the unit tests and realize it's wrong.

Seems like you can cover the corner case easily enough:

    x/2 + y/2 + (x & y & 0x01)
A few more operations than the article though so not the most efficient solution.
parent naasking 3 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton