My solutions to https://www.readyforzero.com/challenge
Overall, I enjoyed them. They reminded me of when I used to work on Project Euler problems. I'll admit I was a little like "meh" when I solved the second one. The insight that every other char is an edge renders my BinTree pointless. But I kept it in there since that's how I got that insight. (I always hated that on Project Euler, too, when I would write some code that I would be really proud of, and through the process of writing it and refining it, I'd finally realize that all of it was irrelevant due to an insight like this).
I also didn't like on the second one how they called it a binary tree. I thought of a couple examples that proved the problem couldn't be solved, and walked away. The next day in the shower, I was thinking about what implicit assumptions they must have made that allowed that problem to make sense, and I realized they must have meant for it to be balanced, causing each non-leaf to have exactly 2 children.
I enjoyed the third problem, but suspect my solution isn't the algorithmically genius way of doing things. I thought about looking up the right algorithm for it, but whatever. I do these to challenge myself, looking up and then implementing the best solution is what I'd do if this were for something in production. But that isn't what this is, this is just exercises to challenge myself, so I decided to solve it myself.
This code is unmaintained.
If you do something interesting with it, let me know so I can be happy.
Copyright (c) 2011 Joshua Cheek
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.