, your new solution is flawless. Indeed, I had intended to ask for improvements upon my method at the end of my note, but apparently forgot to. Your hash method improves the exact portion of my algorithm that I felt the least confident about. I hate using flags like
... too ugly I guess. I knew there surely was a better way, but couldn't quite wrap my mind around it. Thank you very much, as I will be sure to remember this method for future problems.