An Interest In:
Web News this Week
- April 26, 2024
- April 25, 2024
- April 24, 2024
- April 23, 2024
- April 22, 2024
- April 21, 2024
- April 20, 2024
June 9, 2020 01:31 pm GMT
Original Link: https://dev.to/thepracticaldev/daily-challenge-255-is-there-an-odd-bit-409d
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:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To