SETTING: INTERIOR. STUDY ROOM — DUSK
The last rays of sunset are beginning to vanish from the horizon as I lean back in my chair, simultaneously victorious and defeated.
Victorious because I had just gotten the last of the 18 tests to pass on the ‘Roman Numerals’ RB 130 Challenge problem.
Defeated because it had taken me four hours yesterday and three hours today to complete this one challenge.
While I told myself that sticking it out and completing the problem was honorable, a conflicting thought emerged in the back of my mind.
“Taking 7 hours on a single challenge is a big problem. You clearly are not ready to take the RB 139 test, let alone perform well in an interview.”
“At the rate you are currently going, it is going to take you five years to finish Launch School.”
I could write these thoughts off as cynical hostility, and forge onward, subscribing only to the school of positive thinking…
But as I become more focused on re-skilling myself I’m realizing the wisdom of this idea from Ray Dalio:
“Most problems are potential improvements screaming at you.”
In order to be successful, you have to:
- Perceive problems and,
- Not tolerate them.
So call me a hostile cynic, but I definitely perceive a problem:
My solution code for the ‘Roman Numerals’ challenge problem looks like someone took a transcript of a couple arguing at Ikea and made random edits until it complied without errors.
Tolerating this problem and moving on to the next one would be so easy. Out of sight, out of mind. Lingering on the problem and refactoring would be a nightmare. And just thinking about starting from scratch after I spent 7 hours total on this challenge makes my stomach sink a bit. So can I just give myself a participation ribbon for getting all the tests to pass?
Tolerating badness keeps me bad.
I dream of moving out of my current job in customer success (where I answer phones all day) and into software development, where I can create the applications that people actually use.
I know interview day is coming. Some day. And when it comes, I won’t be able to use the same process that led me to taking 7 hours to finish the Roman Numerals problem. I’m going to have to get better. To do that I cannot tolerate badness.
Time For Some Reflection
So how did I get here? What miserable problem-solving process led me to finishing this challenge so slowly?
Here is what I did:
- I started with some pseudo code (good)
- I had some initial success realizing that I should break out each digit in the input number to expanded notation (good)
- I got excited because I got the first test to pass (fine… I guess)
- I didn’t go back and finish my pseudo-code and instead went through the tests one by one, trying to twist what I already had to fit each new test situation (terrible idea).
Each time I got a new test to pass I got a tiny dopamine rush that was just enough of a reward to try and repeat my process on the next test: Just use `binding.pry` and step through each line of code and when it fails on the current test, add something or edit what’s already there to force the test to work. I kept doing this because it worked. It would take forever, but each time I got another test to pass I got a little more confident that I had in me what it took to win this game. Which was apparently soul-numbing persistence.
Quick knowledge bomb:
DO read the test suite in order to get a full grasp of all the problem requirements.
DON’T center your problem solving strategy around getting each test to pass one by one.
There are likely test cases that the test suite missed, and my answer won’t cover them because I only created it to fit the test suite like a glove. Also, what is the point of using the leverage of code and the iteration capabilities of a computer if you are going to just write out each specific problem instance solution one by one?
And so, it’s getting late, and I am going to give myself a rest tonight, but tomorrow, I am going to be starting the roman numerals problem over. I have noticed some patterns regarding numbers with 4s and 9s in them, and how to handle other numbers with 2s, 3s, 6s, and 7s similarly. I think I can come up with a more concise, easer to read 2nd draft.
As I’m getting ready to drift off to sleep I’m reflecting on my deficient problem solving approach. To a large extent, wisdom is earned through experience. You can’t shortcut mastery. You get burned enough times using a poor problem solving process and eventually you smell it before it is able to take you down the wrong path.
Working towards mastery is uncomfortable because it’s uncomfortable to stare your deficiencies straight in the eye and then put the work in to fix them.
Probably the biggest lesson I learned from the ‘Roman Numerals’ problem was to spend plenty of time on your problem solving approach, and to realize when you are using an approach that isn’t going to reach your objectives in the time allotted.
It’s uncomfortable, but it’s the right path. It is essential to bring problems to the surface. In doing so you give yourself a shot at improving, and taking that next baby step towards mastery.