Skip to main content
6 events
when toggle format what by license comment
Jun 17, 2020 at 9:04 history edited CommunityBot
Commonmark migration
Apr 7, 2017 at 14:51 comment added Olivier Grégoire Nicely spotted!
Apr 7, 2017 at 14:40 comment added Kevin Cruijssen @OlivierGrégoire Unfortunately that one doesn't work for n=0 in Java, because 0%-2==0 will be true and 0/-2 is still 0, causing an infinite loop, which is why I added the n==0?0>1 part to my recursive method.
Apr 7, 2017 at 14:14 comment added Olivier Grégoire The non-recursive way is shorter by 5 bytes: boolean c(int n){while(0==n%-2)n/=-2;return 1==n;}.
Apr 6, 2017 at 14:20 history edited Kevin Cruijssen CC BY-SA 3.0
added 1088 characters in body
Apr 6, 2017 at 14:13 history answered Kevin Cruijssen CC BY-SA 3.0