@[email protected] to Lemmy [email protected]English • 1 year agoI wishi.imgur.commessage-square183fedilinkarrow-up1906
arrow-up1888imageI wishi.imgur.com@[email protected] to Lemmy [email protected]English • 1 year agomessage-square183fedilink
minus-square@[email protected]linkfedilink21•1 year agoJust do a recursive funcion subtracting 2 and stoping on -1 or 0. Easy
minus-square@[email protected]linkfedilink2•1 year agoOk, thanks for the PR. I added a condition if we have an underflow we increment it instead
minus-square@[email protected]linkfedilink2•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