Triumph over Toy Soldiers

In my quest to become the best software engineer possible I realized that toy problems are on of the best tools available to help me ascend technically and algorithmically. Now, this realization wasn’t an easy one to come by as I notoriously loathed having to solve them but over the past five weeks I’ve almost come to love them. My shift in attitude has largely to do with one specific problem that has haunted me over the past couple of months.

During the pre-course portion of Telegraph Academy each incoming student is assigned a mentor that we are to check in with every week. The mentor would assess our progress mentally, and technically through conversation and of course a toy problem!

screaming

I somehow had made it through all my check-ins with flying colors, toy problems and all… that is of course until the very last week. I was given a problem that seemed to encompass a mad combination of all my least favorite things: Math, Roman Numerals, and Infinite Loops. I immediately asked for another problem but I knew as soon as the sentence left my mouth that wasn’t going to be an option. I repeatedly read the problem over and over again trying to make sense of something but the instructions simply ended up being a jumbled mess in my brain. I blindly began coding but I knew my direction was going the absolute wrong way and I couldn’t pull myself together. I was sweating, panicked that my mentor would rescind the invitation I’d worked so hard for, but my mentor assured me that my progress up to that point had solidified my spot and should just work on the problem in my free time leading up to my first day…of course I never touched it again, thinking I had seen the last of that problem…I was wrong.

Over the past five weeks the Junior and Senior class take the first hour of the day to work on a specific daily toy problem, to get our brains going and to aid in our algorithmic problem solving. Needless to say I wasn’t too happy when I found out this was going to be a thing but I understood it was important as a result I tackled each problem everyday catching on to certain patterns the problems tended to have. I was by no means solving the different problems everyday and more often than not I would become discouraged, but my trust for the TGA program would not let me quit.

Friday morning I walked into TGA well rested (for once!) and ready to get the day started, that was until this happened:

Screen Shot 2016-04-26 at 11.26.19 PM

Roman Numeral Translator….Well at that moment I began to feel the panic spread over me again, not because my standing at Telegraph Academy hinged on it but because it would directly show me if I had made any progress over the past couple of weeks. Immediately I calmed down and thoroughly read the problem over three times to ensure I truly understood the directions. From there I began to code…

Screen Shot 2016-04-26 at 11.41.34 PM

I set up the main translateRomanNumeral function first and then moved on to  my helper math function as a way to keep my code modular (important!) so that I didn’t get bogged down by too much happening in one function. Below is my helper function:

Screen Shot 2016-04-26 at 11.45.21 PM

After testing it a couple of times to make sure my logic was where it needed to be I realized that IT WORKED! Now I realize that there are much harder toy problems out there, trust me I’ve seen some beasts, but for my personal growth within this program it was a pretty awesome feeling to conquer something that at one point was such a point of discomfort. I’m sure when I head back to TGA on Monday I’ll be faced with another doozy but now I more than welcome the challenge!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s