tommyvsfu1 / Leetcode

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Leetcode

Two Pointers

15. 3Sum
16. 3Sum Closest
18. 4Sum
259. 3Sum Smaller\

Sliding Window

76. Minimum Window Substring
159. Longest Substring with At Most Two Distinct Characters
340. Longest Substring with At Most K Distinct Characters
424.Longest Repeating Character Replacement
611. Valid Triangle Number
992. Subarrays with K Different Integers
1004.Max Consecutive Ones III
1358.Number of Substrings Containing All Three Characters
1052.Grumpy Bookstore Owner
1838. Frequency of the Most Frequent Element
2024.Maximize the Confusion of an Exam
2537. Count the Number of Good Subarrays
2411. Smallest Subarrays With Maximum Bitwise OR
2461. Maximum Sum of Distinct Subarrays With Length K
2747. Count Zero Request Servers
2831.Find the Longest Equal Subarray

Two Sequences

986. Interval List Intersections
1537. Get the Maximum Score
1775. Equal Sum Arrays With Minimum Number of Operations

個人認為比較不像其他two pointers題目,特別是指針擺法跟移動方向,可能會融合greedy想法,才會知道指針怎麼擺

Prefix Sum + Hash Map

525.Contiguous Array
930.Binary Subarrays With Sum
974.Subarray Sums Divisible by K
1371.Find the Longest Substring Containing Vowels in Even Counts
1442.Count Triplets That Can Form Two Arrays of Equal XOR
1524.Number of Sub-arrays With Odd Sum
1542.Find Longest Awesome Substring
1590.Make Sum Divisible by P
1915.Number of Wonderful Substrings
1983.Widest Pair of Indices With Equal Range Sum
2025.Maximum Number of Ways to Partition an Array
2488.Count Subarrays With Median K
2489.Number of Substrings With Fixed Ratio
2845.Count of Interesting Subarrays
2875.Minimum Size Subarray in Infinite Array

Greedy

Three Pass

334.Increasing Triplet Subsequence
689.Maximum Sum of 3 Non-Overlapping Subarrays
1525.Number of Good Ways to Split a String
1653.Minimum Deletions to Make String Balanced
1664.Ways to Make a Fair Array
1671.Minimum Number of Removals to Make Mountain Array
1769.Minimum Number of Operations to Move All Balls to Each Box
1888.Minimum Number of Flips to Make the Binary String Alternating
2163.Minimum Difference in Sums After Removal of Elements
2555.Maximize Win From Two Segments
2874.Maximum Value of an Ordered Triplet II

Binary Search

34. Find First and Last Position of Element in Sorted Array
81.Search in Rotated Sorted Array II
215.Kth-Largest-Element-in-an-Array
373.Find-K-Pairs-with-Smallest-Sums
378.Kth-Smallest-Element-in-a-Sorted-Matrix
786.K-th Smallest-Prime-Fraction
1439.Find-the-Kth-Smallest-Sum-of-a-Matrix-With-Sorted-Rows
1482.Minimum-Number-of-Days-to-Make-m-Bouquets
1631.Path-With-Minimum-Effort
1870.Minimum Speed to Arrive on Time
1918.Kth-Smallest-Subarray-Sum
2040.Kth-Smallest-Product-of-Two-Sorted-Arrays
2226.Maximum-Candies-Allocated-to-K-Children

Tree

112. Path Sum
114. Flatten Binary Tree to Linked List
173. Binary Search Tree Iterator
222. Count Complete Tree Nodes
270. Closest Binary Search Tree Value
272. Closest Binary Search Tree Value II
285. Inorder Successor in BST
298. Binary Tree Longest Consecutive Sequence
437. Path Sum III
549. Binary Tree Longest Consecutive Sequence II
655. Print Binary Tree
897. Increasing Order Search Tree
1660. Correct a Binary Tree
2445. Number of Nodes With Value One\

Path in a tree

124. Binary Tree Maximum Path Sum
543. Diameter of Binary Tree
687. Longest Univalue Path
1522. Diameter of N-Ary Tree
2049. Count Nodes With the Highest Score
2246. Longest Path With Different Adjacent Characters

Lowest common ancestor

236. Lowest Common Ancestor of a Binary Tree
1644. Lowest Common Ancestor of a Binary Tree II
1650. Lowest Common Ancestor of a Binary Tree III
1676. Lowest Common Ancestor of a Binary Tree IV

90%的Tree題目都是用recursion

BFS (Including Topological Sort)

127.Word-Ladder
785.Is Graph Bipartite?
1162.As Far from Land as Possible
1462.Course Schedule IV

DFS

37.Sudoku Solver
473.Matchsticks to Square
491.Non-decreasing Subsequences
698.Partition to K Equal Sum Subsets
1306.Jump Game III
2597.The Number of Beautiful Subsets

Graph

743.Network Delay Time
1334.Find the City With the Smallest Number of Neighbors at a Threshold Distance

Monotonic Stack

42.Trapping Rain Water
84.Largest Rectangle in Histogram
85.Maximal Rectangle
496.Next Greater Element I
503.Next Greater Element II
768.Max Chunks To Make Sorted II
901.Online Stock Span
907.Sum of Subarray Minimums
962.Maximum Width Ramp
1063.Number of Valid Subarrays
1124.Longest Well-Performing Interval
1856.Maximum Subarray Min-Product
2104.Sum of Subarray Ranges
2334.Subarray With Elements Greater Than Varying Threshold
2355.Maximum Number of Books You Can Take
2434.Using a Robot to Print the Lexicographically Smallest String
2454.Next Greater Element IV
2866.Beautiful Towers II

Union Find

684.Redundant Connection
1489.Find Critical and Pseudo-Critical Edges in Minimum Spanning Tree
2867.Count Valid Paths in a Tree

Dynamic Programming

基本型

1839. Longest Substring Of All Vowels in Order

背包型

879. Profitable Schemes

其他

2355.Maximum Number of Books You Can Take

About


Languages

Language:C++ 100.0%