Leetcode | Master Guide

Notes leetcode problem

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

Array

Binary Search
704. Binary Search
2070. Most Beautiful Item for Each Query
2601. Prime Subtraction Operation
Hackerrank. Climbing the Leaderboard

Easy Array
26. Remove Duplicates from Sorted Array
27. Remove Element
34. Find First and Last Position of Element in Sorted Array
35. Search Insert Position
57. Insert Interval
69. Sqrt(x)
283. Move Zeroes
287. Find the Duplicate Number
367. Valid Perfect Square
844. Backspace String Compare
977. Squares of a Sorted Array
1995. Count Special Quadruplets
2161. Partition Array According to Given Pivot
Easy Array

Matrix
36. Valid Sudoku
840. Magic Squares In Grid
861. Score After Flipping Matrix
2373. Largest Local Values in a Matrix
Hackerrank. Forming a Magic Square
Martix

Prefix Sum
525. Contiguous Array
974. Subarray Sums Divisible by K
2145. Count the Hidden Sequences

Sort
4. Median of Two Sorted Arrays
33. Search in Rotated Sorted Array
75. Sort Colors
80. Remove Duplicates from Sorted Array II
540. Single Element in a Sorted Array
786. K-th Smallest Prime Fraction
945. Minimum Increment to Make Array Unique
1051. Height Checker
1122. Relative Sort Array
1508. Range Sum of Sorted Subarray Sums
1636. Sort Array by Increasing Frequency
2037. Minimum Number of Moves to Seat Everyone
2233. Maximum Product After K Increments
2785. Sort Vowels in a String

Spiral Matrix
209. Minimum Size Subarray Sum
Spiral Matrix

Backtracking

Backtracking
17. Letter Combinations of a Phone Number
22. Generate Parentheses
37. Sudoku Solver
39. Combination Sum
46. Permutations
51.N Queens
52.N Queens Ii
77. Combinations
78. Subsets
79. Word Search
93. Restore IP Addresses
131. Palindrome Partitioning
1255. Maximum Score Words Formed by Letters
2597. The Number of Beautiful Subsets

Binary Tree

Binary Tree
100. Same Tree
101. Symmetric Tree
110. Balanced Binary Tree
112. Path Sum
222. Count Complete Tree Nodes
226.Invert Binary Tree
257. Binary Tree Paths
513. Find Bottom Left Tree Value
559.Maximum Depth Of N Ary Tree
572.Subtree Of Another Tree
783. Minimum Distance Between BST Nodes
1038. Binary Search Tree to Greater Sum Tree
1325. Delete Leaves With a Given Value
1367. Linked List in Binary Tree
1530. Number of Good Leaf Nodes Pairs
2096. Step-By-Step Directions From a Binary Tree Node to Another
2196. Create Binary Tree From Descriptions
Binary Tree Level Order Traversal
Build Binary Tree for Array
Iteration Binary Tree Traversal
Iteration Binary Trees Unified Method

Binary tree
N-ary Tree Traversal
Recursion Binary traversal

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

Bit Manipulation

Bit Manipulation
201. Bitwise AND of Numbers Range
2419. Longest Subarray With Maximum Bitwise AND
2429. Minimize XOR
Bit Manipulation Summary

Dynamic Programming

0/1 Knapsack
0/1 Knapsack Problem
416. Partition Equal Subset Sum
474. Ones and Zeroes
494. Target Sum
1049. Last Stone Weight II

Dynamic Programming
Stack with DP
62. Unique Paths
70. Climbing Stairs
96. Unique Binary Search Trees
300. Longest Increasing Subsequence
343.Integer Break
509. Fibonacci Number
931. Minimum Falling Path Sum
1105. Filling Bookcase Shelves
1749. Maximum Absolute Sum of Any Subarray
2370. Longest Ideal Subsequence
2684. Maximum Number of Moves in a Grid

Unbounded Knapsack
139. Word Break
140. Word Break II
279. Perfect Squares
377. Combination Sum IV
518. Coin Change II
Unbounded Knapsack Problem

Graph

Breadth First Search
752. Open the Lock
1654. Minimum Jumps to Reach Home
2045. Second Minimum Time to Reach Destination

Graph
514. Freedom Trail
787. Cheapest Flights Within K Stops
1219. Path with Maximum Gold
1382. Balance a Binary Search Tree
1791. Find Center of Star Graph
1971. Find if Path Exists in Graph
2092. Find All People With Secret
2285. Maximum Total Importance of Roads
2497. Maximum Star Sum of a Graph
2812. Find the Safest Path in a Grid
2924. Find Champion II

Graph Search
200. Number of Islands
778. Swim in Rising Water
797. All Paths From Source to Target
2368. Reachable Nodes With Restrictions

Shortest Path
743. Network Delay Time
1976. Number of Ways to Arrive at Destination
2976. Minimum Cost to Convert String I

Topological Sort
310. Minimum Height Trees
2192. All Ancestors of a Node in a Directed Acyclic Graph

Greedy Algorithm

Greedy Algorithm
55. Jump Game
452. Minimum Number of Arrows to Burst Balloons
455. Assign Cookies
621. Task Scheduler
763. Partition Labels
948. Bag of Tokens
1509. Minimum Difference Between Largest and Smallest Value in Three Moves
2411. Smallest Subarrays With Maximum Bitwise OR

Hash

Hash
15. 3Sum
18. 4Sum
41. First Missing Positive
128. Longest Consecutive Sequence
202. Happy Number
242. Valid Anagram
268. Missing Number
349. Intersection of Two Arrays
383. Ransom Note
454. 4Sum II
506. Relative Ranks
791. Custom Sort String
873. Length of Longest Fibonacci Subsequence
916. Word Subsets
1002. Find Common Characters
1481. Least Number of Unique Integers after K Removals
2342. Max Sum of a Pair With Equal Sum of Digits
2395. Find Subarrays With Equal Sum
2657. Find the Prefix Common Array of Two Arrays
3541. Find Most Frequent Vowel and Consonant

Linkedlist

Linkedlist
21. Merge Two Sorted Lists
23.Merge K Sorted Lists
24. Swap Nodes in Pairs
25.Reverse Nodes In K Group
83.Remove Duplicates From Sorted List
141. Linked List Cycle
142. Linked List Cycle II
143. Reorder List
160. Intersection of Two Linked Lists
203. Remove Linked List Elements
206. Reverse Linked List
707. Design Linked List
725. Split Linked List in Parts
2058. Find the Minimum and Maximum Number of Nodes Between Critical Points
2181. Merge Nodes in Between Zeros
2816. Double a Number Represented as a Linked List
Middle Node of Linkedlist

Math

Math
43. Multiply Strings
84. Largest Rectangle in Histogram
976. Largest Perimeter Triangle
1518. Water Bottles
2364. Count Number of Bad Pairs
2579. Count Total Number of Colored Cells
2971. Find Polygon With the Largest Perimeter
Hackerrank. Extra Long Factorials

Queue & Stack

Priority Queue
502. IPO
703. Kth Largest Element in a Stream
1046. Last Stone Weight
1642. Furthest Building You Can Reach
2530. Maximal Score After Applying K Operations
3066. Minimum Operations to Exceed Threshold Value II

Stack & Queue
20. Valid Parentheses
150. Evaluate Reverse Polish Notation
225. Implement Stack using Queues
232. Implement Queue using Stacks
239. Sliding Window Maximum
347. Top K Frequent Elements
735. Asteroid Collision
921. Minimum Add to Make Parentheses Valid
950. Reveal Cards In Increasing Order
1047. Remove All Adjacent Duplicates In String
1190. Reverse Substrings Between Each Pair of Parentheses
1249. Minimum Remove to Make Valid Parentheses
1700. Number of Students Unable to Eat Lunch
1717. Maximum Score From Removing Substrings
1910. Remove All Occurrences of a Substring
2116. Check if a Parentheses String Can Be Valid

Sliding Window

Sliding Window
3. Longest Substring Without Repeating Characters
395. Longest Substring with At Least K Repeating Characters
713. Subarray Product Less Than K
992. Subarrays with K Different Integers
1839. Longest Substring Of All Vowels in Order
2134. Minimum Swaps to Group All 1’s Together II
2444. Count Subarrays With Fixed Bounds
2461. Maximum Sum of Distinct Subarrays With Length K
2958. Length of Longest Subarray With at Most K Frequency
3254. Find the Power of K-Size Subarrays I

String

String
9.Palindrome Number
28. Find the Index of the First Occurrence in a String
71. Simplify Path
151. Reverse Words in a String
344. Reverse String
394. Decode String
459. Repeated Substring Pattern
539.Minimum_Time_Difference.md
541. Reverse String II
796. Rotate String
1400. Construct K Palindrome Strings
1653. Minimum Deletions to Make String Balanced
2108. Find First Palindromic String in the Array
2109. Adding Spaces to a String
3042. Count Prefix and Suffix Pairs I
3223. Minimum Length of String After Operations
Easy Hash
Easy String

Trie
14. Longest Common Prefix
208. Implement Trie (Prefix Tree)

Two Pointer

Two Pointer
5. Longest Palindromic Substring
19. Remove Nth Node From End of List
42. Trapping Rain Water
125. Valid Palindrome
442. Find All Duplicates in an Array
845. Longest Mountain in Array
881. Boats to Save People
1358. Number of Substrings Containing All Three Characters
1365.How Many Numbers Are Smaller Than The Current Number
1395. Count Number of Teams
1721. Swapping Nodes in a Linked List
1750. Minimum Length of String After Deleting Similar Ends
2149. Rearrange Array Elements by Sign
2570. Merge Two 2D Arrays by Summing Values

Other

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
989. Add to Array-Form of Integer
1523. Count Odd Numbers in an Interval Range
1979. Find Greatest Common Divisor of Array

Last Edit

Leetcode 2025-09-14 03:30:26

results matching ""

    No results matching ""

    , leetcode, algorithm