DEV Community

Discussion on: Daily Challenge #255 - Is There an Odd Bit?

Collapse
 
bb4l profile image
bb4L

Solution in nim:

import strutils

proc anyOdd*(data: BiggestInt): int =
for i, c in $(toBin(data, 15)):
        if c == '1' and i mod 2 == 1:
            return 1
    return 0