Category: developerslifestyle
-
You have 10 red and 10 black marbles…
You have 10 red and 10 black marbles. In how many ways can you put the 20 marbles in a row so that no more than two marbles of the same colour lie next to each other? An example of a valid sequence would be: Can you reason your way out of this one or…
-
Beautiful Code – binary search
Somewhere in chapter seven of the book Beautiful Code the following challenge is given: If you have never implemented binary search, or haven’t done so in a few years, I suggest you try that yourself before going forward; it will give you greater appreciation for what follows. Well, binary search? What was that again? Well,…