Quarantine Thoughts - Competitive programming - Hitting the (inevitable) wall - The slow grind

Quarantine Thoughts

Reading this post-Covid-19 might be interesting.

Upon writing this I’ve spent the better part of the past 3 months “house-bound” due to coronavirus. It was a fairly necessary precaution to lessen the spread and keep people safe. Back in late February I didn’t go to the office, instead I worked from home. I chose to stay in Bellevue as opposed to going back to Canada and WFCanada.

The usual hobbies of travelling, bouldering, going to the gym, and trying fancy dessert places were replaced with things that were more suited for being on the computer and being stuck at home. What did happen in that time span? I initially wrote this for the focus on competitive programming, cooking, video games, and what shows/movies I saw during the break but competitive programming took the lead on everything else so it will be solely focused on that.

Competitive Programming

I decided to take competitive seriously around the start of March 2020. I had tried it out previously with mixed results. I was completely self-trained as I never did CCC in highschool and I had only learned about competitive programming in university. I didn’t even code until university. I did Waterloo math contests in high school with fairly average/below average results. I didn’t have the experience or early exposure to coding. I did have a little bit of a stronger math background due to doing an extracurricular math program in high school called “Spirit of Math” in high school. But even there I was not a star student.

My first foray was Local Waterloo ACM contests. My goal in each contest was to solve 1 question. Most recently I did the Local Waterloo ACM contest back in February (remotely) but I was unable to solve even 1 question. Even in previous iterations of the contests I had solved at least 1 question. Contests varied in difficulty, but it felt discouraging to not even solve 1 question for the past 2 contests.

Local Waterloo ACM Contests

Previous results:

Needless to say I was out of practice. I hadn’t solved a question in a local acm contest since winter 2019. My other goal was to be in top 50% of people. This has yet to occur.

p.s. I look forward to Spring 2020 contest.

At the start I had a rating of 1693 on leetcode weekly contests (which I deemed admirable but could be improved upon) and (an abysmal) 1139 on codeforces. Initially I said I would probably get to 1693->1800 on leetcode as a very attainable goal and get out of newbie grey land on codeforces. (which is below 1200, a place no one wants to dwell)

Initial Leetcode Graph

Initial Codeforces Graph

Leetcode Contests

I reached 1810 in 3 weeks. It was fairly easy and was a lot of fun doing the contests. So I did what anyone else would do after they achieve a goal and challenged myself to get to 1810->2000. That would prove to be a much more challenging feat. It is also worth noting Leetcode contests are fairly easy to be ranked that high if you know what you are doing. I would even equate a 2000 in leetcode rating to only 1400-1500 in codeforces since there is a higher concetration of talent on codeforces.

My rating kept rising week after week reaching 1970 at the peak. 2000 was in sight. I needed a measly 30 points. And that week I proclaimed it the 2k contest. There was no way I had risen for the past 5 weeks and NOT reach 2000 this week. I proceeded to drop for the first time in over 80 weeks and the first time since my return to Leetcode contests.

Codeforces Contests

Rising from 1139->1200 proved to be an easy task since I was already ranked so low any performance would rise my ranking. After a few contests I reached 1395. Specialist ranking was 1400+ and was in sight. I only needed 5 points. Even closer than when I wanted to reach 2000 in leetcode and had the 1970. I had gotten out of newbie grey land and was about to exit pupil green land to join specialist cyan land. I hit a stumbling block on two contests only solving 1 question in the div2 contests knocking me down to 1307.

Hitting the (very inevitable) wall

I was bound to hit a wall eventually. Leetcode I started with 1693, I had gotten to 1800 really quick and fairly quickly to 1970 afterwards. I had gotten to pupil in codeforces similarly quick, rising from 1139 to 1242 in the first contest. I had a minor drop in between but eventually rose to 1395. It only felt natural when I had the most pressure to do well and when I was obsessed about what it would be like to finally reach my lofty goal, I would falter. I imagined “Would it be as great to reach that rating benchmark?” There was no room for failure and no way I could fail. I had continuously risen for 5-6 weeks. But it happened.

I had hit a wall. I sputtered down to around 1940 on leetcode but couldn’t get over 2000 like I had wanted. Codeforces I dropped and rose slightly to a rating of 1371 which was close to 1400 but I couldn’t manage to get over the pupil hump to push myself over 1400.

Why was I even doing this anyways? This rating number was a poor metric of interview solving, problem solving, and overall self-worth. I had achieved my initial goals to get to 1800 on leetcode and out of grey in codeforces by getting above 1200. I achieved that and I should be happy where I got to. I was nicely hovering 1300 on codeforces and 1950 on leetcode. Why not just pack it all up and say I had a good run. I didn’t possess the talent at this stage to reach these new higher goals. If anything if I reached these then what happens? Do I just set a higher goal that is harder to achieve and more stressful? Why was I even doing this anyways. Was it just to raise a number?

Maybe this was all meaningless. I had a full-time job and interviews were hardly about solving problems anymore. My Fall 2019 interviewing cycle proved that. Where multiple places would ask questions that ultimately were solved by me but they would still say no. Even one company I interviewed with asked me for hobbies and I said “competitive programming”, which they replied “no I mean real hobbies”.

I often wondered why I had decided to pursue competitive programming, even in this quarantine time. I chose to wake up for those contests, lose sleep over practicing problems, and reading code. Initially I just thought it would be a fun hobby to test my programming skills. To do it for the wrong reason was as empty as not doing it at all. If I continued to pursue it for the numerical rating and not as a basis for learning I would lose motivation at the next rung of the ladder. The context of why we do things is as important as doing them. If you do things for the wrong reasons and don’t understand why, the outcome may be beneficial in the short term but doesn’t last. Code may get accepted but doesn’t guarantee you understand, why it is right, or why it may pass pretests but fails the longer tests. (Which happened to me on a two contests)

I decided that everyone’s rating has to drop as nothing at some point and nothing is absolute. Just as I had initially started out doing it to learn more and solve problems, the rating aspect was just a quantitative measure of not only the progress I had made but the improvement from where I first started. I had done ~83 leetcode contests and initially it was rough since I was weak. I struggled intiially to rise above the starting benchmark of 1500. I had to practice and get better. I had to acknowledge striving for excellence, the work to achieve the current, and what didn’t work in the past. It was a tandem of experiences that brought me to this point.

The slow grind

Competitive programming always felt like any other hobby I did for fun. It was about solving problems under intense time constraints and testing your knowledge. Wrong answers were penalized and right answers were correct for a distinct reason. Thinking about the video games I played: Pokemon Showdown and SSBM you are literally mano a mano trying to outsmart an opponent, Fallout (NV or 3) RPG-like elements had you solving issues and conflicts, Clone Hero had you learning patterns of notes in music and executing them in a rhythm, BTD6 was an optimization problem with constraints on money and ever growing fields that needed to be satisfied (camo, moab, bloon speed/health). I enjoy those games because at their core they were challenging and they required deductive reasoning. Competitive programming is no different. Just because the medium was coding didn’t change the fact that it was fun.

Some weeks I would be doing anywhere between 3-5 contests to try and learn as much as I could by solving. A lot of the codeforces contests are not favored for PDT and more focused on Asian countries such as Russia and China. As a result, most required me waking up at 7:30AM PDT, doing a 2-2.5 hour contest, then resuming my normal workday from 9am-5pm.

I acknowledged that I needed more practice. (and I still need more practice) So I decided to do EVERY codeforces available contest and EVERY leetcode contest. I had the mentality if I practiced more I would gradually improve. It was tough seeing my rating drop after a poor performance on a contest. But if you are staying vigilant and doing it for the right reasons you’ll stay motivated.

Final Thoughts

I talked a lot about ratings and numbers here. I think ratings are nice indicators but they only tell part of the story. I focused on solving techniques. If I didn’t get a problem, I would learn what I did wrong, and how to solve it. So next time there was NO way I was not going to not be able to solve it again. I was not here memorizing problems for the sake of interviews hopefully having frequent questions. Similar questions occur but the basis of solving shouldn’t be hinged on familiarity.

What happened was I kept trying despite my stagnation. If you were to ask me I think my ratings are currently a little inflated. At the time of writing this my Leetcode contest rating is 2056 and Codeforces is 1442. Due to a strong performance in the most recent contests in both I reached 2000+ in leetcode and 1400+ in codeforces. They will probably drop in the near future. But a drop isn’t the end of the world. I cherish the hard work I put in. I acknowledge that I am happy with what I accomplished but there I want to achieve more. I know that the drop means there is more to learn. Because there is always more to learn. My extended goals are top 1% in leetcode contests (top 1000, currently somewhere around 1400) and 1600+ in codeforces the next rank which is expert aka blue. Both are immmensely challenging and daunting goals. But why do we consistenly challenge ourselves? To see how far we can push ourselves.

Current Leetcode Graph

Current Codeforces Graph