Red-Green-Code

Deliberate practice techniques for software developers

  • Home
  • About
  • Contact
  • Project 462
  • CP FAQ
  • Newsletter

A Project for 2021

By Duncan Smith Jan 6 0

January 1 2021

In the geeky world of programming puzzles, programming interviews, and competitive programming (loosely defined), LeetCode is one of the major players. And on LeetCode, 2021 begins with another month of LeetCoding Challenges. In my 2020 wrap-up post last week, I described the process that I use to get the most out of these challenges. I plan to continue refining that process in the coming year.

Model Solutions

As I argued in last week’s process article, solving a new coding puzzle every day is useful, but it’s not the most efficient way to gain expertise. To learn these problems well, you have to repeatedly return to previously-solved problems until you’re intimately familiar with the algorithms, data structures, and techniques that come up regularly. The first step in this process of repetition is creating a model solution.

When you solve a LeetCode problem for the first time, the quality of your solution will vary a lot. If the problem is similar to one that you have already learned well, your solution might be close to optimal. If it requires an algorithm or technique that you have never learned, you might not be able to solve it at all. Or it could be somewhere in between.

If I decide to solve a problem a second time (because it meets my criteria for a good problem) and I didn’t find an optimal solution the first time around, I don’t just repeat my own solution. That would have the effect of reinforcing whatever shortcomings I included in the solution. Instead, I first do some research on how others have solved it. LeetCode sometimes has an official solution, but I find the LeetCode discussion forums to be even more useful, since they provide a range of ideas from multiple contributors. Using the advice I find in the discussions, I write a model solution consisting of both code and explanation. Although the code in my model solution often draws on a working solution from the discussions, I don’t just copy and paste it. I re-write the solution in my own style, make sure I understand what the code is doing, and submit my re-written version to ensure that it passes all the test cases. I also write an English description of the solution and, if necessary, create diagrams illustrating the solution details. As I practice the model solution over time, I update the code and the description to be more understandable and easier to learn.

Periodically this year, I plan to publish examples of these model solutions as blog posts, supported by code on GitHub.

Quora in 2021

In 2020, I decided to do my weekly writing in the form of Quora answers, which I linked here each week. I plan to do that again in 2021 on weeks that I don’t publish a model LeetCode solution. As always, I will also post a daily link in the Coder vs. Coder space on Quora.

The reason for using Quora in this way is the same as last year: Quora is still the place where a critical mass of people gather to discuss topics related to competitive programming and coding interviews. These topics also come up on Reddit, Hacker News, Codeforces, LeetCode, Stack Overflow (where they are immediately deleted), and other places. But for all its many faults (and they are numerous), Quora is a reasonably canonical online source for these topics, and there are always questions being asked there.

Good luck with your own projects in 2021!

(Image credit: JuliaC2006)

Categories: LeetCode, Quora

Prev
Next

Stay in the Know

I'm trying out the latest learning techniques on software development concepts, and writing about what works best. Sound interesting? Subscribe to my free newsletter to keep up to date. Learn More
Unsubscribing is easy, and I'll keep your email address private.

Getting Started

Are you new here? Check out my review posts for a tour of the archives:

  • 2022 in Review: Content Bots
  • 2021 in Review: Thoughts on Solving Programming Puzzles
  • Lessons from the 2020 LeetCode Monthly Challenges
  • 2019 in Review
  • Competitive Programming Frequently Asked Questions: 2018 In Review
  • What I Learned Working On Time Tortoise in 2017
  • 2016 in Review
  • 2015 in Review
  • 2015 Summer Review

Archives

Recent Posts

  • LeetCode Tip 48: Beyond Model Solutions December 6, 2023
  • LeetCode Tip 47: Focus on the Problem, Not the Algorithm November 29, 2023
  • LeetCode Tip 46: Are You Improving? November 22, 2023
  • LeetCode Tip 45: Forgetting and Remembering November 15, 2023
  • LeetCode Tip 44: Taking Advice November 8, 2023
  • LeetCode Tip 43: Find the Zone of Optimal Improvement November 1, 2023
  • LeetCode Tip 42: Getting Past a Learning Plateau October 25, 2023
  • LeetCode Tip 41: Make Sure Your Skills Will Transfer October 18, 2023
  • LeetCode Tip 40: Learn Dynamic Programming October 11, 2023
  • LeetCode Tip 39: Learn the Process of Finding the Solution October 4, 2023
Red-Green-Code
  • Home
  • About
  • Contact
  • Project 462
  • CP FAQ
  • Newsletter
Copyright © 2023 Duncan Smith