Leetcode is a famous online OJ. This year, it has added Database and shell modules. The difficulty is divided into easy, Medium and hard levels, which is very suitable for beginners to practice data structure and algorithm.

I have been brushing the questions on Leetcode for a year, but I have not recorded the way of solving the questions before. I have forgotten many questions, and I don’t know where to start when I meet the same type of questions again. Now I update this blog to record the way of brushing questions and deepen my understanding of knowledge points. The programming language uses Swift.

First of all, I’m just an algorithm rookie. In order to strengthen the algorithm ability, I will brush the problems on Leetcode. If there are problems in solving the problems, or there are some areas that can be optimized for the algorithm, please kindly point out. Attached here is the Github portal, the previous brush problem records are in the warehouse, which have been verified by Leetcode. Due to a long time, some adjustments may be made in Leetcode. Welcome feedback if you have any questions.

Stack

739. Daily Temperatures

84. Largest Rectangle in Histogram

385. Mini Parser

199. Binary Tree Right Side View

Greedy

738. Monotone Increasing Digits

659. Split Array into Consecutive Subsequences

649. Dota2 Senate

BFS

130. Surrounded Regions

752. Open the Lock

DFS

733. Flood Fill

337. House Robber III

129. Sum Root to Leaf Numbers

114. Flatten Binary Tree to Linked List

98. Validate Binary Search Tree

547 Friend Circles

638. Shopping Offers

797. All Paths From Source to Target

String

5. Longest Palindromic Substring

804. Unique Morse Code Words

821. Shortest Distance to a Character

819. Most Common Word

Tree

654. Maximum Binary Tree

653. Two Sum IV – Input is a BST

669. Trim a Binary Search Tree

637. Average of Levels in Binary Tree

687. Longest Univalue Path

671. Second Minimum Node In a Binary Tree

606. Construct String from Binary Tree

450. Delete Node in a BST

Binary Tree Traversal (Preoder, Inorder, zigzal level)

Construct Binary Tree

662. Maximum Width of Binary Tree

623. Add One Row to Tree

652. Find Duplicate Subtrees

655. Print Binary Tree

230. Kth Smallest Element in a BST

783. Minimum Distance Between BST Nodes

814. Binary Tree Pruning

DP

740. Delete and Earn

House Robber I, II

Unique Binary Search Trees I, II

718. Maximum Length of Repeated Subarray

746. Min Cost Climbing Stairs

583. Delete Operation for Two Strings

698. Partition to K Equal Sum Subsets

486. Predict the Winner

823. Binary Trees With Factors

Hash Table

748. Shortest Completing Word

771. Jewels and Stones

781. Rabbits in Forest

811. Subdomain Visit Count

Array

747. Largest Number At Least Twice of Others

Max Chunks To Make Sorted

766. Toeplitz Matrix

795. Number of Subarrays with Bounded Maximum

807. Max Increase to Keep City Skyline

825. Friends Of Appropriate Ages

826. Most Profit Assigning Work

822. Card Flipping Game

832. Flipping an Image

String

556. Next Greater Element III

522. Longest Uncommon Subsequence II

809. Expressive Words

791. Custom Sort String

424. Longest Repeating Character Replacement

830. Positions of Large Groups

831. Masking Personal Information

820. Short Encoding of Words 824. Goat Latin 833. Find And Replace in String

List

725 Split Linked List in Parts

817. Linked List Components

Bit Manipulation

Hamming Distance

Math

592. Fraction Addition and Subtraction

754. Reach a Number

43. Multiply Strings

525. Contiguous Array

Ugly Number

812. Largest Triangle Area

789. Escape The Ghosts

829. Consecutive Numbers Sum

Binary Search

658. Find K Closest Elements

744. Find Smallest Letter Greater Than Target