I solved the 110502 Reverse and Add problem today. The hardest part was whipping up the worker functions to do text based numbers.
I started by laying out the algorithm in function blocks, then proceeded to full in the gaps. I had two bugs
- my is_palindrome function didn’t have a default return value. It was C++ but even that seems a bit broken, but it compiled!
- my data structure could hold 10 digits (ie 1,234,567,890) as the problem stated, but that didn’t seem enough. Size 100 fixed that.
I haven’t done any simple problem work for a while, and I like the idea of doing some of the Rudy Quiz (albeit in C#), yet the testing structure of Programming Challenges site makes it a contained experience.