Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
June 9, 2020 01:31 pm GMT

Daily Challenge 255 - Is There an Odd Bit?

Convert a given integer to binary. Return 1 when ANY odd bit of x equals 1; 0 otherwise.

Examples
any_odd(2) will return 1 because at least one odd bit is 1 (0010).
any_odd(170) will return 1 because all of the odd bits are 1 (10101010).

Tests
any_odd(5)
any_odd(7)
any_odd(10)

Good luck!

This challenge comes from mtruong1999 on CodeWars. Thank you to CodeWars, who has licensed redistribution of this challenge under the 2-Clause BSD License!

Want to propose a challenge idea for a future post? Email [email protected] with your suggestions!


Original Link: https://dev.to/thepracticaldev/daily-challenge-255-is-there-an-odd-bit-409d

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To