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

For the first puzzle, code that determines if a value has one bit high, without any if/while/for, here's what I got:

!(x & (x-1)) && x

Was there a "best" solution somewhere? I couldnt get the code window to work.



-1 is not an allowed operator in my puzzle.




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

Search: