Skip to content

Repository files navigation

Little Algorithm

This repository contains the article index and reference solutions for my "LeetCode Explained with Examples" course. The article series was originally published on my WeChat public account in 2020.

English | 简体中文

How to use this repository

  • Learn LeetCode problem-solving systematically:
  • Find reference code by LeetCode problem:
    • Look up a LeetCode problem in the table below to find the corresponding reference code and article link

Reference solutions

IDProblemSolutionArticle
11Container With Most WaterJavaContainer With Most Water (Reservoir Problem)
19Remove Nth Node From End of ListJavaTwo Pointers × Linked List Problems: Fast and Slow Pointers
39Combination SumJavaSolving the Combination Sum Series with One Template
40Combination Sum IIJavaSolving the Combination Sum Series with One Template
46PermutationsJavaPermutation and Combination: Candidate Sets in Backtracking
47Permutations IIJavaRevisiting Permutations and Combinations: Deduplication Strategies in Backtracking
53Maximum SubarrayJava(1, 2, 3, 4, 5)Maximum Subarray Sum: Dynamic Programming Techniques for Subarray Problems
72Edit DistanceJavaClassic Dynamic Programming: Edit Distance
77CombinationsPermutation and Combination: Candidate Sets in Backtracking
78SubsetsJavaFrom Binary Tree Traversal to Backtracking
90Subsets IIJavaRevisiting Permutations and Combinations: Deduplication Strategies in Backtracking
98Validate Binary Search TreeJavaConverting a Binary Tree to a Linked List: Operating on Adjacent Nodes in Binary Tree Inorder Traversal
102Binary Tree Level Order TraversalJavaUse Cases for BFS: Level-Order Traversal and Shortest Path Problems
110Balanced Binary TreeJavaDiameter of Binary Tree: Global Variables in Binary Tree Traversal
112Path SumJavaPath Sum: Subproblem Decomposition in Binary Trees
113Path Sum IIJavaFrom Binary Tree Traversal to Backtracking
123Best Time to Buy and Sell Stock IIIJavaA Practical yet Elegant Approach to Stock Trading Problems
124Binary Tree Maximum Path SumJavaDiameter of Binary Tree: Global Variables in Binary Tree Traversal
141Linked List CycleJavaTwo Pointers × Linked List Problems: Fast and Slow Pointers
148Sort ListJavaLinked List Comprehensive Problem: Sorting a Linked List
167Two Sum II - Input array is sortedJavaSolving Two Sum with Two Pointers: Reducing the Search Space
189Rotate ArrayJavaThe Power of Basic Operations: Reverse as an Example
198House RobberJavaHouse Robber: Four Steps to Solving Dynamic Programming Problems
206Reverse Linked ListJavaReverse Linked List: How to Easily Restructure a Linked List
216Combination Sum IIIJavaSolving the Combination Sum Series with One Template
240Search a 2D Matrix IIJavaSolving Two Sum with Two Pointers: Reducing the Search Space
242Valid AnagramJavaThe Anagram Problem: The Power of Basic Data Structures
303Range Sum Query - ImmutableJavaPrefix Sum: A Space-for-Time Technique
322Coin ChangeJavaClassic Dynamic Programming: Three Coin Change Problems Explained
377Combination Sum IVJavaClassic Dynamic Programming: Three Coin Change Problems Explained
426Convert Binary Search Tree to Sorted Doubly Linked ListJavaConverting a Binary Tree to a Linked List: Operating on Adjacent Nodes in Binary Tree Inorder Traversal
463Island PerimeterJavaIsland Problems: DFS on Grid Structures
518Coin Change 2JavaClassic Dynamic Programming: Three Coin Change Problems Explained
543Diameter of Binary TreeJavaDiameter of Binary Tree: Global Variables in Binary Tree Traversal
560Subarray Sum Equals KJavaPrefix Sum: A Space-for-Time Technique
563Binary Tree TiltJavaDiameter of Binary Tree: Global Variables in Binary Tree Traversal
695Max Area of IslandJavaIsland Problems: DFS on Grid Structures
718Maximum Length of Repeated SubarrayJavaMaximum Subarray Sum: Dynamic Programming Techniques for Subarray Problems
724Find Pivot IndexJavaPrefix Sum: A Space-for-Time Technique
827Making A Large IslandJavaIsland Problems: DFS on Grid Structures
876Middle of the Linked ListJavaTwo Pointers × Linked List Problems: Fast and Slow Pointers
978Longest Turbulent SubarrayJavaSplitting Subproblems in Dynamic Programming to Simplify Your Approach
1143Longest Common SubsequenceJavaLongest Common Subsequence: Solving with Two-Dimensional Dynamic Programming
1162As Far from Land as PossibleJavaUse Cases for BFS: Level-Order Traversal and Shortest Path Problems
1372Longest ZigZag Path in a Binary TreeJavaBinary Tree Problems Too Complex? A Three-Step Method to Solve Them!
1373Maximum Sum BST in Binary TreeJavaBinary Tree Problems Too Complex? A Three-Step Method to Solve Them!

About

Course content and reference code for《LeetCode by Example》

Topics

Resources

Stars

126 stars

Watchers

9 watching

Forks

Used by

Contributors

Languages