Comment by dokem
4 years ago
Something about this comes off as amateurish. The obsession with minimization. Just use a switch statement. Now where is the bug going to hide? The solution doesn't need to generalize, there is only a small handful of different solutions. Just break them all out. It's more maintainable and readable and requires less thinking.
I don't know why you are being downvoted. The best solution here is for the author to admit using log was a bad idea and rewrite an entirely different version.