dagblog.
← Archive

Programming puzzle


Today's programming puzzle is more of a teaser for kids. Take the following code.

int array [] = new int[10];	
for(int i = 0; i < array.length; i++){
.
.
}

What is the smallest number of statements you can use, without modulo, to fill the array efficiently so that ones and zeros alternate, giving 1010101010?

Medium version

Related articles

Related CZ Podcast episodes