Sunday, March 27, 2022

How to 10x as a programmer

March 19

Harry W.

I originally wanted to title this as “How to beat the technical interview”, or something of that nature. But, at the last moment, I felt that this is better than that. Sure, my plan originates from how to properly beat the technical interview, which is an idea I got from my last writing; but, I realized that the point of my plan is so that you 10x yourself as a programmer, and as one of its applications of your skillset, you can beat the technical interviews. For a really long time now, it doesn’t sit right with me that for the rest of my career as a dev, I need to spend 200 hours every recruiting cycle to just survive the interview stage. To spend this amount of time during your prime time to just have a possibility of a career choice, while already in the field, is an insult. The most efficient way for me to become a programmer who can make a meaningful impact is to spend the most of my time learning, experimenting, and producing. If the technical interview is here to stay, then the best question I should be asking is “What’s the most important knowledge/skill to have, that will allow me to spend the most of my time develop meaningful products, and minimize the time I need to spend to maintain my ability to beat the interview game”. This is what I will attempt to answer.

I think the appropriate endgame for the technical interview, if I want to answer the question, is to be able to genuinely solve those problems on the fly during the interview, and provide a satisfactory program. On the surface level, this sounds insanely difficult, I have solved a total of 12 leetcode questions; How can I possibly solve an involved problem for a selective company, let alone be able to solve it under the interview constraint without prior exposure to that problem? I think if we limit ourselves to just “how to become a leetcode machine”, our viable solutions are indeed limited. But, recalling my own life story, I went from a mediocre student within an uncompetitive pool, to be able to hang around and occasionally rise above competitive students internationally. The key was that I spent seven years before just focusing on my fundamentals, which allowed me to pursue new fundamentals and develop new insights and combinations without needing prior exposures. The takeaway is that don’t worry about falling behind or ahead of your peers now, if you can truly develop the fundamentals better than everyone else, then the acceleration of compound effect is unbeatable years from now. 

This is what I am proposing: focusing on the fundamentals of a programmer, and becoming better than everyone else in the seemingly basic techniques and knowledge domains. And I can bet that by doing that, it will allow you to be able to truly solve convoluted problems at work or at an interview (i.e. without needing to look up a tutorial). This sounds incredibly risky, and you are going to ask: “How is this going to work? There are millions of us trying to get the most competitive positions, why would doing the basics make us better? And if such solutions would work, why isn’t everyone doing it?” Look, when the 13 year old Harry got to the U.S., there isn’t a solution for him to make true American friends, to be able to compete with American born students for college admissions, to compete with international students in stem fields, yet here I fucking am. Even now, no one is saying: “holy shit, if I talk to new people everyday, read interesting books, try to converse with Americans, and spend time with textbooks, I can actually engage in this culture meaningfully and have an amazing time with everyone”. No, you still see every international Chinese student within their own group, you still see those students struggle during behavioral interviews, you still see them unable to engage within the culture they spend millions of dollars to get in. Even when there is a solution that worked, millions and millions of people still fail to succeed. Because the fear of being the first to try, held them back. That’s how I know. Chinese international students are the overwhelming majority of international students in any college, any country, yet none of them, or only very limited few, are able to talk with you guys like I do. I think that tells you everything you need to know about how likely it actually is to beat the odds. 

So, what are the basics we need to master? In modern programming, that doesn’t concern with language choices, is data structures and algorithms. A true mastery of DS and algos can easily be 10x if not 100x of a programmer's ability and potential. And remember, it doesn’t matter how complicated any interview question is, at the end of the day, they are still built upon fundamental data structures and algorithms. So I will devise a plan to master these two domains over the next year and half. Since an average CS major already has a decent amount of exposure to these topics in their junior year, I think 1.5 years of dedicated learning/practice will set up a fantastic foundation for the rest of your career. Of course, the continued practice of these fundamentals is still needed, much like you still practice the most basic techniques in boxing after 10 years of training, but it will be only there to keep you grounded.

From past experience from my math classes, generally you only need one or two great resources to concentrate on. I will be using “Open Data Structures” for Ds, and “Algorithms by Jeff Erickson” for algos. The following plan follows the philosophy of actually studying a book from start to finish, and only doing appropriate exercise at the right place, and actually solve every problem on your own, without looking up any solutions. (Again, from past experience from my math classes, doable, can be painful at times, but you learn infinitely more) This is the key, if you are stuck on a topic, don’t bail out and watch a 5 minute youtube video, instead, spend 5 hours and truly understand the underlying construct. These 5 hours added up will truly consolidate your understanding; More importantly, these hours spent will help you to read/decipher documentations when there’s no youtube tutorial to help you.

Data structures: End of May to End of August (roughly 12-15 weeks)

Week 1-2: Intro + array_based lists

Week 3: linked lists + Skiplists

Week 4: Hash Tables

Week 5: Binary tree + Random Binary search tree

Week 6: scapegoat tree

Week 7: Red-Black tree

Week 8: Heaps

Week 9-10: Sorting: merge, quicksort, heap_sort, counting, radix, 

Week 11-12: Graphs

Week 13: DS for integers

Week 14: external memory search

Note: yes, I do realize this is basically cs400. But I don’t think I did myself justice during the course. And I was way too focused on the programming side that I didn't understand a lot of the fundamentals of the basic trees or search or sorting. If you cheated a bit during the class, especially if you got caught cheating, I think that’s a great reason to do it properly this time.

Algorithms: (since algos is really really hard, I am planning to spend a year)

Graph fundamentals: 1 month

Recursion + backtrack: 1 month

Dynamic programming: 1 month (or even more)

Greedy algorithms: 3 weeks

Depth first search: 3 weeks

Minimum spanning trees: 2-3 weeks

Shortest paths: 1 month

All pairs shortest paths: 2 weeks

Max flows + min cuts: 3 weeks

Application of networks: 2 weeks

Advanced DP: 3 weeks

Minimum cost flows: 2 weeks

Linear programming: 2 weeks

Linear programming algos: 2 weeks

Nuts and Bolts: 2 weeks

Hashing: 2 weeks (optional)

Amortized analysis:  1-2 week

String matching: 2 weeks

Solving recurrences: 2-3 weeks



Winning the game V.S. beating the game

March 16th, 2022

Harry W.

This is one of my 1 AM spur of the moment writing sessions, which are the best writing sessions. For quite some time now, I have begun to grasp the true meaning of compound interest, personal development, and competing against others, now I will attempt to put them together. I want to write this down so I can remind myself from time to time why I am choosing this path of life, but I am also writing this because I want others who might enjoy this to see my thought process and life story. For now, I have a couple people in mind, I guess this is also dedicated to you. To Robert, stay strong; to Prafull, you are way smarter than you think; to Samir, thank you for all the encouragement you gave.

To summarize competition vs compound interest in one sentence: by competing with your peers, at best you can beat your peers by 1%; by compounding your abilities, on average you can 10x your potential. 

I want to tell my life story first. I moved to the U.S. with my family when I was thirteen. During all my time in China, from elementary school through middle school, I was a really mediocre student. This is extra bad considering I was in Shanghai. The situation is, there are way more resources in big cities than in the countryside, this means by the sheer luck of being born in the big cities I have way less competition than an average student from smaller cities. This also means that the academic barrier to enter college in the big city is orders of magnitude lower than the academic barrier in the rest of the country. It is a well known secret that even a top student in Shanghai would be barely mediocre if placed among students from a poorer region. I think that depicts an image of my academic skills when I was thirteen. 

After I moved to the U.S, I struggled a lot to adapt to a new language, and making new friends. Even though I was fairly social and I strived to become well read, my stint at Vermont was less than satisfying. There’s one moment that is forever cemented in my brain: during the social study class in my freshman year, we had to record our own speech and write a critical reflection of our recording. I will always remember my disgust and disappointment when I watched my tape, as I realized I couldn’t understand a word I said, even though I wrote the script, and I said those words. That’s where I began my journey. Along with the fact that I didn’t have true friendships that I can trust, I didn’t have any regrets when we left Vermont.

After I arrived in Wisconsin, I made a commitment to make meaningful friendships. I would rather stay alone than stay with crappy friends. So for the first three months, I walked to a random lunch table everyday and introduced myself. It was awkward, and it was lonely, but it was the best thing I could have done. I eventually met multiple great friends whom I am still in contact with. It was that spirit that allowed me to meet all of you guys. Academically, I always recorded myself and practiced over and over again for any speeches I had to make. Because of those recordings, I became ultra aware of my pronunciation, and I am still conscious of pacing of my speech when I converse. Of course, from time to time, I tried to make time to read. My fondest memory of reading is the novel “To Kill a Mockingbird”. When I first read it in my Freshman year, I struggled to understand what each paragraph meant. When I read it again in my junior year, I understood each paragraph and page, but I couldn’t understand what each chapter wanted to say. And when I read it for the third time this past summer, everything just clicked, it was the most rewarding moment of my reading career. Similarly, when I tried to read “Percy Jackson” when I first came to Vermont, it was the most frustrating experience as the vocabulary was way above my league; but now I can zip through 60 pages in an hour (ok, that’s not like impressive by any means, but it’s a huge progress). Even though I still sucked in reading/English during the ACT, I was making steady progress.

So why am I telling you guys this? Ok I promise it will come together in a moment, please be patient. I breezed through highschool Math with straight A’s, since my experience in China made the U.S. math fairly easy, that was changed overnight when I got to UW-Madison. I unknowingly took honors linear algebra, and then got BC in the course. Despite my hours of hours of effort, linear algebra evades me. And after suffering through discrete math and multi variable calculus with average grades, I was frustrated and deflated. Remember when I mentioned how a student in Shanghai measured up against other students? My experience in those math classes, with other international Chinese students, was a painful reminder that I am still miles away from their level. 

Things took a turn during the past summer of 2021. Since I didn’t get any internship, I spent the bulk of the summer just reading. I enjoyed the times when I could immerse myself into different fictions, and then I realized something. I was able to enjoy and understand all those details in a novel because I took the time and patience to read and reread a book, but I never spent the time to read and reread a math textbook. So I took a chance on myself, and took number theory this past fall semester. My approach was that I spent 2 hours every morning studying the math textbook. I forced myself to spend 2 hour even if I could only progress one page in a day. And that opened a door to a whole new world to me. For the first time in college, I got a 95 on every math test. And that’s why I became a math major.

And this, my friends, is where everything comes together. In my abstract algebra class, I met a Chinese student. His name is Bill (name changed obviously), and surprisingly, he had a very similar path compared to me: he came to the U.S. during his freshman year in highschool, and then applied to colleges like a normal U.S. student. Except for one thing, before he moved here, he was a top student in a rural part of China. When we shared our stories, he was surprised by my English and my level of engagement to other people. Even though we had an identical path since highschool, he was only friends with international Chinese students, yet I have friends from the U.S. and Poland. Even though we took similar classes since highschool (in different states), and he was arguably 10x better than I was, I helped him from time to time in our math class, and I explained to him my implementation for a database group project. During one late night conversation, he said that he also struggled to meet friends in highschool, and after a while, he gave up on talking to new people and turned to video games. And when he also struggled in social sciences, he didn’t try further to become well read. 

The reason why all of these international Chinese students are extremely competitive in stem fields is because they spent years training tirelessly on problem sets. They are the equivalent of academy vetted soccer players (analogy thanks to Samir), where they devoted their life to those problem sets and nothing else. And yet, in my abstract algebra class, I am just as competent as them, and sometimes even able to provide help to them. The reason being: although they are extremely skilled at applying recurring patterns to a new problem set, they lack the skill of creating new patterns from the fundamentals. When you have a wealth of patterns to pull from, you appear to be incredibly talented, but at 500 level math, when everything is taught from fundamentals again, sometimes they are a deer caught in the headlights. The story of Bill made me realize how important communication and reading skills are. It is crucial to be able to talk to peers about a problem, and read dense textbooks on your own. It is almost comical in my math class, where half of the class is Chinese students, yet I am the only one who actively participates and talks to other students. There have been several instances where I talk to a few U.S. students, then Bill, or other Chinese students would ask me what we just discussed. Although they have a bank of knowledge to rely on, they couldn’t read a math textbook to save their lives. All of their enormous advantages were wiped out when a math class focused on how you learn rather than what you learned. 

This ongoing experience taught me a valuable lesson. Because I was focused on improving my own skills in communicating, reading, and social skills over the past 7 years, I was able to 10x my baseline due to the compound effect. But, had I focused on competing directly with the international students, then at best I could have only been marginally better than them temporally. Had I only focused on a particular problem set, or a particular competition, then I would have fallen to their level instead of 10x my own skills. One is constant marginalized improvement, the other is orders of magnitude of change.

That is my life story. Now I want to project forward. Since I am a CS major, I have got to talk about the technical interview. Nowadays, it is so common for college students, professionals, or even senior developers to spend 200 or more hours during the recruiting season on leetcode. That’s 200 hours every recruiting season. In the past few days, I had this moment of realization: leetcode (or other technical prepping), has become the “academy”. And one the biggest myth we have been told is that in order to rise to the top of the industry, we have to become one of the academy vetted players, or we simply couldn’t compete with our peers. But just like my story, we are so caught up in solving a “medium” leetcode v.s. a “hard” leetcode that we are all asking the wrong questions. It doesn’t matter which problem we solve, in the best case scenario, we beat our peers by 1%. That is, in the best case scenario, after spending 200 hours of prepping, if you get lucky, you just barely edge out your peers. And you gotta do it all over again in the next cycle. So, this is the moment of truth, where all of this essay comes to life. Instead of focusing on how to temporally beat your peer, the right question should be: “how should I 10x myself?” Because no matter which questions you master, a new problem will wipe out your advantage; but, if you can improve your skills, in this case, technical interview, by an order of magnitudes, then in the next cycles, years, or decades, your skill sets simply become unreachable. 

So how do you actually do it? In my own story, all of my reading was invaluable. Because of the books I have read, I have the patience to truly grasp a concept, and the volume I have read allowed me to tackle more dense, technical literature. I have three questions for all you in CS: 1. Do you think a rock solid foundation in algorithms and data structure will help you in technical interviews? 2. Have you ever read a book in algorithms and DS from start to finish? 3. How many problems can you apply to with a rock solid understanding in these?

The thing is, 99% of CS majors can’t read a textbook to save their lives. But, books are written for a reason, and classic books are classic for a reason. If you can sit down and truly understand a book in algorithms, then I am willing to bet on myself that this knowledge will outlive any “medium”, “hard” leetcode problem. There are many people who complain that CS theory is useless, but how many of them have actually spent 20 hours of high quality reading on any chapter? And how many of those people actually spent time to apply the knowledge in practice? 

Exceptional growth first comes from exceptional mastery of the fundamentals. Five, ten years from now, the leetcodes we will face will be drastically different than today, but the underlying algorithms and DS will remain the same. Because it’s March, I will make some basketball analogies. After becoming the first ever 1st seed to lose in the first round of the March Madness, the head coach of Virginia said: “Great basketball knows no division, limits, or background”. In my own story, a great Mathematician knows no division, limits, or background; and I will state now that great programmers (technical interviewees?) knows no division, limits, or background. 

It is a huge gamble to be willing to give up your advantages now. But I truly think that spending time to invest in knowledge that will last for decades is a way better investment than spending time to maximize your return now, but plateau in three years. The trick is to know which is which. So, I am asking you to think deeply, to figure out which investment will make you orders of magnitude better, then take a leap of faith. 

One of them will win you the game now, the other will make you beat the game once and for all.

Thank you for reading.