Whiteboard interviews featuring leetcode-style coding problems are the current standard in Big Tech. It's possible to land a programming role without intensive whiteboard interview preparation, but even if you aren't seeking a Big Tech role, this is a valuable skill that will improve your job search performance. The official guidance from Ladderly is to begin your job search even if you don't feel confident with problems like these. Do work on this skill in parallel to your job search, but don't block yourself from starting a job search until you have reached leetcode mastery.
Given that you would like to improve your skill with data structures and algorithms, or leetcode-style coding challenges, where should you begin? This article describes standard advice and builds on top of that advice to provide the Ladderly Leetcode Kata, a series of problems designed to help you warm up and prime engineers of any level for their coding interview rounds.
This article defines kata, describes historical standard guidance for coding round interview preparation, lays out the recommended Ladderly Leetcode Kata, and lastly discusses some potential dangers and pitfalls of kata-oriented preparation.
What is Leetcode Kata?
Kata is a term of Japanese origin that refers to a choreographed pattern of martial arts movements. Practicing or drilling kata is a memorization technique that creates muscle memory in addition to the cognitive benefits.
Code kata are code snippets that are repeatedly typed out as a technique for memorizing solutions to programming problems and also to improve productivity or implementation time for those problems.
Leetcode kata are code kata designed from a list of code problems from the popular Leetcode website. The Ladderly Leetcode Kata is composed with a few criteria in mind:
- Cover the Top 5 Patterns from the 5 to 23 Patterns article.
- Warm up the brain, don't exhaust it.
- Represent high-frequency problems according to Leetcode frequency data. Notice that this makes the Ladderly Leetcode Kata a living guide, in contrast to legacy guides such as the Blind 75.
- Completable in about thirty minutes.
- Solutions are well-documented.
- No premium or paywalled questions.
- Prefer series problems when possible to encourage flow and reduce cognitive switching costs.
The Ladderly Leetcode Kata are also arranged by the progressive complexity of their patterns, so that every later pattern builds on a former pattern, creating a pattern-level flow:
In order of difficulty, the Top 5 Patterns can be arranged this way:
- String and Array Manipulation
- Linked Lists
- Graphs
- Tree Algorithms
- Sorting and Searching
Notice that these concepts are arranged such that we start with primitives, then move to collections of primitives, then we can arrange those collections into graphs and trees, and finally, we can sort and search across those collections and structures.
Standard Historical Guidance: When am I Ready to Interview?
The Blind 75 was a watershed guide that helped spread knowledge on common questions and patterns under assessment at Big Tech whiteboard interviews or coding interview rounds. That advice is dated. Several resources have improved on it:
- The creator of the Blind 75 created an updated list called the Grind 75. Read more here.
- Many in the tech community began to emphasize the importance of learning patterns over solving specific problems, and the 14 Patterns article became a smash hit.
- Building on the 14 Patterns, Sean Prashad launched the Leetcode Patterns tool, capturing 22 patterns across 180 problems.
- AlgoExpert and Neetcode.io sought to improve over existing resources through high-quality educational videos, making learning data structures and algorithms (DS&A) easier and less intimidating.
- John Vandivier, the creator of Ladderly.io, created the 5 to 23 Patterns article, embracing both the movement to lower the barrier to entry and also raising the bar on the total addressed pattern set compared to Prashad's tool.
- LeetCode itself created the Leetcode 75, a program targeted around 1-3 months of study and covering many essential patterns.
- John Vandivier wrote 6 Problem Picking Patterns for Technical Success. Building on the 5 to 23 patterns article and other work, this article defines a living, abstract, and evergreen process for finding highly relevant problems and patterns at any point in time.
The current article contributes to the literature by providing a leetcode kata. This kata is a compliment to prior work, not a substitute for prior guidance. Ladderly considers the 6 Problem Picking Patterns article to be state-of-the-art advice for the broader learning journey. The kata described in this article has a different purpose which is to prime the engineer for a coding interview, rather than to guide the learning journey.
As a secondary purpose, it is possible to use these kata as a stepping stone in the larger learning journey. Ladderly presents two kata here: A standard form and an expanded form. The standard form has twelve challenges and the expanded form has twenty challenges. As such, this article represents a new cutting-edge in a reduced barrier to entry for leetcode-style technical interview preparation. The standard kata can be sufficient for entry-level technical interview preparation, although it is not optimal for senior-level job seekers. Here is a relevant quote from the 5 to 23 Patterns article, but do browse it further for additional context:
I think interviews themselves are excellent practice, and I hesitate to require too much studying in a blocking way before beginning interviews...Whatever problem you are given, let’s target solving the problem in 20 minutes. With that context in mind, here are some of my recommendations by job level:
Entry/Junior Level: Feel confident solving an easy from the Top 7 Patterns in 20 minutes.
SWE II to III...Feel somewhat comfortable (better than 25% chance of success) solving a hard from the Top 11 Patterns in 40 minutes. Consider training with a service like interviewing.io or practicing until getting a green light from another current Big Tech engineer.
Thanks for reading! Ladderly is open source and community driven. Consider supporting the maintainers by leaving a tip!
The Ladderly Leetcode Kata
Solve these problems in order. Step through each problem as if it were a coding interview round. That means you should say things out loud as you go:
- Recite the problem
- Ask clarifying questions. (Yes, even though you are alone, practice asking a question out loud.)
- Declare a basic or brute force approach with its best conceivable runtime.
- Implement the brute force
- Ask how the solution can be improved
- Implement the optimal form (if it is different than the brute force)
- Declare the worst-case time and space complexity
- If the kata has a finishing statement, recite the statement out loud before proceeding to the next problem.
As a beginner, you might only be able to solve one problem each day. Eventually, you will have solved these many times and you should be able to complete all steps for all standard kata problems in under 30 minutes. Ideally, this kata is performed 1-2 hours in advance of the interview round, allowing for at least 30 minutes of rest time before beginning the interview. Make sure to eat, hydrate, sleep the night before, mind your attitude and attire, and remind yourself of all of those non-technical aspects of the interview during your rest period.
Here is the list of code challenges in the Ladderly Leetcode Standard Kata:
-
167. Two Sum II - Input Array Is Sorted
- Patterns: Array, Two Pointers, Monotonic Stack
- Finishing Statement: I recognize the importance of checking whether an input array is sorted. I recognize the importance of distinguishing between weakly and strictly changing values in an array.
- Related Resources: Monotonic Functions
-
- Patterns: Array, Two Pointers
- Finishing Statement: I am comfortable with many variations of two and three sum. I recognize and anticipate the basic forms of these questions and their follow-up complications. For example, the optimal solution to two sum differs when the input is sorted ahead of time. Two Pointers sets me up well for variations like 3Sum Closest and 4Sum. I recognize that I can sort three sum and higher without an asymptotic performance penalty because optimal sorting performance is O(nlogn).
- Note: Write out each of the three solutions: Two Pointers, Hashset, and No-Sort.
-
3. Longest Substring Without Repeating Characters
- Patterns: String, Sliding Window
-
- Patterns: Linked List
-
- Patterns: Linked List, Fast and Slow Pointers, Recursion
- Finishing Statement: I realize that the only way to avoid O(n) space complexity is to modify the input in place. For that reason, I realize that the less obvious partial linked list reversal technique is more efficient compared to creating a copy of the input as an array. I also realize that recursion creates O(n) space complexity along the runtime stack. Therefore recursion is also not optimal.
-
- Patterns: BFS, DFS, Graphs
-
- Patterns: BFS, DFS, Graphs, Topological Sort
-
- Tree Algorithms, DFS, BFS
-
- Tree Algorithms, DFS, Recursion
-
102. Binary Tree Level Order Traversal
- finishing statement: saying the tree traversal orders and when each one should be used
-
- Patterns: Array, Backtracking, Matrix, String
The Ladderly Leetcode Expanded Kata
The Ladderly Leetcode Expanded Kata is a list of 20 challenges that are a superset of the standard kata. The additional challenges cover a broader set of patterns and techniques, such as the prefix sum and priority queue, while also improving reinforcement for minimally covered patterns.
This expanded kata will frequently take an hour for even experienced leetcoders. If you find the expanded kata to be exhausting, consider running this kata the day or weekend before interviews and only doing the standard kata on interview day.
The 20 challenges are intentionally divided into three groups, so you have the option to tackle one group at a time:
- Group 1, 8 Problems, Covers String and Array Manipulation
- Group 2, 8 Problems, Covers Linked Lists and Graphs
- Group 3, 4 Problems, Covers Tree Algorithms and Topological Sort
Here is the list of code challenges in the Ladderly Leetcode Expanded Kata:
-
167. Two Sum II - Input Array Is Sorted
-
Patterns: Array, Two Pointers, Monotonic Stack
-
Finishing Statement: I recognize the importance of checking whether an input array is sorted. I recognize the importance of distinguishing between weakly and strictly changing values in an array.
-
Related Resources: Monotonic Functions
-
-
-
Patterns: Array, Two Pointers
-
Finishing Statement: I am comfortable with many variations of two and three sum. I recognize and anticipate the basic forms of these questions and their follow-up complications. For example, the optimal solution to two sum differs when the input is sorted ahead of time. Two Pointers sets me up well for variations like 3Sum Closest and 4Sum. I recognize that I can sort three sum and higher without an asymptotic performance penalty because optimal sorting performance is O(nlogn).
-
Note: Write out each of the three solutions: Two Pointers, Hashset, and No-Sort.
-
-
- Patterns: Array, Two Pointers, Binary Search
-
- Patterns: Array, Backtracking, Matrix, String
-
- Patterns: Array, DFS, Matrix, String, Trie
-
3. Longest Substring Without Repeating Characters
- Patterns: String, Sliding Window
-
- Patterns: Array, Matrix
-
- Patterns: Linked List
-
-
Patterns: Linked List, Fast and Slow Pointers, Recursion
-
Finishing Statement: I realize that the only way to avoid O(n) space complexity is to modify the input in-place. For that reason, I realize that the less obvious partial linked list reversal technique is more efficient compared to creating a copy of the input as an array. I also realize that recursion creates O(n) space complexity along the runtime stack. Therefore recursion is also not optimal.
-
-
146. LRU Cache Patterns: Linked List
-
- Patterns: BFS, DFS, Graphs
-
- Patterns: BFS, DFS, Graphs, Topological Sort
-
- Patterns: Array, Greedy, Heap / Priority Queue, Memoization, Recursion
-
- Tree Algorithms, DFS, BFS
-
- Tree Algorithms, DFS, Recursion
-
- Tree Algorithms, DFS, Prefix Sum
-
102. Binary Tree Level Order Traversal
- finishing statement: saying the tree traversal orders and when each one should be used
Thanks for reading! Ladderly is open source and community driven. Consider supporting the maintainers by leaving a tip!
Honorable Mentions
- Combination Sum and N-Queens for backtracking. Both of these are series problems.
- Sudoku problems like 37. Sudoku Solver. These are great for learning string matrix algorithms, but they are more cognitively demanding compared to word search with no added pattern coverage. For learning as opposed to kata, Sudoku's higher cognitive load makes it an even better choice than word search. Of course, you can do both for even more load!
- For additional drilling on sliding window, consider the premium question 340. Longest Substring with At Most K Distinct Characters.
Calculating Estimated Coverage
AlgoMonster estimates the overall proportion of coding round questions by pattern as follows:
- Depth-First Search: 16.8%
- Basic Programming 12.6%
- Two Pointers: 10.5%
- Linked Lists: 6.3%
- Breadth-First Search: 4.9%
- Math: 4.9%
- Hash: 4.2%
- Binary Search 3.5%
- Stack: 3.5%
- Heap: 2.8%
- Dynamic Programming: 2.8%
- Matrix: 2.1%
- Bit Manipulation: 2.1%
- Divide and Conquer: 0.7%
- Prefix Sum: 0.7%
While this makes up the labeled region of the pie chart the total here is only 78.4%. Other groups like tries and greedy algorithms took up some small and unlabeled slices in the analysis across companies, but they sometimes made significant contributions to company-specific question pools.
The Ladderly Leetcode Expanded Kata covers all of these except:
- Dynamic Programming
- Bit Manipulation
- Divide and Conquer
Ignoring the unlabeled patterns, the Ladderly Leetcode Expanded Kata therefore conservatively covers 72.8 (= 78.4 - 0.7 - 2.1 - 2.8) percent of expected questions.
The standard kata further leaves out prefix sum and binary search, so it has 4.2% less coverage. Still, the basic kata conservatively covers more than two-thirds of the expected questions! This is a substantial reduction to your risk at coding challenge time.
Dangers of Code Kata
There are six main dangers to using code kata from Ladderly or elsewhere:
- Underutilization. As kata, the benefits will not be realized if you only do these problems a few times. You should practice them many times to the point that you can easily solve any problem on the list without much time or effort.
- Overutilization. The job search involves more than leetcode. Make time for rest, social networking, applications, portfolio development, working on non-kata code challenges, and the other elements of the job search.
- Substituting memorization for learning. Kata is a memorization tool, and memorization is not a substitute for learning. While these problems can serve as a starting point for learning, you should continue to study many other variations to reduce the chance that a surprise question or twist during an interview will throw you into a difficult situation. Make a practice of calmly facing unexpected questions by:
- Participating in Leetcode weekly competitions
- Referring back to the Standard Historical Guidance for continued learning
- Taking on many real and practice interviews and viewing them as a learning experience, acknowledging that you may be surprised and accepting it
- Treating the kata pattern set as an end goal rather than a market of basic competency. Recalling the 5 to 23 Patterns article, notice that only the most important five are covered in the Ladderly Leetcode Kata. These five explain
- Prioritizing generic kata over company-specific information is a mistake. If you are able to access a company-specific list of frequently used questions, prioritize those. You can use the kata in addition to those tools, or modify the standard kata for your own situation.
- Neglecting others is a danger of becoming an elite programmer. You may forget how hard it was in the beginning. You may think that since you went through this difficult process other people should also do the same in order to earn their place as a software engineer. At Ladderly, we hope that you adopt an attitude of empathy toward others instead, and we'd welcome your personal support and contributions of time, resources, and effort to ensure that it gets easier for people to break into tech over time.
Thanks for reading! Ladderly is open source and community driven. Consider supporting the maintainers by leaving a tip!
Now for a Little Fun!
In order to motivate community participation and conversation, Ladderly is providing a special reward to our users who publish a video of an attempt to complete either a kata.
After creating a free or paid account on Ladderly, upload or stream a kata attempt to the platform of your choice. The upload must be publicly accessible and mention this article in the video or in the video description. Then, send the video to the Ladderly team through Discord and we will add a special achievement badge to your profile with a public congratulations over social media!
Here are the reward tiers:
- Ladderly Kata Participant: Attempt at least one problem from either kata
- Ladderly Kata Completionist: Complete all 12 problems from the Standard Kata in under 8 hours
- Ladderly Expanded Kata Completionist: Complete all 20 problems from the Expanded Kata in under 8 hours
- Ladderly Bronze Star: Complete the standard kata in under 4 hours
- Ladderly Silver Star: Complete the standard kata in under 1 hour
- Ladderly Gold Star: Complete the standard kata in under 30 minutes
- Ladderly Expanded Bronze Star: Complete the expanded kata in under 4 hours
- Ladderly Expanded Silver Star: Complete the expanded kata in under 2 hours
- Ladderly Expanded Gold Star: Complete the expanded kata in under 1 hour
- Laddery Gold Crown: Be a former record holder for a completion time of any kata
- Laddery Diamond Crown: Be the current record holder for completion time of any kata