Interesting numbers have a mathematical property that makes them handy in a certain way. For programming, these numbers present useful binary patterns that may be obvious in hexadecimal but meaningless in decimal. For non-programmers and non-mathematicians, interesting numbers offer visual patterns that most likely have no useful application beyond their look.
Continue reading
Category Archives: Solution
Find the Duplicates – Solution
I devised two solutions for this month’s Exercise. The basic solution can be solved in two steps, with a more involved solution using three.
Continue reading
The Wandering King – Solution
This month’s Exercise was inspired by a program I recall from years ago called The Drunk and the Lamppost. It’s not the classic joke, but an examination of random movements and probability.
Continue reading
Fizz Buzz – Solution
The nifty thing about this month’s Exercise is that so many solutions are available. In fact, I found the challenge engaging because I kept trying to think of other ways to solve the puzzle.
Continue reading
The Whole Month from a Single Day – Solution
The key to creating a calendar is to know on which day of the week the first of the month falls. This datum can be extrapolated from any other day of the month, as long as you know on which day of the week it falls.
Continue reading
Counting in Alphabedecimal – Solution
Yes, it’s possible to code a program that counts in alphabedecimal from AAAA to ZZZZ without using nested loops. You must use a single loop, of course, but no cheating as shown in the original Exercise post.
Continue reading
Initial Caps – Solution
The solution for this month’s Exercise is perhaps a bit trickier than you may have anticipated. The issue is to set the first letter of a word as upper case and the remaining letters lowercase. The solution I devised involves reading two characters at a time.
Continue reading
Shuffle That Playlist – Solution
The solution to this month’s Exercise is similar to code I’ve presented in my books and in this blog with regards to randomly drawing from a fixed set of elements. Yet it has an extra level of complexity.
Continue reading
Duplicated Letters – Solution
The challenge for this month’s Exercise is to write code that counts repeating letters in a string. For example, the string “Hello, this is a test” repeats the letters T and S three times, letters E, H, I, and L twice, and the letters A and O appear only once.
Continue reading
Fill My Grid – Solution
The puzzle for this month’s Exercise was to create and fill a 20-by-20 character grid with 20 asterisks placed at random positions, no two asterisks in the same spot. I hope you found this Exercise interesting, but not too easy.
Continue reading