- [Unofficial Contest] Code Golf Challenge Trial
- 06 Jun 2015 11:46:15 am
- Last edited by KermMartian on 06 Jun 2015 01:19:45 pm; edited 1 time in total

Code golf seems to be all the rage these days, so I figured it might be fun to give it a try here. Let's try the following rules:

1) One challenge will be active at a time.

2) Each challenge should last for a few days, at the discretion of whoever started it.

3) Any commonly-used language is valid (TI-BASIC, ASM, C/C++, Python, Javascript, and Java might be a reasonable set from which to select).

4) You will be on the honor system for the originality of your solution (ie, not just Googling the answer).

5) All discussion and tentative solutions will be put in this topic.

6) Whoever selects a particular challenge can't enter that challenge, but can enter other ones.

Challenge 1: Binary Digits

Let's start with a simple one: Given a 32-bit unsigned (positive) integer, count the number of 0s in the binary representation of the number and display the result. You can assume that the number is given in a variable, like X or x.

1) One challenge will be active at a time.

2) Each challenge should last for a few days, at the discretion of whoever started it.

3) Any commonly-used language is valid (TI-BASIC, ASM, C/C++, Python, Javascript, and Java might be a reasonable set from which to select).

4) You will be on the honor system for the originality of your solution (ie, not just Googling the answer).

5) All discussion and tentative solutions will be put in this topic.

6) Whoever selects a particular challenge can't enter that challenge, but can enter other ones.

Challenge 1: Binary Digits

Let's start with a simple one: Given a 32-bit unsigned (positive) integer, count the number of 0s in the binary representation of the number and display the result. You can assume that the number is given in a variable, like X or x.