Leetcode | Master Guide

Notes leetcode problem

Reference: leetcode-master, Python-LeetCode 581 從基礎的 Array 到 Dynamic Programming 都有詳細的解釋。

Array

Easy Array
35. Search Insert Position
34. Find First and Last Position of Element in Sorted Array
69. Sqrt(x)
367. Valid Perfect Square
27. Remove Element
26. Remove Duplicates from Sorted Array
80. Remove Duplicates from Sorted Array II
283. Move Zeroes
844. Backspace String Compare
977. Squares of a Sorted Array
4. Median of Two Sorted Arrays
59. Spiral Matrix II
209. Minimum Size Subarray Sum
3. Longest Substring Without Repeating Characters
287. Find the Duplicate Number
57. Insert Interval
1995. Count Special Quadruplets

704. Binary search
33. Search in Rotated Sorted Array

Sliding Window

3. Longest Substring Without Repeating Characters
395. Longest Substring with At Least K Repeating Characters
2958. Length of Longest Subarray With at Most K Frequency
713. Subarray Product Less Than K
992. Subarrays with K Different Integers
2444. Count Subarrays With Fixed Bounds

Matrix

861. Score After Flipping Matrix
36. Valid Sudoku

Prefix Sum

525. Contiguous Array


String

Most string problems are handled similarly to arrays.

Easy String 344. Reverse String
541. Reverse String II
151. Reverse Words in a String
28. Find the Index of the First Occurrence in a String
459. Repeated Substring Pattern
[String Summarize]
71. Simplify Path
[72. Edit Distance](https://github.com/Hotshot824/Leetcode/blob/main/Medium/72

Trie

14. Longest Common Prefix


Linkedlist

203. Remove Linked List Elements
707. Design Linked List
206. Reverse Linked List
24. Swap Nodes in Pairs
160. Intersection of Two Linked Lists
141. Linked List Cycle
142. Linked List Cycle II
21. Merge Two Sorted Lists
23. Merge k Sorted Lists
25. Reverse Nodes in k-Group
83. Remove Duplicates from Sorted List
143. Reorder List
[Linkedlist Summarize] 2816. Double a Number Represented as a Linked List

Two Pointers of Linkedlist

Middle Node of Linkedlist
19. Remove Nth Node From End of List
1721. Swapping Nodes in a Linked List


Hash

242. Valid Anagram
2395. Find Subarrays With Equal Sum
1002. Find Common Characters
349. Intersection of Two Arrays
202. Happy Number
454. 4Sum II
383. Ransom Note
15. 3Sum (Hash)
18. 4Sum (Hash)
459. Repeated Substring Pattern
268. Missing Number
41. First Missing Positive
1481. Least Number of Unique Integers after K Removals
128. Longest Consecutive Sequence
791. Custom Sort String
506. Relative Ranks


Two Pointer

1365. How Many Numbers Are Smaller Than the Current Number
125. Valid Palindrome
5. Longest Palindromic Substring
15. 3Sum (E)
18. 4Sum (E)
42. Trapping Rain Water
2149. Rearrange Array Elements by Sign
1750. Minimum Length of String After Deleting Similar Ends
442. Find All Duplicates in an Array 881. Boats to Save People


Queue & Stack

232. Implement Queue using Stacks
225. Implement Stack using Queues
20. Valid Parentheses
1047. Remove All Adjacent Duplicates In String
150. Evaluate Reverse Polish Notation
239. Sliding Window Maximum
347. Top K Frequent Elements
[Stack&Queue Summarize]
1249. Minimum Remove to Make Valid Parentheses
1700. Number of Students Unable to Eat Lunch
950. Reveal Cards In Increasing Order

Priority Queue

1046. Last Stone Weight
1642. Furthest Building You Can Reach


Binary Tree

Build Binary Tree for Array
Recursion Binary Tree Traversal
Iteration Binary Tree Traversal
Iteration Binary Trees Unified Method
Binary Tree Level Order Traversal
N-ary Tree Traversal
226. Invert Binary Tree
559. Maximum Depth of N-ary Tree
783. Minimum Distance Between BST Nodes
Binary Tree Summarize 1
100. Same Tree
572. Subtree of Another Tree
101. Symmetric Tree
222. Count Complete Tree Nodes
513. Find Bottom Left Tree Value
110. Balanced Binary Tree
257. Binary Tree Paths
112. Path Sum & II & III
Binary Tree Summarize 2 1325. Delete Leaves With a Given Value

Other Operations

623. Add One Row to Tree
979. Distribute Coins in Binary Tree


Backtracking

77. Combinations
79. Word Search
17. Letter Combinations of a Phone Number
39. Combination Sum I & II & III
22. Generate Parentheses
Backtracking Summarize
131. Palindrome Partitioning
93. Restore IP Addresses
78. Subsets
Backtracking Summarize 2
51. N-Queens
52. N-Queens II
979. Distribute Coins in Binary Tree
37. Sudoku Solver
46. Permutations
2597. The Number of Beautiful Subsets
1255. Maximum Score Words Formed by Letters


Greedy Algorithm

55. Jump Game I & II
452. Minimum Number of Arrows to Burst Balloons
455. Assign Cookies
948. Bag of Tokens
621. Task Scheduler
334. Increasing Triplet Subsequence

Math

43. Multiply Strings
976. Largest Perimeter Triangle
2971. Find Polygon With the Largest Perimeter


Dynamic Programming

509. Fibonacci Number
70. Climbing Stairs
746. Min Cost Climbing Stairs
62. Unique Paths
343. Integer Break
96. Unique Binary Search Trees
300. Longest Increasing Subsequence
2370. Longest Ideal Subsequence
Minimum Falling Path Sum I & II

0/1 Knapsack Problem

416. Partition Equal Subset Sum
1049. Last Stone Weight II
494. Target Sum
474. Ones and Zeroes

Unbounded Knapsack Problem

518. Coin Change II & I
377. Combination Sum IV
279. Perfect Squares
139. Word Break
140. Word Break II


Bit Manipulation

201. Bitwise AND of Numbers Range


Graph

1971. Find if Path Exists in Graph
787. Cheapest Flights Within K Stops
2092. Find All People With Secret
514. Freedom Trail
2812. Find the Safest Path in a Grid

200. Number of Islands
2368. Reachable Nodes With Restrictions
778. Swim in Rising Water

752. Open the Lock
1654. Minimum Jumps to Reach Home

Topological Sort

310. Minimum Height Trees


Other

1. Two sum
2. Add Two Numbers
7. Reverse Integer
11. Container With Most Water
13. Roman to Integer
16. 3Sum_Closest
49. Group Anagrams
50. Pow(x, n)
67. Add Binary
118. Pascal’s Triangle I & II
989. Add to Array-Form of Integer
1523. Count Odd Numbers in an Interval Range
1979. Find Greatest Common Divisor of Array

Last Edit

3-7-2024 17:30

results matching ""

    No results matching ""

    , leetcode, algorithm