My First Attempt
Very close! Far from eloquent, but for me, eloquence comes easiest with iteration. I was quick to index in on the problem, which was the the description asks for alphanumeric parsing, and I only did the alpha part of that.
Unfortunately, I made a silly mistake, and hastily replaced my a-z
to a-z1-9
, not even noticing that of course 0
is omitted from that range. So…very quickly fixed it, but then wasted 7 minutes in realizing how my fix was inadequate. I THEN preceded to almost rewrite the second half of the entire algorithm, not even thinking about how this is actually an even case anyways.
Second Attempt
I returned to this really hungry to understand the basics of regex so I went into it here Regex Baby Steps (in Javascript). After playing around a bit, I got this:
Let me go back and see how it compares to the previous iteration.
checks previous code
Oh dear god that’s awful. Cool! making progress!