nave@lemmy.zip to Lemmy Shitpost@lemmy.worldEnglish · 1 year agoI wishi.imgur.comimagemessage-square186fedilinkarrow-up1919arrow-down117
arrow-up1902arrow-down1imageI wishi.imgur.comnave@lemmy.zip to Lemmy Shitpost@lemmy.worldEnglish · 1 year agomessage-square186fedilink
minus-squaredwalin@lemmy.worldlinkfedilinkarrow-up22arrow-down1·1 year agoJust do a recursive funcion subtracting 2 and stoping on -1 or 0. Easy
minus-squaredwalin@lemmy.worldlinkfedilinkarrow-up2·1 year agoOk, thanks for the PR. I added a condition if we have an underflow we increment it instead
minus-squareFooBarrington@lemmy.worldlinkfedilinkarrow-up2·1 year agoJust return null, nobody knows whether negative numbers can be even
Just do a recursive funcion subtracting 2 and stoping on -1 or 0. Easy
dwalinIsEven(-2)
Ok, thanks for the PR. I added a condition if we have an underflow we increment it instead
Just return
null
, nobody knows whether negative numbers can be even