Problems
力扣题解
Problem | Solution | Supplementary |
1. Two Sum | ---- | |
3. Longest Substring Without Repeating Characters | ---- | |
4. Median of Two Sorted Arrays | ---- | |
6. ZigZag Conversion | ---- | |
11. Container With Most Water | --- | |
15. 3Sum | ||
16. 3Sum Closest | ----- | |
17. Letter Combinations of a Phone Number | ----- | |
18. 4Sum | ||
19. Remove Nth Node From End of List | ----- | |
20. Valid Parentheses | ----- | |
22. Generate Parentheses | ||
24. Swap Nodes in Pairs | ---- | |
26. Remove Duplicates from Sorted Array | ||
27. Remove Element | ---- | |
28. Implement strStr() | ---- | |
31. Next Permutation | ||
33. Search in Rotated Sorted Array | ||
36. Valid Sudoku | --- | |
37. Sudoku Solver | --- | |
39. Combination Sum | --- | |
40. Combination Sum II | --- | |
42. Trapping Rain Water | ||
45. Jump Game II | ||
46. Permutations | --- | |
47. Permutations II | --- | |
48. Rotate Image | --- | |
50. Pow(x, n) | --- | |
51. N-Queens | --- | |
53. Maximum Subarray | --- | |
54. Spiral Matrix | ---- | |
55. Jump Game | ||
56. Merge Intervals | ---- | |
59. Spiral Matrix II | ---- | |
60. Permutation Sequence | ||
62. Unique Paths | ---- | |
63. Unique Paths II | ---- | |
66. Plus One | --- | |
70. Climbing Stairs | ---- | |
71. Simplify Path | ---- | |
72. Edit Distance | ---- | |
73. Set Matrix Zeroes | --- | |
77. Combinations | --- | |
78. Subsets | --- | |
80. Remove Duplicates from Sorted Array II | ||
81. Search in Rotated Sorted Array II | ||
84. Largest Rectangle in Histogram | --- | |
89. Gray Code | ||
90. Subsets II | --- | |
93. Restore IP Addresses | --- | |
94. Binary Tree Inorder Traversal | --- | |
96. Unique Binary Search Trees | --- | |
98. Validate Binary Search Tree | --- | |
99. Recover Binary Search Tree | --- | |
100. Same Tree | --- | |
101. Symmetric Tree | ---- | |
102. Binary Tree Level Order Traversal | ---- | |
104. Maximum Depth of Binary Tree | ---- | |
106. Construct Binary Tree from Inorder and Postorder Traversal | ---- | |
108. Convert Sorted Array to Binary Search Tree | ---- | |
110. Balanced Binary Tree | ---- | |
111. Minimum Depth of Binary Tree | ---- | |
112. Path Sum | ---- | |
113. Path Sum II | ---- | |
115. Distinct Subsequences | ---- | |
120. Triangle | ---- | |
121. Best Time to Buy and Sell Stock | --- | |
122. Best Time to Buy and Sell Stock II | --- | |
123. Best Time to Buy and Sell Stock III | --- | |
128. Longest Consecutive Sequence | ||
131. Palindrome Partitioning | --- | |
133. Clone Graph | --- | |
134. Gas Station | ||
135. Candy | ---- | |
136. Single Number | --- | |
137. Single Number II | ----- | |
139. Word Break | ----- | |
141. Linked List Cycle | ---- | |
142. Linked List Cycle II | ----- | |
144. Binary Tree Preorder Traversal | ----- | |
145. Binary Tree Postorder Traversal | ---- | |
150. Evaluate Reverse Polish Notation | ----- | |
151. Reverse Words in a String | ----- | |
160. Intersection of Two Linked Lists | --- | |
172. Factorial Trailing Zeroes | ||
188. Best Time to Buy and Sell Stock IV | --- | |
190. Reverse Bits | --- | |
198. House Robber | --- | |
202. Happy Number | --- | |
203. Remove Linked List Elements | --- | |
206. Reverse Linked List | --- | |
209. Minimum Size Subarray Sum | --- | |
213. House Robber II | --- | |
216. Combination Sum III | --- | |
219. Contains Duplicate II | ||
222. Count Complete Tree Nodes | --- | |
225. Implement Stack using Queues | --- | |
232. Implement Queue using Stacks | ---- | |
235. Lowest Common Ancestor of a Binary Search Tree | ---- | |
236. Lowest Common Ancestor of a Binary Tree | ---- | |
239. Sliding Window Maximum | ---- | |
242. Valid Anagram | --- | |
257. Binary Tree Paths | --- | |
258. Add Digits | ||
260. Single Number III | --- | |
268. Missing Number | --- | |
279. Perfect Squares | ---- | |
300. Longest Increasing Subsequence | ---- | |
306. Additive Number | ||
307. Range Sum Query - Mutable | ||
309. Best Time to Buy and Sell Stock with Cooldown | ---- | |
318. Maximum Product of Word Lengths | --- | |
322. Coin Change | --- | |
332. Reconstruct Itinerary | --- | |
334. Increasing Triplet Subsequence | ||
337. House Robber III | --- | |
343. Integer Break | --- | |
344. Reverse String | --- | |
349. Intersection of Two Arrays | --- | |
357. Count Numbers with Unique Digits | ||
372. Super Pow | ||
373. Find K Pairs with Smallest Sums | ||
376. Wiggle Subsequence | --- | |
377. Combination Sum IV | --- | |
380. Insert Delete GetRandom O(1) | ||
382. Linked List Random Node | --- | |
383. Ransom Note | --- | |
385. Mini Parser | ||
386. Lexicographical Numbers | ||
388. Longest Absolute File Path | ||
390. Elimination Game | --- | |
392. Is Subsequence | --- | |
393. UTF-8 Validation | ||
395. Longest Substring with At Least K Repeating Characters | --- | |
396. Rotate Function | ||
397. Integer Replacement | --- | |
398. Random Pick Index | ||
404. Sum of Left Leaves | --- | |
406. Queue Reconstruction by Height | --- | |
415. Add Strings | ---- | |
416. Partition Equal Subset Sum | ---- | |
417. Pacific Atlantic Water Flow | ||
419. Battleships in a Board | ---- | |
420. Strong Password Checker | ||
427. Construct Quad Tree | ||
429. N-ary Tree Level Order Traversal | ||
432. All O one Data Structure | ||
433. Minimum Genetic Mutation | ||
435. Non-overlapping Intervals | ---- | |
440. K-th Smallest in Lexicographical Order | ||
429. N-ary Tree Level Order Traversal | ||
436. Find Right Interval | ||
442. Find All Duplicates in an Array | ---- | |
449. Serialize and Deserialize BST | ---- | |
452. Minimum Number of Arrows to Burst Balloons | ---- | |
454. 4Sum II | ---- | |
455. Assign Cookies | ---- | |
458. Poor Pigs | ---- | |
459. Repeated Substring Pattern | ---- | |
461. Hamming Distance | ---- | |
462. Minimum Moves to Equal Array Elements II | ||
474. Ones and Zeroes | ---- | |
475. Heaters | ||
479. Largest Palindrome Product | ||
491. Increasing Subsequences | ---- | |
494. Target Sum | ---- | |
496. Next Greater Element I | ---- | |
501. Find Mode in Binary Search Tree | ---- | |
503. Next Greater Element II | ---- | |
504. Base 7 | ||
506. Relative Ranks | ---- | |
507. Perfect Number | ---- | |
509. Fibonacci Number | ---- | |
513. Find Bottom Left Tree Value | ---- | |
516. Longest Palindromic Subsequence | ---- | |
518. Coin Change 2 | ---- | |
521. 最长特殊序列 Ⅰ | ||
524. Longest Word in Dictionary through Deleting | ||
530. Minimum Absolute Difference in BST | ---- | |
537. Complex Number Multiplication | ||
538. Convert BST to Greater Tree | ---- | |
539. Minimum Time Difference | ||
540. Single Element in a Sorted Array | ||
541. Reverse String II | --- | |
553. Optimal Division | ||
559. Maximum Depth of N-ary Tree | --- | |
563. Binary Tree Tilt | --- | |
564. Find the Closest Palindrome | ||
572. Subtree of Another Tree | --- | |
583. Delete Operation for Two Strings | --- | |
587. Erect the Fence | ||
589. N-ary Tree Preorder Traversal | ||
590. N-ary Tree Postorder Traversal | ||
591. Tag Validator | ||
599. Minimum Index Sum of Two Lists | ||
606. Construct String from Binary Tree | ||
617. Merge Two Binary Trees | --- | |
647. Palindromic Substrings | --- | |
653. Two Sum IV - Input is a BST | ||
654. Maximum Binary Tree | --- | |
661. Image Smoother | ||
668. Kth Smallest Number in Multiplication Table | ||
669. Trim a Binary Search Tree | --- | |
674. Longest Continuous Increasing Subsequence | --- | |
682. Baseball Game | ||
688. Knight Probability in Chessboard | ||
689. Maximum Sum of 3 Non-Overlapping Subarrays | ||
691. Stickers to Spell Word | ||
692. Top K Frequent Words | --- | |
693. Binary Number with Alternating Bits | ||
700. Search in a Binary Search Tree | --- | |
701. Insert into a Binary Search Tree | --- | |
704. Binary Search | --- | |
707. Design Linked List | --- | |
709. To Lower Case | --- | |
713. Subarray Product Less Than K | ||
714. Best Time to Buy and Sell Stock with Transaction Fee | --- | |
717. 1-bit and 2-bit Characters | ||
718. Maximum Length of Repeated Subarray | --- | |
720. Longest Word in Dictionary | ||
728. Self Dividing Numbers | --- | |
738. Monotone Increasing Digits | --- | |
739. Daily Temperatures | --- | |
746. Min Cost Climbing Stairs | --- | |
747. Largest Number At Least Twice of Others | ||
748. Shortest Completing Word | --- | |
763. Partition Labels | --- | |
780. Reaching Points | ||
786. K-th Smallest Prime Fraction | --- | |
794. Valid Tic-Tac-Toe State | ||
798. Smallest Rotation with Highest Score | ||
804. Unique Morse Code Words | ||
806. Number of Lines To Write String | --- | |
807. Max Increase to Keep City Skyline | --- | |
812. Largest Triangle Area | ||
819. Most Common Word | ||
821. Shortest Distance to a Character | ||
838. Push Dominoes | ||
846. Hand of Straights | --- | |
860. Lemonade Change | --- | |
868. Binary Gap | ||
883. Projection Area of 3D Shapes | ||
884. Uncommon Words from Two Sentences | ||
905. Sort Array By Parity | ||
908. Smallest Range I | --- | |
911. Online Election | --- | |
913. Cat and Mouse | --- | |
917. Reverse Only Letters | ||
933. Number of Recent Calls | ||
937. Reorder Data in Log Files | ||
942. DI String Match | ||
953. Verifying an Alien Dictionary | ||
954. Array of Doubled Pairs | ||
961. N-Repeated Element in Size 2N Array | ||
968. Binary Tree Cameras | --- | |
969. Pancake Sorting | ||
977. Squares of a Sorted Array | --- | |
997. Find the Town Judge | ||
1001. Grid Illumination | ||
1005. Maximize Sum Of Array After K Negations | ------ | |
1020. Number of Enclaves | ||
1034. Coloring A Border | ------ | |
1035. Uncrossed Lines | ------ | |
1036. Escape a Large Maze | ------ | |
1047. Remove All Adjacent Duplicates In String | ------ | |
1049. Last Stone Weight II | ------ | |
1143. Longest Common Subsequence | ------ | |
1154. Day of the Year | ||
1185. Day of the Week | ------ | |
1189. Maximum Number of Balloons | ||
1219. Path with Maximum Gold | ||
1220. Count Vowels Permutation | ||
1305. All Elements in Two Binary Search Trees | ||
1332. Remove Palindromic Subsequences | ||
1342. Number of Steps to Reduce a Number to Zero | ||
1345. Jump Game IV | ||
1356. Sort Integers by The Number of 1 Bits | ------ | |
1380. Lucky Numbers in a Matrix | ||
1405. Longest Happy String | ||
1414. Find the Minimum Number of Fibonacci Numbers Whose Sum Is K | ||
1447. Simplified Fractions | ||
1449. Form Largest Integer With Digits That Add up to Target | ||
1518. Water Bottles | ||
1576. Replace All ?'s to Avoid Consecutive Repeating Characters | ||
1601. Maximum Number of Achievable Transfer Requests | ||
1606. Find Servers That Handled Most Number of Requests | ||
1610. Maximum Number of Visible Points | ------ | |
1614. Maximum Nesting Depth of the Parentheses | ------ | |
1629. Slowest Key | ------ | |
1672. Richest Customer Wealth | ------ | |
1688. Count of Matches in Tournament | ------ | |
1706. Where Will the Ball Fall | ||
1716. Calculate Money in Leetcode Bank | ||
1719. Number Of Ways To Reconstruct A Tree | ||
1725. Number Of Rectangles That Can Form The Largest Square | ||
1748. Sum of Unique Elements | ||
1763. Longest Nice Substring | ||
1765. Map of Highest Peak | ||
1791. Find Center of Star Graph | ||
1816. Truncate Sentence | ------ | |
1823. Find the Winner of the Circular Game | ||
1984. Minimum Difference Between Highest and Lowest of K Scores | ||
1994. The Number of Good Subsets | ||
1996. The Number of Weak Characters in the Game | ||
2000. Reverse Prefix of Word | ||
2006. Count Number of Pairs With Absolute Difference K | ||
2013. Detect Squares | ||
2016. Maximum Difference Between Increasing Elements | ||
2022. Convert 1D Array Into 2D Array | ------ | |
2024. Maximize the Confusion of an Exam | ||
2028. Find Missing Observations | ||
2029. Stone Game IX | ||
2034. Stock Price Fluctuation | ------ | |
2038. Remove Colored Pieces if Both Neighbors are the Same Color | ||
2039. The Time When the Network Becomes Idle | ||
2044. Count Number of Maximum Bitwise-OR Subsets | ||
2045. Second Minimum Time to Reach Destination | ||
2047. Number of Valid Words in a Sentence | ------ | |
2049. Count Nodes With the Highest Score | ||
2055. Plates Between Candles | ||
2062. Count Vowel Substrings of a String | ------ | |
2063. Vowels of All Substrings | ------ | |
2100. Find Good Days to Rob the Bank | ||
2104. Sum of Subarray Ranges | ||
5194. Minimum Moves to Reach Target Score | ||
5976. Check if Every Row and Column Contains All Numbers | ||
5977. Minimum Swaps to Group All 1's Together II | ----- | |
5982. Solving Questions With Brainpower | ||
5992. Maximum Good People Based on Statements | ||
6003. Minimum Time to Remove All Cars Containing Illegal Goods |
剑指 Offer
程序员面试金典
Last updated