Skip to content

wendili-cs/leetcode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LeetCode Records

This is the leetcode code track of Wendi.

Algorithms

Contest

# Title Comment Language
2829 Determine the Minimum Sum of a k-avoiding Array math C++
7006 Maximize the Profit as the Salesman DP,array C++
2834 Find the Minimum Possible Sum of a Beautiful Array math C++

Exercise

# Title Comment Language
0001 Two Sum hash C++
0002 Add Two Numbers C++ pointer C++
0003 Longest Substring Without Repeating Characters set, rolling C++
0004 Median of Two Sorted Arrays dichotomy C++
0005 Longest Palindromic Substring DP (for循环顺序很重要) C++
0006 ZigZag Conversion string, loop C++
0007 Reverse Integer overflow detection C++
0008 String to Integer (atoi) string, automaton C++
0010 Regular Expression Matching regular expression (ingenious), string C++
0011 Container With Most Water double pointer C++
0012 Integer to Roman string C++
0013 Roman to Integer string C++
0014 Longest Common Prefix string C++
0015 3Sum double pointer+ C++
0017 Letter Combinations of a Phone Number recursion, string C++
0018 4Sum double pointer+, hash vector (C++) C++
0019 Remove Nth Node From End of List queue, link list C++
0020 Valid Parentheses stack C++
0021 Merge Two Sorted Lists link list C++
0022 Generate Parentheses back trace C++
0023 Merge k Sorted Lists merge, link list, prioirity_queue (yyds) C++
0024 Swap Nodes in Pairs link list C++
0025 Reverse Nodes in k-Group link list C++
0026 Remove Duplicates from Sorted Array double pointer C++
0027 Remove Element pointer C++
0028 Implement strStr() string Java, C++
0029 Divide Two Integers bits ops C++
0030 Substring with Concatenation of All Words string, hash C++
0031 Next Permutation double pointer swap C++
0032 Longest Valid Parentheses DP, string C++
0033 Search in Rotated Sorted Array binary search C++
0034 Find First and Last Position of Element in Sorted Array binary search C++
0035 Search Insert Position binary search C++
0036 Valid Sudoku matrix C++
0037 Sudoku Solver dfs, trace back C++
0038 Count and Say string, double pointer C++
0039 Combination Sum back trace, recursion C++
0040 Combination Sum II recursion, back trace C++
0041 First Missing Positive priority_queue (yyds), hash (miserly) C++
0042 Trapping Rain Water double pointer (ingenious), DP C++
0043 Multiply Strings string ops C++
0044 Wildcard Matching regular expression, DP C++
0045 Jump Game II DP, BFS C++
0046 Permutations recursion, back track C++
0047 Permutations II recursion C++
0048 Rotate Image matrix transform C++
0049 Group Anagrams string, hash C++
0050 Pow(x, n) quick pow C++
0051 N-Queens back track, recursion C++
0053 Maximum Subarray greedy, DP C++
0054 Spiral Matrix matrix C++
0055 Jump Game DP C++
0056 Merge Intervals interval ops, sort C++
0058 Length of Last Word string Java
0059 Spiral Matrix II matrix C++
0061 Rotate List link list C++
0062 Unique Paths DP, math C++
0063 Unique Paths II DP Java
0064 Minimum Path Sum matrix, DP C++
0066 Plus One recursion C++
0067 Add Binary string C++
0069 Sqrt(x) binary search C++
0070 Climbing Stairs DP C++
0071 Simplify Path string C++
0072 Edit Distance DP C++
0073 Set Matrix Zeroes matrix C++
0074 Search a 2D Matrix matrix C++
0075 Sort Colors sort, double pointer C++
0076 Minimum Window Substring double pointer, hash C++
0077 Combinations recursion C++
0078 Subsets recursion C++
0079 Word Search string, recursion, DFS C++
0080 Remove Duplicates from Sorted Array II double pointer C++
0081 Search in Rotated Sorted Array II binary search, sliding C++
0082 Remove Duplicates from Sorted List II link list C++
0083 Remove Duplicates from Sorted List link list C++
0084 Largest Rectangle in Histogram mono stack C++
0085 Maximal Rectangle monotonous stack C++
0086 Partition List link list C++
0088 Merge Sorted Array double pointer C++
0089 Gray Code recursion, array C++
0090 Subsets II recursion C++
0091 Decode Ways DP C++
0092 Reverse Linked List II link list C++
0093 Restore IP Addresses string, rule C++
0094 Binary Tree Inorder Traversal binary tree, inorder C++
0095 Unique Binary Search Trees II recursion, binary tree C++
0096 Unique Binary Search Trees math, DP C++
0097 Interleaving String DP, string C++
0098 Validate Binary Search Tree binary tree, recursion C++
0099 Recover Binary Search Tree binary tree, inorder traverse C++
0100 Same Tree binary tree, recursion C++
0101 Symmetric Tree binary tree, recursion C++
0102 Binary Tree Level Order Traversal binary tree, queue C++
0103 Binary Tree Zigzag Level Order Traversal binary tree, dique C++
0104 Maximum Depth of Binary Tree binary tree C++
0105 Construct Binary Tree from Preorder and Inorder Traversal binary tree (ingenious), recursion C++
0107 Binary Tree Level Order Traversal II binary tree C++
0108 Convert Sorted Array to Binary Search Tree binary tree, recursion C++
0109 Convert Sorted List to Binary Search Tree link list, binary tree C++
0110 Balanced Binary Tree recursion, binary tree C++
0111 Minimum Depth of Binary Tree binary tree, recursion C++
0112 Path Sum binary tree, recursion C++
0113 Path Sum II binary tree, dfs C++
0115 Distinct Subsequences DP C++
0116 Populating Next Right Pointers in Each Node binary tree, recursion, BFS C++
0117 Populating Next Right Pointers in Each Node II binary tree, recursion C++
0118 Pascal's Triangle 杨辉三角 C++
0119 Pascal's Triangle II杨辉三角 C++
0121 Best Time to Buy and Sell Stock greedy C++
0122 Best Time to Buy and Sell Stock II greedy C++
0123 Best Time to Buy and Sell Stock III greedy C++
0124 Binary Tree Maximum Path Sum recursion, binary tree C++
0125 Valid Palindrome string C++
0127 Word Ladder BFS, graph C++
0128 Longest Consecutive Sequence greedy, hash C++
0129 Sum Root to Leaf Numbers recursion, binary tree C++
0130 Surrounded Regions recursion, matrix C++
0131 Palindrome Partitioning recursion C++
0132 Palindrome Partitioning II DP, string C++
0134 Gas Station greedy C++
0135 Candy double scan C++
0136 Single Number XOR, hash C++
0138 Copy List with Random Pointer hash C++
0139 Word Break string, DP C++
0140 Word Break II recursion C++
0141 Linked List Cycle link list, 快慢指针 C++
0142 Linked List Cycle II link list, 快慢指针 C++
0143 Reorder List link list C++
0145 Binary Tree Postorder Traversal binary tree, traversal, recurion C++
0148 Sort List link list, merge sort C++
0149 Max Points on a Line hash C++
0150 Evaluate Reverse Polish Notation string, stack C++
0151 Reverse Words in a String string, stack C++
0152 Maximum Product Subarray DP C++
0153 Find Minimum in Rotated Sorted Array binary search C++
0160 Intersection of Two Linked Lists link list, make cycle C++
0165 Compare Version Numbers string C++, Python
0166 Fraction to Recurring Decimal string, hash C++
0168 Excel Sheet Column Title numbers C++
0169 Majority Element Moore vote C++
0173 Binary Search Tree Iterator binary tree, queue C++
0179 Largest Number string, sort C++
0188 Best Time to Buy and Sell Stock IV greedy C++
0189 Rotate Array array rotate C++
0190 Reverse Bits bit ops C++
0191 Number of 1 Bits bit ops Java, C++
0199 Binary Tree Right Side View binary tree, queue C++
0200 Number of Islands recursion C++
0203 Remove Linked List Elements link list C++
0206 Reverse Linked List link list C++
0207 Course Schedule dfs, graph, topological sort C++
0209 Minimum Size Subarray Sum double pointer C++
0210 Course Schedule II topological sort, graph C++
0212 Word Search II prefix tree, string, backtrace C++
0213 House Robber II DP C++
0215 Kth Largest Element in an Array heap, quick sort C++
0216 Combination Sum III recursion C++
0217 Contains Duplicate hash C++, Java
0218 The Skyline Problem multiset C++
0220 Contains Duplicate III set, lower_bound C++
0221 Maximal Square DP C++
0224 Basic Calculator stack, string C++
0226 Invert Binary Tree binary tree, recursion C++
0227 Basic Calculator II string, stack C++
0232 Implement Queue using Stacks stack C++
0234 Palindrome Linked List link list, reverse ll, fast slow ptr C++
0235 Lowest Common Ancestor of a Binary Search Tree binary tree, binary search C++
0236 Lowest Common Ancestor of a Binary Tree binary tree, recursion, BFS C++
0237 Delete Node in a Linked List link list C++
0238 Product of Array Except Self traverse C++
0240 Search a 2D Matrix II matrix, pointer C++
0241 Different Ways to Add Parentheses string, recursion, DP C++
0249 Group Shifted Strings string, map, hash C++
0253 Meeting Rooms II min heap C++
0257 Binary Tree Paths binary tree, recursion C++
0259 3Sum Smaller array, binary search, two pointers C++
0260 Single Number III binary ops C++
0263 Ugly Number easy C++
0264 Ugly Number II trible pointer C++
0269 Alien Dictionary topological sort C++
0273 Integer to English Words string, recursion C++
0274 H-Index sort, count C++
0277 Find the Celebrity math C++
0278 First Bad Version binary search C++
0287 Find the Duplicate Number 伪link list环 C++
0289 Game of Life matrix C++
0295 Find Median from Data Stream insert (normal), heap (ingenious) C++
0298 Binary Tree Longest Consecutive Sequence binary tree, recursion C++
0300 Longest Increasing Subsequence DP, greedy C++
0309 Best Time to Buy and Sell Stock with Cooldown greedy C++
0314 Binary Tree Vertical Order Traversal hash, BFS, binary tree C++
0315 Count of Smaller Numbers After Self binary index tree, get_rank C++
0316 Remove Duplicate Letters string, stack C++
0322 Coin Change DP C++
0323 Number of Connected Components in an Undirected Graph disjoin set C++
0328 Odd Even Linked List link list C++
0329 Longest Increasing Path in a Matrix recursion, DP C++
0331 Verify Preorder Serialization of a Binary Tree binary tree C++
0333 Largest BST Subtree binary tree, recursion C++
0337 House Robber III recursion, DP C++
0338 Counting Bits binary C++
0339 Nested List Weight Sum recursion, array C++
0340 Longest Substring with At Most K Distinct Characters counter, double pointer C++
0343 Integer Break math C++
0344 Reverse String string, double pointer C++
0347 Top K Frequent Elements counter C++
0349 Intersection of Two Arrays hash, set ops C++
0350 Intersection of Two Arrays II hash C++
0354 Russian Doll Envelopes greedy, binary search (lower_bound) C++
0363 Max Sum of Rectangle No Larger Than K double pointer, set, matrix C++
0366 Find Leaves of Binary Tree binary tree, recursion C++
0368 Largest Divisible Subset DP C++
0370 Range Addition partial_sum, array C++
0377 Combination Sum IV recursion, DP C++
0386 Lexicographical Numbers numbers, recursion C++
0387 First Unique Character in a String hash C++
0388 Longest Absolute File Path string, recursion, prefix tree C++
0392 Is Subsequence string C++
0393 UTF-8 Validation string C++
0394 Decode String string, stack C++
0395 Longest Substring with At Least K Repeating Characters recursion, binary search C++
0400 Nth Digit math C++
0402 Remove K Digits string C++
0403 Frog Jump DP C++
0406 Queue Reconstruction by Height insert, sort C++
0409 Longest Palindrome string, palindrome Java
0410 Split Array Largest Sum binary search C++
0413 Arithmetic Slices double pointer C++
0415 Add Strings string C++
0416 Partition Equal Subset Sum DP C++
0417 Pacific Atlantic Water Flow dfs, recursion, matrix C++
0418 Sentence Screen Fitting DP, string C++
0421 Maximum XOR of Two Numbers in an Array XOR, bit ops, hash C++
0423 Reconstruct Original Digits from English hash, map, string C++
0424 Longest Repeating Character Replacement string, double pointer C++
0426 Convert Binary Search Tree to Sorted Doubly Linked List binary tree, hash, heap C++
0430 Flatten a Multilevel Doubly Linked List link list C++
0435 Non-overlapping Intervals greedy C++
0437 Path Sum III binary tree, hash C++
0440 K-th Smallest in Lexicographical Order 十叉数 C++
0442 Find All Duplicates in an Array medium difficulty? C++
0443 String Compression string, counter C++
0445 Add Two Numbers II link list, stack C++
0448 Find All Numbers Disappeared in an Array for loop C++
0453 Minimum Moves to Equal Array Elements greedy C++
0456 132 Pattern monotonous stack C++
0459 Repeated Substring Pattern string C++
0461 Hamming Distance binary ops C++
0470 Implement Rand10() Using Rand7() random function C++
0474 Ones and Zeroes DP, matrix C++
0482 License Key Formatting string C++
0485 Max Consecutive Ones counter C++
0487 Max Consecutive Ones II presum, double pointer C++
0490 The Maze matrix, BFS C++
0498 Diagonal Traverse matrix C++
0503 Next Greater Element II greedy C++
0509 Fibonacci Number DP C++
0518 Coin Change 2 DP C++
0526 Beautiful Arrangement backtrace C++
0529 Minesweeper recursion, matrix C++
0532 Continuous Subarray Sum hash C++
0540 Single Element in a Sorted Array binary search C++
0543 Diameter of Binary Tree binary tree, recursion C++
0545 Boundary of Binary Tree binary tree, recursion C++
0546 Remove Boxes DP, recursion C++
0547 Number of Provinces disjoint set C++
0554 Brick Wall hash, counter C++
0556 Next Greater Element III double pointer, #0031 C++
0557 Reverse Words in a String III string Java
0560 Subarray Sum Equals K hash C++
0567 Permutation in String string, counter C++
0593 Valid Square math C++
0605 Can Place Flowers greedy Java
0611 Valid Triangle Number double pointer C++
0616 Add Bold Tag in String string C++
0617 Merge Two Binary Trees binary tree C++
0628 Maximum Product of Three Numbers math C++
0629 K Inverse Pairs Array DP, array C++
0630 Course Schedule III greedy, heap C++
0633 Sum of Square Numbers hash, double pointer C++
0643 Maximum Average Subarray I sliding window C++
0645 Set Mismatch count, XOR (待推敲) C++
0647 Palindromic Substrings double pointer C++
0662 Maximum Width of Binary Tree binary tree, queue C++
0664 Strange Printer string, DP C++
0665 Non-decreasing Array recursion, back trace C++
0666 [Path Sum IV](https://leetcode.com/problems/path-sum-iv/ array, binary tree C++
0670 Maximum Swap number Java
0678 Valid Parenthesis String string, stack C++
0679 24 Game back track, recursion C++
0680 Valid Palindrome II double pointer C++
0681 Next Closest Time greedy C++
0690 Employee Importance recursion, hash Java, C++
0692 Top K Frequent Words hash C++
0694 Number of Distinct Islands matrix, recursion, hash C++
0695 Max Area of Island recursion C++
0696 Count Binary Substrings string C++
0697 Degree of an Array counter, hash C++
0698 Partition to K Equal Sum Subsets DP, back trace C++
0704 Binary Search binary search C++
0718 Maximum Length of Repeated Subarray DP C++
0721 Accounts Merge disjoint set, hash C++
0723 Candy Crush matrix, recursion C++
0735 Asteroid Collision stack C++
0739 Daily Temperatures stack C++
0740 Delete and Earn DP, counter C++
0743 Network Delay Time BFS C++
0746 Min Cost Climbing Stairs DP C++
0763 Partition Labels string, unordered_map C++
0765 Couples Holding Hands disjoint set C++
0767 Reorganize String map, string C++
0781 Rabbits in Forest counter (hash) C++
0787 Cheapest Flights Within K Stops DP, graph Java
0792 Number of Matching Subsequences string, hash C++
0797 All Paths From Source to Target graph, BFS, DFS C++
0799 Champagne Tower DP, math C++
0815 Bus Routes graph, dijkstra, BFS C++
0819 Most Common Word string, hash C++
0832 Flipping an Image matrix C++
0853 Car Fleet math, greedy C++
0858 Mirror Reflection math, lcd, gcd C++
0863 All Nodes Distance K in Binary Tree binary tree, recursion C++
0867 Transpose Matrix matrix C++
0872 Leaf-Similar Trees binary tree, dfs C++
0875 Koko Eating Bananas binary search C++
0877 Stone Game math, DP C++
0887 Super Egg Drop DP, math C++
0897 Increasing Order Search Tree recursion, binary tree C++
0909 Snakes and Ladders matrix, BFS C++
0912 Sort an Array quick sort C++
0921 Minimum Add to Make Parentheses Valid stack, string C++
0929 Unique Email Addresses string C++
0935 Knight Dialer DP, graph C++
0937 Reorder Data in Log Files string C++
0939 Minimum Area Rectangle matrix, hash C++
0945 Minimum Increment to Make Array Unique greedy, array C++
0953 Verifying an Alien Dictionary string C++
0973 K Closest Points to Origin set, nth_element C++
0981 Time Based Key-Value Store map, string C++
0989 Add to Array-Form of Integer array integer C++
0994 Rotting Oranges matrix, BFS C++
1004 Max Consecutive Ones III binary search C++
1010 Pairs of Songs With Total Durations Divisible by 60 hash C++
1011 Capacity To Ship Packages Within D Days binary search C++
1029 Two City Scheduling array, greedy C++
1035 Uncrossed Lines DP C++
1041 Robot Bounded In Circle vector C++
1047 Remove All Adjacent Duplicates In String string C++
1048 Longest String Chain DP, dfs, string C++
1049 Last Stone Weight II recursion, DP C++
1052 Grumpy Bookstore Owner greedy C++
1061 Lexicographically Smallest Equivalent String disjoint set, string C++
1062 Longest Repeating Substring string, hash, binary search C++
1073 Adding Two Negabinary Numbers array ops C++
1102 Path With Maximum Minimum Value matrix, max heap, BFS C++
1110 Delete Nodes And Return Forest binary tree, recursion C++
1120 Maximum Average Subtree recursion, binary tree C++
1123 Lowest Common Ancestor of Deepest Leaves binary tree, recursion C++
1135 Connecting Cities With Minimum Cost disjoin set, Kruskal alg C++
1143 Longest Common Subsequence string, DP C++
1151 Minimum Swaps to Group All 1's Together sliding window, greedy C++
1152 Analyze User Website Visit Pattern string, hash C++
1169 Invalid Transactions string C++
1167 Minimum Cost to Connect Sticks heap, priority_queue C++
1175 Prime Arrangements math C++
1190 Reverse Substrings Between Each Pair of Parentheses stack, string C++
1209 Remove All Adjacent Duplicates in String II stack, string C++
1236 Web Crawler recursion, string, hash C++
1239 Maximum Length of a Concatenated String with Unique Characters backtrace, set C++
1249 Minimum Remove to Make Valid Parentheses string, stack C++
1250 Check If It Is a Good Array gcd, math C++
1268 Search Suggestions System prefix tree, string, dfs C++
1274 Number of Ships in a Rectangle recursion C++
1277 Count Square Submatrices with All Ones matrix, DP C++
1278 Palindrome Partitioning III DP, string C++
1305 All Elements in Two Binary Search Trees binary tree, dfs C++
1310 XOR Queries of a Subarray XOR, prefix sum C++
1318 Minimum Flips to Make a OR b Equal to c bit ops C++
1334 Find the City With the Smallest Number of Neighbors at a Threshold Distance graph, Floyd-Warshall's algorithm
1339 Maximum Product of Splitted Binary Tree binary tree, recursion C++
1347 Minimum Number of Steps to Make Two Strings Anagram string, hash C++
1353 Maximum Number of Events That Can Be Attended set, map, interval ops, priority queue, greedy C++
1388 Pizza With 3n Slices DP, greedy C++
1411 Number of Ways to Paint N × 3 Grid 找规律 C++
1423 Maximum Points You Can Obtain from Cards greedy, rolling C++
1428 Leftmost Column with at Least a One matrix, binary search C++
1438 Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit monotonous stack, double pointer C++
1442 Count Triplets That Can Form Two Arrays of Equal XOR XOR, hash, truble pointer C++
1444 Number of Ways of Cutting a Pizza DP, matrix, prefix sum C++
1462 Course Schedule IV topological sort C++
1465 Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts greedy C++
1480 Running Sum of 1d Array easy C++, Java
1481 Least Number of Unique Integers after K Removals hash, counter C++
1492 The kth Factor of n C++
1509 Minimum Difference Between Largest and Smallest Value in Three Moves greedy C++
1530 Number of Good Leaf Nodes Pairs binary tree, recursion C++
1539 Kth Missing Positive Number pointer C++
1553 Minimum Number of Days to Eat N Oranges DP, recursion C++
1603 Design Parking System easy C++
1614 Maximum Nesting Depth of the Parentheses string C++
1631 Path With Minimum Effort matrix, max heap, BFS C++
1644 Lowest Common Ancestor of a Binary Tree II binary tree, BFS C++
1648 Sell Diminishing-Valued Colored Balls math C++
1650 Lowest Common Ancestor of a Binary Tree III hash, recursion, binary tree C++
1658 Minimum Operations to Reduce X to Zero prefix sum, greedy, array C++
1710 Maximum Units on a Truck hash C++
1720 Decode XORed Array XOR C++
1730 Shortest Path to Get Food BFS C++
1734 Decode XORed Permutation XOR C++
1744 Can You Eat Your Favorite Candy on Your Favorite Day? prefix sum C++
1762 Buildings With an Ocean View traverse C++
1787 Make the XOR of All Segments Equal to Zero XOR, hash, DP C++
1818 Minimum Absolute Sum Difference binary search, greedy C++
1822 Sign of the Product of an Array C++
1823 Find the Winner of the Circular Game math C++
1834 Single-Threaded CPU priority queue, buffer C++
1849 Splitting a String Into Descending Consecutive Values backtrace, recursion C++
1915 Number of Wonderful Substrings DP, bitmask C++
1996 The Number of Weak Characters in the Game sort C++
2093 Minimum Cost to Reach City With Discounts graph, Dijkstra C++
2094 Finding 3-Digit Even Numbers array C++
2095 Delete the Middle Node of a Linked List link list C++
2096 Step-By-Step Directions From a Binary Tree Node to Another binary tree, dfs C++
2098 Subsequence of Size K With the Largest Even Sum max heap, array C++
2099 Find Subsequence of Length K With the Largest Sum array, max heap C++
2100 Find Good Days to Rob the Bank array, monotonous stack, DP C++
2101 Detonate the Maximum Bombs graph, bfs C++
2103 Rings and Rods string, hash C++
2104 Sum of Subarray Ranges array C++
2105 Watering Plants II array C++
2107 Number of Unique Flavors After Sharing K Candies sliding window, array, hash C++
2108 Find First Palindromic String in the Array string C++
2109 Adding Spaces to a String string C++
2110 Number of Smooth Descent Periods of a Stock array, math C++
2113 Elements in Array After Removing and Replacing Elements array C++
2114 Maximum Number of Words Found in Sentences string C++
2115 Find All Possible Recipes from Given Supplies string, hash C++
2116 Check if a Parentheses String Can Be Valid stack, string C++
2119 A Number After a Double Reversal math C++
2120 Execution of All Suffix Instructions Staying in a Grid string, matrix C++
2121 Intervals Between Identical Elements hash, array C++
2124 Check if All A's Appears Before All B's string C++
2125 Number of Laser Beams in a Bank string C++
2126 Destroying Asteroids greedy C++
2128 Remove All Ones With Row and Column Flips bit, matrix C++
2129 Capitalize the Title string C++
2130 Maximum Twin Sum of a Linked List link list C++
2131 Longest Palindrome by Concatenating Two Letter Words string, hash C++
2133 Check if Every Row and Column Contains All Numbers hash, matrix C++
2134 Minimum Swaps to Group All 1's Together II sliding window, array C++
2135 Count Words Obtained After Adding a Letter string, bit, binary search C++
2137 Pour Water Between Buckets to Make Water Levels Equal binary search C++
2138 Divide a String Into Groups of Size k string C++
2139 Minimum Moves to Reach Target Score math C++
2140 Solving Questions With Brainpower DP C++
2144 Minimum Cost of Buying Candies With Discount array, greedy C++
2145 Count the Hidden Sequences array, prefix sum C++
2146 K Highest Ranked Items Within a Price Range matrix, BFS C++
2148 Count Elements With Strictly Smaller and Greater Elements hash, array C++
2149 Rearrange Array Elements by Sign array C++
2150 Find All Lonely Numbers in the Array hash, array C++
2152 Minimum Number of Lines to Cover Points math, DP, recursion C++
2154 Keep Multiplying Found Values by Two hash C++
2155 All Divisions With the Highest Score of a Binary Array array, prefix sum C++
2160 Minimum Sum of Four Digit Number After Splitting Digits math, greedy C++
2161 Partition Array According to Given Pivot array C++
2162 Minimum Cost to Set Cooking Time math, enumeration C++
2164 Sort Even and Odd Indices Independently array C++
2165 Smallest Value of the Rearranged Number string, sort C++
2169 Count Operations to Obtain Zero math C++
2170 Minimum Operations to Make the Array Alternating hash, greedy C++
2171 Removing Minimum Number of Magic Beans prefix sum, array C++
2168 Unique Substrings With Equal Digit Frequency string, rolling hash C++
2174 Remove All Ones With Row and Column Flips II BFS, matrix C++
2176 Count Equal and Divisible Pairs in an Array array C++
2177 Find Three Consecutive Integers That Sum to a Given Number math C++
2178 Maximum Split of Positive Even Integers math, array C++
2180 Count Integers With Even Digit Sum math C++
2181 Merge Nodes in Between Zeros link list C++
2182 Construct String With Repeat Limit string, heap C++
2184 Number of Ways to Build Sturdy Brick Wall DP, bit, recursion C++
2189 Number of Ways to Build House of Cards DP, recursion C++
2190 Most Frequent Number Following Key In an Array array C++
2191 Sort the Jumbled Numbers map, array C++
2192 All Ancestors of a Node in a Directed Acyclic Graph BFS, graph C++
2194 Cells in a Range on an Excel Sheet string C++
2195 Append K Integers With Minimal Sum math C++
2196 Create Binary Tree From Descriptions binary tree, hash C++
2198 Number of Single Divisor Triplets math C++
2200 Find All K-Distant Indices in an Array array C++
2201 Count Artifacts That Can Be Extracted hash C++
2202 Maximize the Topmost Element After K Moves array C++
2206 Divide Array Into Equal Pairs array C++
2207 Maximize Number of Subsequences in a String greedy, string C++
2208 Minimum Operations to Halve Array Sum greedy, heap C++cm
2210 Count Hills and Valleys in an Array array C++
2211 Count Collisions on a Road stack C++
2212 Maximum Points in an Archery Competition backtrace C++
2214 Minimum Health to Beat Game greedy C++
2215 Find the Difference of Two Arrays hash C++
2216 Minimum Deletions to Make Array Beautiful greedy C++
2217 Find Palindrome With Fixed Length math, palindrome C++
2219 Maximum Sum Score of Array prefix C++
2220 Minimum Bit Flips to Convert Number XOR C++
2221 Find Triangular Sum of an Array math C++
2222 Number of Ways to Select Buildings DP, string C++
2226 Maximum Candies Allocated to K Children binary search C++
2229 Check if an Array Is Consecutive array C++
2235 Add Two Integers simple C++
2236 Root Equals Sum of Children binary tree C++
2237 Count Positions on Street With Required Brightness interval C++
2239 Find Closest Number to Zero array C++
2240 Number of Ways to Buy Pens and Pencils enumeration C++
2250 Count Number of Rectangles Containing Each Point binary search C++
2255 Count Prefixes of a Given String string C++
2256 Minimum Average Difference prefix sum C++
2257 Count Unguarded Cells in the Grid matrix C++
2263 Make Array Non-decreasing or Non-increasing math,max heap C++
2268 Minimum Number of Keypresses hash, string C++
2269 Find the K-Beauty of a Number string C++
2270 Number of Ways to Split Array prefix sum C++
2271 Maximum White Tiles Covered by a Carpet interval, prefix sum C++
2282 Number of People That Can Be Seen in a Grid binary search, monotonous stack C++
2283 Check if Number Has Equal Digit Count and Digit Value hash C++
2284 Sender With Largest Word Count hash, max heap C++
2285 Maximum Total Importance of Roads max heap, graph C++
2289 Steps to Make Array Non-decreasing DP C++
2305 Fair Distribution of Cookies backtrace C++
2369 Check if There is a Valid Partition For The Array DP C++
2370 Longest Ideal Subsequence DP C++
2375 Construct Smallest Number From DI String string, greedy C++
2572 Count the Number of Square-Free Subsets bit, DP C++
2864 Maximum Odd Binary Number string C++
2894 Divisible and Non-divisible Sums Difference math C++
2895 Minimum Processing Time array C++
2897 Apply Operations on Array to Maximize Sum of Squares bit, math C++
2905 Find Indices With Index and Value Difference II set, array C++
2925 Maximum Score After Applying Operations on a Tree tree, topology C++
2933 High-Access Employees string, array C++
100048 Beautiful Towers II monotonous stack C++
100049 Beautiful Towers I monotonous stack C++
100142 Make Lexicographically Smallest Array by Swapping Elements array, map, set C++
LCP09 最小跳跃次数 BFS C++
剑03 数组中重复的数字 hash C++
剑05 替换空格 string C++
剑07 重建二叉树 binary tree, recursion C++
剑12 矩阵中的路径 recursion, back trace C++
剑13 机器人的运动范围 recursion C++
剑18 删除链表的节点 link list C++
剑20 表示数值的字符串 string (判断折磨人) C++
剑21 调整数组顺序使奇数位于偶数前面 double pointer C++
剑22 链表中倒数第k个节点 link list C++
剑26 树的子结构 binary tree, recursion C++
剑27 二叉树的镜像 binary tree, recursion C++
剑32 I. 从上到下打印二叉树 binary tree, bfs C++
剑33 二叉搜索树的后序遍历序列 recursion C++
剑38 字符串的排列 recursion, string C++
剑42 连续子数组的最大和 greedy, DP C++
剑45 把数组排成最小的数 string, sort C++
剑46 把数字翻译成字符串 recursion C++
剑47 礼物的最大价值 DP Java
剑50 第一个只出现一次的字符 counter Java
剑51 数组中的逆序对 merge sort, binary indexed tree C++
剑53 II. 0~n-1中缺失的数字 binary search C++
剑56 I. 数组中数字出现的次数 XOR, bits ops C++
剑57 II. 和为s的连续正数序列 math C++
剑58 II. 左旋转字符串 string C++
剑60 n个骰子的点数 DP C++
剑61 扑克牌中的顺子 playing cards C++
剑62 圆圈中最后剩下的数字 math C++
剑64 求1+2+…+n recursion C++
剑66 构建乘积数组 DP C++
剑119 最长连续序列 hash, set C++
面01.01 Is Unique LCCI bits ops C++
面01.06 Compress String LCCI string, double pointer C++
面02.02 Kth Node From End of List LCCI link list C++
面02.03 Delete Middle Node LCCI link list C++
面02.05 链表求和 link list C++
面08.06 Hanota LCCI recursion C++
面08.09 Bracket LCCI string, recursion C++
面10.01 Sorted Merge LCCI merge C++
面16.14 Best Line LCCI hash, greedy C++
面16.19 Pond Sizes LCCI dfs, recursion C++
面16.26 Calculator LCCI string, stack C++
面17.21 直方图的水量 double pointer C++
面17.24 Max Submatrix LCCI greedy, prefix sum, matrix C++

Data Structure

# Title Comment Language
0146 LRU Cache link list, hash C++
0155 Min Stack stack C++
0158 Read N Characters Given Read4 II - Call multiple times buffer C++
0208 Implement Trie (Prefix Tree) prefix tree, recursion C++
0211 Design Add and Search Words Data Structure prefix tree, recursion C++
0244 Shortest Word Distance II hash, string, double pointer C++
0284 Peeking Iterator iterator C++
0303 Range Sum Query - Immutable prefix sum C++
0304 Range Sum Query 2D - Immutable matrix, prefix sum C++
0307 Range Sum Query - Mutable Binary Index Tree, array C++
0341 Flatten Nested List Iterator dfs C++
0348 Design Tic-Tac-Toe game C++
0359 Logger Rate Limiter map, hash C++
0362 Design Hit Counter queue C++
0380 Insert Delete GetRandom O(1) hash, array C++
0381 Insert Delete GetRandom O(1) - Duplicates allowed hash, set, array C++
0384 Shuffle an Array random C++
0398 Random Pick Index hash, map C++
0428 Serialize and Deserialize N-ary Tree recursion, dfs, string, stringstream C++
0528 Random Pick with Weight binary search, upper_bound C++
0588 Design In-Memory File System prefix tree (tries) C++
0707 Design Linked List link list C++
0895 Maximum Frequency Stack stack, counter, hash C++
1146 Snapshot Array hash map C++
1244 Design A Leaderboard heap, hash C++
1352 Product of the Last K Numbers prefix C++
1396 Design Underground System hash, string C++
1472 Design Browser History list, iterator C++
1570 Dot Product of Two Sparse Vectors hash, vector C++
1628 Design an Expression Tree With Evaluate Function stack C++
1656 Design an Ordered Stream array C++
2166 Design Bitset string C++
2241 Design an ATM Machine greedy C++
剑59 II. 队列的最大值 deque C++

SQL

# Title Comment
0175 Combine Two Tables OUTER JOIN
0176 Second Highest Salary nested MAX
0177 Nth Highest Salary 更通用的求第n大的条目的方法
0178 Rank Scores DENSE_RANK()
0180 Consecutive Numbers DISTINCT, 根据value的出现频次筛选条目
0181 Employees Earning More Than Their Managers 自连接
0182 Duplicate Emails 只取有重复的元素
0184 Department Highest Salary MAX from groups
0196 Delete Duplicate Emails DELETE
0197 Rising Temperature DATEDIFF
0595 Big Countries
1777 Product's Price for Each Store SUM, IF
1873 Calculate Special Bonus IF
2205 The Number of Users That Are Eligible for Discount BETWEEN, DISTINCT

About

LeetCode刷题记录

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages