Dan D Kim

Let's share stories

Here is the valuable lesson I learned from failing my very first coding challenge

2020-03-09 Dan D. Kimcoding interview


TLDR: practice solving coding algorithm questions with a timer to get good at solving questions with time-pressure. Not just a timer on your smart assistant, but set up the timer on your screen or something so that it’s very in-your-face and you can see each minute ticking down. A quick example would be to use a timer on Google, and make it full screen.


Sunset in Waterloo

The sun is setting over Waterloo, making the depressing campus look somewhat romantic in the orange glare of the sun. I can hear the busy Friday night traffic on University Ave through my closed windows, as well as the laughter of passerby students that coat the air with the excitement of youth. Pretty typical when you are living in the corner of Lester and University Ave. If I think about it, the amount of student parties has serously increased (expotentially!!) since I came to this school.

Tonight though, I’m not going to be on of those happy students drunk in excitement. But I feel great about it, because I have something more important to do. I turn my attention back to my laptop screen, where Riot Game’s internship online assessment is patiently waiting for me. Just one click away from starting the 1-hour timed test. Tonight, if I perform well, I may be considered to work on a game that I waste 80% of my spare time on, for better or worse.

And this is the story of how I f***ed it up.

Riot Games

This was in the pre-Leetcode era (pre-2015). Hackerrank was the go-to practice website, but even then I didn’t do much practice. As a sophomore, I was just dipping my toes into “coding algorithms”. If you were to ask me what “dynammic programming” was, I would have told you it’s when you write code with a dynammic and spontaneous attitude.

The question that I got would have been defined as a Leetcode medium by today’s standards. It was do-able. Challenging, but not terribly hard. Not so easy either. For someone like me who didn’t even practice much, I would run into some problems but eventually solve it for sure.

That is, unless I’m under pressure.

You see, as I began writing my code, everything goes swell. It always does; the beginning of any coding assessment always starts off smoothly. It’s like when you undock your boat off the port and smoothly sail out to sea, until you venture out too far and come across a storm.

I’m designing my algorithm with pen and paper, typing out the code, running little tests, and before I know it, the timer is already down to 15 minutes.

This is when I start to get a little uncomfortable.

I have written everything out but was failing on some hidden test cases. Since the test cases are hidden, I’m stuck with reviewing my code or manually testing other edge-case solutions. I’m frantically trying to do both, re-reading my code and testing various edge cases as they come to my mind.

Pro-tip: To ensure your solution is robust, focus on just reviewing your algorith logic and your code instead of running through various test cases.

My eyes are glancing at the timer more and more often now. With each passing minute, the timer seems to grow bigger and bigger. It as if there’s a gravity field growing around it that keeps pulling onto my eyes for attention.

I write a test, 14 minutes left, run the test, it passed, okay here’s another test, 13 minutes 30 seconds left, this test also passed, dammit I still don’t know what the bug is. What is this edge case?!

The timer is down to 10 minutes. I hastily wipe the sweat off my hands on my lap. I am starting to grow impatient with myself for not seeing the bug in my code. But I’m so close! This is my chance to get that “dream job”! I can’t blow it now!

Then the timer is down to 9 minutes. A single-digit number. My brain is running really fast, but not necessarily effective. It’s like when you are flooring your car but driving like a cow and not getting anywhere closer to your destination.

I read the code. This line seems okay. Then this if statement… seems okay. Then this, that, this… 8 minutes. Shit, okay this while loop, okay, mhm, 7 minutes 10 seconds… where is the f***ing problem?

Timer is at 4 minutes 57 seconds. My mental capacity drops to that of a donkey. I’m reading my code like a primary school student learns to read a book. I look over everything without really being able to debug any different edge cases. I’m slowly starting to accept that I’m going to be able find the bug, and that I am just an average boring candidate. Emotions have kicked out all the intellect out of my brain, making me a frustrated Asian kid that keeps clicking the “Run” button in hopes of getting it to magically pass “this time”. A part of me is hoping that Riot would still consider candidates who didn’t get 100% of their tests to pass. The other part is questioning whether I made the right choice to go into tech.

The timer runs out, and I submit my buggy solution. I get to write a personal note to the HR at the end, where I say that I really enjoyed the experience and would work my butt off if I ever get to work at Riot.

And guess what - I took another look at my code, and found the bug within seconds.

As a student, these moments where you get to envision yourself as an intern of this “dream company” is really quite exciting. Now that I have graduated 2 years ago, I realize that it’s a seriously cherishable moment.

That weekend, I spend a good chunk of time playing League of Legends, joking with my friends that I would make so-and-so changes and bug fixes “once I get the job”. A few days later, my immature arrogance gets a punch in the gut when I read the rejection email, which tells me the typical “We thank you for your interest but you suck so bye” message.


Here’s the lesson for me - practice solving questions with a timer.

Timer

The question wasn’t so bad. My problem solving skills were okay. But the timer psychologically stressed me out when it began to run low. When you need to solve a logical problem, emotions and stress don’t help you perform better. I wasn’t used to having the timer in-my-face while solving a question. So by practicing with a timer, I was able to get accustomed to this and performed a lot better on my future online assessments.

Hope you liked this story. Happy interviewing :)