Red-Green-Code

Deliberate practice techniques for software developers

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

LeetCode Tip 4: Model Problems

By Duncan Smith Leave a Comment Feb 1 0

LeetCode 2023

The first goal of LeetCode practice is to learn how to solve problems associated with one concept. A LeetCode tag identifies each concept, and each problem has one or more tags. In the beginning, you don’t have to worry about learning concepts more granular than a tag, determining what concept an unknown problem is looking for, or solving a problem within a time limit. Those are all worthwhile skills to learn, but they are better left for later.

Although focusing on one tag is a narrow goal, let’s narrow it down a bit more. The hash table tag currently has 449 problems. To get started, we could solve the first easy problem, read a textbook chapter about hash tables, or check if one of LeetCode’s Explore cards covers hash tables. Instead, I suggest approaching the goal by starting with a model problem.

Serious study of algorithms and data structures often begins when you take a course, and such courses rely on practice problems. (Programming is a skill that you can’t learn just by reading about it). The model problem approach combines problem-based learning with the strengths of the LeetCode platform. The idea is to pick a concept, then find one or more problems that apply that concept in a way that you find understandable. When you need to apply the concept to a new problem, you can then draw on your experience with the model problems.

For example, let’s say you’re starting one of the 449 hash table problems. One approach would be to think about what you know about hash tables — you can insert and retrieve data in (average) constant time, you can store key/value pairs, each key must be unique — and map them to aspects of the problem. With the model problem approach, you instead think about a specific hash table problem that you have learned well, and you map parts of that problem to the new problem. Rather than concepts or pseudocode, you can map blocks of actual code. When you learned the model problem, you practiced correct syntax and typical usage patterns, so you have examples in your head of how hash tables help solve a specific problem. You can apply this practical knowledge to the new problem, rather than having to first translate hash table theory into practice.

This year, I’m publishing a series of tips for effective LeetCode practice. To read the tips in order, start with A Project for 2023

LeetCode Tip 3: A Goal for LeetCode Practice

By Duncan Smith Leave a Comment Jan 25 0

LeetCode 2023

If you believe in the goal of preparing for coding interviews and you agree that LeetCode is a good way to pursue that goal, you may feel like getting on the site and building a daily streak. But it’s important to pick the right priority to focus on during this daily practice. While you can get some benefit out of simply opening LeetCode’s daily challenge problem and trying to solve it every day, there’s something missing from this type of practice. This year’s tips will fill in the gaps in the familiar “practice, practice, practice” approach.

Companies don’t use algorithmic coding interviews to test you on every conceivable computer science or software engineering topic. They focus on a relatively small set of concepts. You can find these concepts in the list of tags on the LeetCode problem page. Ordered by how often they appear in the LeetCode problem set, the first 10 concepts are Array, String, Hash Table, Dynamic Programming, Math, Sorting, Greedy, Depth-First Search, Database, and Breadth-First Search.

With this list of concepts in mind, we can target a more specific practice goal. Rather than practicing the skill of “solving LeetCode problems,” we can instead practice the skill of “solving Dynamic Programming problems” or “solving Depth-First Search problems.” That’s not to say that this skill will give you what you need to solve any problem, since you won’t always know which concept you need to use. But if you suspect that you’re looking at a Depth-First Search problem, it won’t do you much good unless you know how to implement Depth-First Search.

With that in mind, our first set of LeetCode tips will look at a process for learning the LeetCode algorithms, data structures, and techniques found in the tag list. We can ignore, for now, the general problem of how to solve a random LeetCode problem. Instead, we’ll focus on choosing a LeetCode tag and learning how to solve problems associated with that tag. If we can do that with one tag, we can do it with two tags, then three tags, and so on. Eventually we’ll reach the point where if we know which concept a problem requires, and if the problem has a reasonable difficulty level (i.e., Easy or Medium), we’ll have a good chance of solving it. No flashes of insight required.

This year, I’m publishing a series of tips for effective LeetCode practice. To read the tips in order, start with A Project for 2023

LeetCode Tip 2: A Sample Problem

By Duncan Smith Leave a Comment Jan 18 0

LeetCode 2023

To help make the upcoming tips less abstract, I’m going to start with a sample problem that I’ll refer to when needed: LeetCode problem 704, Binary Search. I chose binary search because it has a short implementation that uses only basic language features, but even experts have trouble getting it right.

« Continue »

LeetCode Tip 1: Why LeetCode?

By Duncan Smith Leave a Comment Jan 11 0

LeetCode 2023

We’re going to be covering LeetCode tips in the coming year. But before we get to the tips, I’d like to discuss why I chose LeetCode as a study topic, so you can decide if this year’s project is right for you.

I chose LeetCode because:

  • It focuses on coding interviews: There are several reasons you might want to study algorithmic coding problems. But for this year’s project, we’re going to focus on one: Preparing for a coding interview. We won’t ignore the other reasons entirely, but the focus will be on the practical goal of getting better at the coding interview process. This aligns with LeetCode’s strengths, as compared to a competitive programming site like Codeforces or a general textbook like Introduction to Algorithms.

  • It has an active community: There are other sites for building coding interview skills. But LeetCode’s popularity gives it some advantages compared to other sites: It has an active discussion section for every problem, two weekly contests generate a regular supply of fresh problems, and the LeetCode company receives enough income to keep the site up to date. There are many programmers with the goal of preparing for interviews, and we might as well go where most of them are.

  • It supports regular practice: The way to get better at coding interview problems is to write code and see how it performs on tests. This matches the core LeetCode practice loop: Read a problem, design and implement a solution, run it on test data, and try again (or move on to the next problem).

The tips we’ll be covering this year promote two goals: 1) Practicing coding interview problems, and 2) Understanding the solutions to these problems. LeetCode has a similar structure. The online judge supports practice. And to help with understanding the solution, each problem gets a throughout analysis by LeetCode in the official solution and by community members in the discussion forums.

A Project for 2023

By Duncan Smith Leave a Comment Jan 4 0

2023

While working on my LeetCode project last year, I started a list of general practice notes. Not notes on specific problems, though those are essential, but notes on the LeetCode practice process in general. My plan for this year is to turn those into a short LeetCode practice tip each week.

« Continue »

2022 in Review: Content Bots

By Duncan Smith Leave a Comment Dec 28 0

Cyberpunk programmer

Quora relies on machine learning. No surprise there. Any major service that accepts user-generated content needs more than human moderation to keep up with the influx of submissions. Algorithms help filter out bad content and promote good content (or at least content that increases user engagement). But this year seems to be an inflection point for algorithms that not only moderate content, but also create it.

« Continue »

Quora: How Can an Interviewer Effectively Evaluate Multiple Ways of Solving a Coding Problem?

By Duncan Smith Leave a Comment Dec 21 0

Red-Green-Code Quora 2022

A good question for interviewers to think about:

As a software engineering interviewer, how can you avoid getting into a mindset that your own method for solving a coding challenge is the best way to solve it, and reject any other implementation? (answer)

See A Project for 2022 to find out what I’m working on this year.

Quora: Is Stack Overflow Giving ChatGPT Too Much Attention?

By Duncan Smith Leave a Comment Dec 14 0

Red-Green-Code Quora 2022

Everyone is talking about ChatGPT this week.

Isn’t Stack Overflow advertising ChatGPT when it bans it and then makes numerous posts about why it banned it? (answer)

See A Project for 2022 to find out what I’m working on this year.

Quora: Do Interviewers Look Up Solutions to the Coding Questions They Ask?

By Duncan Smith Leave a Comment Dec 7 0

Red-Green-Code Quora 2022

This question is about preparing to conduct an interview, rather than preparing to be interviewed.

Do software engineers in FAANG and similar tech companies who ask coding challenges in interviews sometimes look up the solution before they ask the questions in an interview? (answer)

See A Project for 2022 to find out what I’m working on this year.

Quora: How Can One Become an Expert in Competitive Coding?

By Duncan Smith Leave a Comment Nov 30 0

Red-Green-Code Quora 2022

Quora is moving away from the concept of a “canonical question,” in which similar questions are merged into one. So popular questions like this can one can now be asked and answered as often as we want and will be displayed together as “related questions.”

How can one become an expert in competitive coding (like Google Code Jam)? (answer)

See A Project for 2022 to find out what I’m working on this year.

  • « Previous Page
  • 1
  • …
  • 6
  • 7
  • 8
  • 9
  • 10
  • …
  • 50
  • Next Page »

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:

  • 2023 in Review: 50 LeetCode Tips
  • 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

  • Will AI Coding Assistants “Deskill” Us? January 30, 2026
  • Stateless by Design: How to Work With AI Coding Assistants December 31, 2025
  • Do Coding Bots Mean the End of Coding Interviews? December 31, 2024
  • Another Project for 2024 May 8, 2024
  • Dynamic Programming Wrap-Up May 1, 2024
  • LeetCode 91: Decode Ways April 24, 2024
  • LeetCode 70: Climbing Stairs April 17, 2024
  • LeetCode 221: Maximal Square April 10, 2024
  • Using Dynamic Programming for Maximum Product Subarray April 3, 2024
  • LeetCode 62: Unique Paths March 27, 2024
Red-Green-Code
  • Home
  • About
  • Contact
  • Project 462
  • CP FAQ
  • Newsletter
Copyright © 2026 Duncan Smith