Skip to content

ZhongRuoyu/LeetCode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

My LeetCode Solutions

Table of Contents

Title Difficulty Related Topics Solution
1. Two Sum Easy Array; Hash Table C++
2. Add Two Numbers Medium Linked List; Math; Recursion C
3. Longest Substring Without Repeating Characters Medium Hash Table; String; Sliding Window C++
5. Longest Palindromic Substring Medium String; Dynamic Programming JavaScript
7. Reverse Integer Medium Math C
8. String to Integer (atoi) Medium String C
9. Palindrome Number Easy Math C
11. Container With Most Water Medium Array; Two Pointers; Greedy C++
12. Integer to Roman Medium Hash Table; Math; String C++
13. Roman to Integer Easy Hash Table; Math; String C++
14. Longest Common Prefix Easy String C++
15. 3Sum Medium Array; Two Pointers; Sorting C++
16. 3Sum Closest Medium Array; Two Pointers; Sorting C++
17. Letter Combinations of a Phone Number Medium Hash Table; Sorting; Backtracking C++
18. 4Sum Medium Array; Two Pointers; Sorting C++
19. Remove Nth Node From End of List Medium Linked List; Two Pointers C++
20. Valid Parentheses Easy String; Stack C++
21. Merge Two Sorted Lists Easy Linked List; Recursion C
22. Generate Parentheses Medium String; Dynamic Programming; Backtracking C++
23. Merge k Sorted Lists Hard Linked List; Divide and Conquer; Heap (Priority Queue); Merge Sort C++
24. Swap Nodes in Pairs Medium Linked List; Recursion C
26. Remove Duplicates from Sorted Array Easy Array; Two Pointers C++
27. Remove Element Easy Array; Two Pointers C++
28. Implement strStr() Easy Two Pointers; String; String Matching C++
29. Divide Two Integers Medium Math; Bit Manipulation C++
31. Next Permutation Medium Array; Two Pointers JavaScript
32. Longest Valid Parentheses Hard String; Dynamic Programming; Stack Rust
33. Search in Rotated Sorted Array Medium Array; Binary Search JavaScript
34. Find First and Last Position of Element in Sorted Array Medium Array; Binary Search JavaScript
35. Search Insert Position Easy Array; Binary Search C++
36. Valid Sudoku Medium Array; Hash Table; Matrix C++
37. Sudoku Solver Hard Array; Backtracking; Matrix C++ / JavaScript
38. Count and Say Medium String C++
41. First Missing Positive Hard Array; Hash Table C++
42. Trapping Rain Water Hard Array; Two Pointers; Dynamic Programming; Stack; Monotonic Stack C++
44. Wildcard Matching Hard String; Dynamic Programming; Greedy; Recursion Go
46. Permutations Medium Array; Backtracking C++
47. Permutations II Medium Array; Backtracking C++
48. Rotate Image Medium Array; Math; Matrix C++
49. Group Anagrams Medium Hash Table; String; Sorting C++
50. Pow(x, n) Medium Math; Recursion C
51. N-Queens Hard Array; Backtracking C++
52. N-Queens II Hard Backtracking C++
53. Maximum Subarray Easy Array; Divide and Conquer; Dynamic Programming C++
55. Jump Game Medium Array; Dynamic Programming; Greedy JavaScript
56. Merge Intervals Medium Array; Sorting C++
58. Length of Last Word Easy String C++
62. Unique Paths Medium Math; Dynamic Programming; Combinatorics C++
63. Unique Paths II Medium Array; Dynamic Programming; Matrix Rust
65. Valid Number Hard String C++
66. Plus One Easy Array; Math C++
67. Add Binary Easy Math; String; Bit Manipulation; Simulation C
68. Text Justification Hard Array; String; Simulation Rust
69. Sqrt(x) Easy Math; Binary Search C
70. Climbing Stairs Easy Math; Dynamic Programming; Memorization C++
73. Set Matrix Zeroes Medium Array; Hash Table; Matrix JavaScript
74. Search a 2D Matrix Medium Array; Binary Search; Matrix C++
75. Sort Colors Medium Array; Two Pointers; Sorting JavaScript
78. Subsets Medium Array; Backtracking; Bit Manipulation JavaScript
79. Word Search Medium Array; Backtracking; Matrix C++
82. Remove Duplicates from Sorted List II Medium Linked List; Two Pointers C++
83. Remove Duplicates from Sorted List Easy Linked List C++
86. Partition List Medium Linked List; Two Pointers C++
88. Merge Sorted Array Easy Array; Two Pointers; Sorting C / C++
89. Gray Code Medium Math; Backtracking; Bit Manipulation C++
91. Decode Ways Medium String; Dynamic Programming C++
93. Restore IP Addresses Medium String; Backtracking JavaScript
94. Binary Tree Inorder Traversal Easy Stack; Tree; Depth-First Search; Binary Tree JavaScript
100. Same Tree Easy Tree; Depth-First Search; Breadth-First Search; Binary Tree C++
101. Symmetric Tree Easy Tree; Depth-First Search; Breadth-First Search; Binary Tree C++
104. Maximum Depth of Binary Tree Easy Tree; Depth-First Search; Breadth-First Search; Binary Tree C++
108. Convert Sorted Array to Binary Search Tree Easy Array; Divide and Conquer; Tree; Binary Search Tree; Binary Tree C++
115. Distinct Subsequences Hard String; Dynamic Programming C++
118. Pascal's Triangle Easy Array; Dynamic Programming C++
119. Pascal's Triangle II Easy Array; Dynamic Programming Rust
120. Triangle Medium Array; Dynamic Programming Rust
121. Best Time to Buy and Sell Stock Easy Array; Dynamic Programming C / C++
125. Valid Palindrome Easy Two Pointers; String C
128. Longest Consecutive Sequence Medium Array; Hash Table; Union Find C++
136. Single Number Easy Array; Bit Manipulation C
141. Linked List Cycle Easy Hash Table; Linked List; Two Pointers C++
146. LRU Cache Medium Hash Table; Linked List; Design; Doubly-Linked List C++
150. Evaluate Reverse Polish Notation Medium Array; Math; Stack C++
155. Min Stack Easy Stack; Design C
160. Intersection of Two Linked Lists Easy Hash Table; Linked List; Two Pointers C++
167. Two Sum II - Input Array Is Sorted Easy Array; Two Pointers; Binary Search C++
168. Excel Sheet Column Title Easy Math; String C++
169. Majority Element Easy Array; Hash Table; Divide and Conquer; Sorting; Counting C++
171. Excel Sheet Column Number Easy Math; String C
172. Factorial Trailing Zeroes Medium Math C
175. Combine Two Tables Easy Database MySQL
176. Second Highest Salary Medium Database MySQL
177. Nth Highest Salary Medium Database MySQL
178. Rank Scores Medium Database MySQL
179. Largest Number Medium String; Greedy; Sorting Go
180. Consecutive Numbers Medium Database MySQL
181. Employees Earning More Than Their Managers Easy Database MySQL
182. Duplicate Emails Easy Database MySQL
183. Customers Who Never Order Easy Database MySQL
184. Department Highest Salary Medium Database MySQL
185. Department Top Three Salaries Hard Database MySQL
189. Rotate Array Medium Array; Math; Two Pointers C++
190. Reverse Bits Easy Divide and Conquer; Bit Manipulation C++
191. Number of 1 Bits Easy Bit Manupulation C
192. Word Frequency Medium Shell Bash
193. Valid Phone Numbers Easy Shell Bash
194. Transpose File Medium Shell Bash
195. Tenth Line Easy Shell Bash
196. Delete Duplicate Emails Easy Database MySQL
197. Rising Temperature Easy Database MySQL
200. Number of Islands Medium Array; Depth-First Search; Breadth-First Search; Union Find; Matrix C++
202. Happy Number Easy Hash Table; Math; Two Pointers Go
203. Remove Linked List Elements Easy Linked List; Recursion C++
204. Count Primes Medium Array; Math; Enumeration; Number Theory C
206. Reverse Linked List Easy Linked List; Recursion C
208. Implement Trie (Prefix Tree) Medium Hash Table; String; Design; Trie Rust
211. Design Add and Search Words Data Structure Medium String; Depth-First Search; Design; Trie C++
217. Contains Duplicate Easy Array; Hash Table; Sorting C++
219. Contains Duplicate II Easy Array; Hash Table; Sliding Window C++
220. Contains Duplicate III Medium Array; Sliding Window; Sorting; Bucket Sort; Ordered Set C++
221. Maximal Square Medium Array; Dynamic Programming; Matrix Rust
223. Rectangle Area Medium Math; Geometry C++
226. Invert Binary Tree Easy Tree; Depth-First Search; Breadth-First Search; Binary Tree C
228. Summary Ranges Easy Array C++
231. Power of Two Easy Math; Bit Manipulation; Recursion C
237. Delete Node in a Linked List Easy Linked List C
238. Product of Array Except Self Medium Array; Prefix Sum C++
239. Sliding Window Maximum Hard Array; Queue; Sliding Window; Heap (Priority Queue); Monotonic Queue Rust
242. Valid Anagram Easy Hash Table; String; Sorting Rust
258. Add Digits Easy Math; Simulation; Number Theory C
262. Trips and Users Hard Database MySQL
263. Ugly Number Easy Math C
268. Missing Number Easy Array; Hash Table; Math; Bit Manipulation; Sorting C
278. First Bad Version Easy Binary Search; Interactive C++
283. Move Zeroes Easy Array; Two Pointers C++
289. Game of Life Medium Array; Matrix; Simulation C++
290. Word Pattern Easy Hash Table; String Ruby
292. Nim Game Easy Math; Brainteaser; Game Theory C++
299. Bulls and Cows Medium Hash Table; String; Counting Ruby
303. Range Sum Query - Immutable Easy Array; Design; Prefix Sum Go
319. Bulb Switcher Easy Math; Brainteaser C++
322. Coin Change Medium Array; Dynamic Programming; Breadth-First Search Rust
326. Power of Three Easy Math; Recursion C
328. Odd Even Linked List Medium Linked List C
338. Counting Bits Easy Dynamic Programming; Bit Manipulation C
342. Power of Four Easy Math; Bit Manipulation; Recursion C++
344. Reverse String Easy Two Pointers; String; Recursion C / C++
345. Reverse Vowels of a String Easy Two Pointers; String Ruby
347. Top K Frequent Elements Medium Array; Hash Table; Divide and Conquer; Sorting; Heap (Priority Queue); Bucket Sort; Counting; Quickselect Rust
349. Intersection of Two Arrays Easy Array; Hash Table; Two Pointers; Binary Search; Sorting C++
350. Intersection of Two Arrays II Easy Array; Hash Table; Two Pointers; Binary Search; Sorting C++
367. Valid Perfect Square Easy Math; Binary Search C++
380. Insert Delete GetRandom O(1) Medium Array; Hash Table; Math; Design; Randomized Go
381. Insert Delete GetRandom O(1) - Duplicates allowed Hard Array; Hash Table; Math; Design; Randomized Go
383. Ransom Note Easy Hash Table; String; Counting C++
387. First Unique Character in a String Easy Hash Table; String; Queue; Counting C++
389. Find the Difference Easy Hash Table; String; Bit Manipulation; Sorting C++
398. Random Pick Index Medium Hash Table; Math; Reservoir Sampling; Randomized Rust
401. Binary Watch Easy Backtracking; Bit Manipulation C++
404. Sum of Left Leaves Easy Tree; Depth-First Search; Breadth-First Search; Binary Tree C++
405. Convert a Number to Hexadecimal Easy Math; Bit Manipulation C++
406. Queue Reconstruction by Height Medium Array; Greedy; Binary Indexed Tree; Segment Tree; Sorting Rust
412. Fizz Buzz Easy Math; String; Simulation C++
413. Arithmetic Slices Medium Array; Dynamic Programming Rust
415. Add Strings Easy Math; String; Simulation C
419. Battleships in a Board Medium Array; Depth-First Search; Matrix Rust
430. Flatten a Multilevel Doubly Linked List Medium Linked List; Depth-First Search; Doubly-Linked List C++
434. Number of Segments in a String Easy String Rust
438. Find All Anagrams in a String Medium Hash Table; String; Sliding Window JavaScript
441. Arranging Coins Easy Math; Binary Search C
442. Find All Duplicates in an Array Medium Array; Hash Table Rust
448. Find All Numbers Disappeared in an Array Easy Array; Hash Table Go
450. Delete Node in a BST Medium Tree; Binary Search Tree; Binary Tree C++
455. Assign Cookies Easy Array; Greedy; Sorting Go
458. Poor Pigs Hard Math; Dynamic Programming; Combinatorics C++
461. Hamming Distance Easy Bit Manipulation C++
463. Island Perimeter Easy Array; Depth-First Search; Breadth-First Search; Matrix C++
468. Validate IP Address Medium String C++
470. Implement Rand10() Using Rand7() Medium Math; Rejection Sampling; Randomized; Probability and Statistics JavaScript
476. Number Complement Easy Bit Manipulation C++
482. License Key Formatting Easy String Ruby
485. Max Consecutive Ones Easy Array Go
492. Construct the Rectangle Easy Math Go
495. Teemo Attacking Easy Array; Simulation C++
500. Keyboard Row Easy Array; Hash Table; String JavaScript
504. Base 7 Easy Math Go
506. Relative Ranks Easy Array; Sorting; Heap (Priority Queue) Rust
507. Perfect Number Easy Math Go
509. Fibonacci Number Easy Math; Dynamic Programming; Recursion; Memorization JavaScript
511. Game Play Analysis I Easy Database MySQL
520. Detect Capital Easy String Rust
521. Longest Uncommon Subsequence I Easy String C++
535. Encode and Decode TinyURL Medium Hash Table; String; Design; Hash Function C++
537. Complex Number Multiplication Medium Math; String; Simulation C
541. Reverse String II Easy Two Pointers; String Ruby
543. Diameter of Binary Tree Easy Tree; Depth-First Search; Binary Tree JavaScript
554. Brick Wall Medium Array; Hash Table C++
557. Reverse Words in a String III Easy Two Pointers; String C / C++
561. Array Partition Easy Array; Greedy; Sorting; Counting Sort Rust
566. Reshape the Matrix Easy Array; Matrix; Simulation C++
575. Distribute Candies Easy Array; Hash Table Ruby
584. Find Customer Referee Easy Database MySQL
586. Customer Placing the Largest Number of Orders Easy Database MySQL
594. Longest Harmonious Subsequence Easy Array; Hash Table; Sorting Ruby
595. Big Countries Easy Database MySQL
596. Classes More Than 5 Students Easy Database MySQL
598. Range Addition II Easy Array; Math Go
599. Minimum Index Sum of Two Lists Easy Array; Hash Table; String Ruby
601. Human Traffic of Stadium Hard Database MySQL
605. Can Place Flowers Easy Array; Greedy C++
607. Sales Person Easy Database MySQL
608. Tree Node Medium Database MySQL
609. Find Duplicate File in System Medium Array; Hash Table; String Rust
617. Merge Two Binary Trees Easy Tree; Depth-First Search; Breadth-First Search; Binary Tree C++
620. Not Boring Movies Easy Database MySQL
626. Exchange Seats Medium Database MySQL
627. Swap Salary Easy Database MySQL
628. Maximum Product of Three Numbers Easy Array; Math; Sorting Go
643. Maximum Average Subarray I Easy Array; Sliding Window Ruby
645. Set Mismatch Easy Array; Hash Table; Bit Manipulation; Sorting C++
647. Palindromic Substrings Medium String; Dynamic Programming JavaScript
657. Robot Return to Origin Easy String; Simulation Rust
665. Non-decreasing Array Medium Array C++
680. Valid Palindrome II Easy Two Pointers; String; Greedy C
682. Baseball Game Easy Array; Stack; Simulation Rust
690. Employee Importance Medium Hash Table; Depth-First Search; Breadth-First Search Ruby
693. Binary Number with Alternating Bits Easy Bit Manipulation C++
695. Max Area of Island Medium Array; Depth-First Search; Breadth-First Search; Union Find; Matrix Rust
697. Degree of an Array Easy Array; Hash Table Ruby
700. Search in a Binary Search Tree Easy Tree; Binary Search Tree; Binary Tree C
703. Kth Largest Element in a Stream Easy Tree; Design; Binary Search Tree; Heap (Priority Queue); Binary Tree; Data Stream Rust
704. Binary Search Easy Array; Binary Search C
705. Design HashSet Easy Array; Hash Table; Linked List; Design; Hash Function Go
706. Design HashMap Easy Array; Hash Table; Linked List; Design; Hash Function C++
707. Design Linked List Medium Linked List; Design C++
709. To Lower Case Easy String C
717. 1-bit and 2-bit Characters Easy Array C++
724. Find Pivot Index Easy Array; Prefix Sum C++
728. Self Dividing Numbers Easy Math JavaScript
739. Daily Temperatures Medium Array; Stack; Monotonic Stack C++ / JavaScript
740. Delete and Earn Medium Array; Hash Table; Dynamic Programming JavaScript
744. Find Smallest Letter Greater Than Target Easy Array; Binary Search Ruby
746. Min Cost Climbing Stairs Easy Array; Dynamic Programming JavaScript
747. Largest Number At Least Twice of Others Easy Array; Sorting Ruby
748. Shortest Completing Word Easy Array; Hash Table; String Ruby
762. Prime Number of Set Bits in Binary Representation Easy Math; Bit Manipulation C++
763. Partition Labels Medium Hash Table; Two Pointers; String; Greedy C
771. Jewels and Stones Easy Hash Table; String C
784. Letter Case Permutation Medium String; Backtracking; Bit Manipulation Rust
796. Rotate String Easy String; String Matching C
797. All Paths From Source to Target Medium Backtracking; Depth-First Search; Breadth-First Search; Graph Rust
804. Unique Morse Code Words Easy Array; Hash Table; String C++
806. Number of Lines To Write String Easy Array; String Rust
807. Max Increase to Keep City Skyline Medium Array; Greedy; Matrix Rust
810. Chalkboard XOR Game Hard Array; Math; Bit Manipulation; Brainteaser; Game Theory C++
811. Subdomain Visit Count Medium Array; Hash Table; String; Counting JavaScript
812. Largest Triangle Area Easy Array; Math; Geometry Ruby
817. Linked List Components Medium Hash Table; Linked List C++
819. Most Common Word Easy Hash Table; String; Counting Ruby
821. Shortest Distance to a Character Easy Array; Two Pointers; String Rust
824. Goat Latin Easy String Rust
830. Positions of Large Groups Easy String C++
832. Flipping an Image Easy Array; Two Pointers; Matrix; Simulation Go
836. Rectangle Overlap Easy Math; Geometry C++
841. Keys and Rooms Medium Depth-First Search; Breadth-First Search; Graph Rust
844. Backspace String Compare Easy Two Pointers; String; Stack; Simulation Rust
852. Peak Index in a Mountain Array Easy Array; Binary Search C++
858. Mirror Reflection Medium Math; Geometry Rust
859. Buddy Strings Easy Hash Table; String Ruby
860. Lemonade Change Easy Array; Greedy C++
861. Score After Flipping Matrix Medium Array; Greedy; Bit Manipulation; Matrix C++
867. Transpose Matrix Easy Array; Matrix; Simulation C++
868. Binary Gap Easy Bit Manipulation Ruby
876. Middle of the Linked List Easy Linked List; Two Pointers C / C++
877. Stone Game Medium Array; Math; Dynamic Programming; Game Theory C
883. Projection Area of 3D Shapes Easy Array; Math; Geometry; Matrix JavaScript
884. Uncommon Words from Two Sentences Easy Hash Table; String Rust
885. Spiral Matrix III Medium Array; Matrix; Simulation Rust
888. Fair Candy Swap Easy Array; Hash Table; Binary Search; Sorting Rust
890. Find and Replace Pattern Medium Array; Hash Table; String C
896. Monotonic Array Easy Array Ruby
901. Online Stock Span Medium Stack; Design; Monotonic Stack; Data Stream JavaScript
905. Sort Array By Parity Easy Array; Two Pointers; Sorting Rust
908. Smallest Range I Easy Array; Math C++
914. X of a Kind in a Deck of Cards Easy Array; Hash Table; Math; Counting; Number Theory Go
917. Reverse Only Letters Easy Two Pointers; String Ruby
921. Minimum Add to Make Parentheses Valid Medium String; Stack; Greedy Rust
922. Sort Array By Parity II Easy Array; Two Pointers; Sorting C
925. Long Pressed Name Easy Two Pointers; String Rust
929. Unique Email Addresses Easy Array; Hash Table; String C
933. Number of Recent Calls Easy Design; Queue; Data Stream JavaScript
937. Reorder Data in Log Files Easy Array; String; Sorting JavaScript
938. Range Sum of BST Easy Tree; Depth-First Search; Binary Search Tree; Binary Tree C
941. Valid Mountain Array Easy Array C++
942. DI String Match Easy Array; Math; Two Pointers; String; Greedy C
950. Reveal Cards In Increasing Order Medium Array; Queue; Sorting; Simulation Rust
961. N-Repeated Element in Size 2N Array Easy Array; Hash Table C++
965. Univalued Binary Tree Easy Tree; Depth-First Search; Breadth-First Search; Binary Tree C++
976. Largest Perimeter Triangle Easy Array; Math; Greedy; Sorting Go
977. Squares of a Sorted Array Easy Array; Two Pointers; Sorting C++
980. Unique Paths III Hard Array; Backtracking; Bit Manipulation; Matrix Rust
985. Sum of Even Numbers After Queries Medium Array; Simulation Rust
986. Interval List Intersections Medium Array; Two Pointers Rust
989. Add to Array-Form of Integer Easy Array; Math Go
997. Find the Town Judge Easy Array; Hash Table; Graph Ruby
1002. Find Common Characters Easy Array; Hash Table; String Rust
1005. Maximize Sum Of Array After K Negations Easy Array; Greedy; Sorting C++
1006. Clumsy Factorial Medium Math; Stack; Simulation C
1009. Complement of Base 10 Integer Easy Bit Manupulation C++
1010. Pairs of Songs With Total Durations Divisible by 60 Medium Array; Hash Table; Counting C++
1013. Partition Array Into Three Parts With Equal Sum Easy Array; Greedy Rust
1017. Convert to Base -2 Medium Math C++
1018. Binary Prefix Divisible By 5 Easy Array C++
1020. Number of Enclaves Medium Array; Depth-First Search; Breadth-First Search; Union Find; Matrix Rust
1021. Remove Outermost Parentheses Easy String; Stack C++
1022. Sum of Root To Leaf Binary Numbers Easy Tree; Depth-First Search; Binary Tree C++
1025. Divisor Game Easy Math; Dynamic Programming; Brainteaser; Game Theory C
1033. Moving Stones Until Consecutive Medium Math; Brainteaser Rust
1037. Valid Boomerang Easy Math; Geometry C
1046. Last Stone Weight Easy Array; Heap (Priority Queue) Rust
1047. Remove All Adjacent Duplicates In String Easy String; Stack C
1050. Actors and Directors Who Cooperated At Least Three Times Easy Database MySQL
1051. Height Checker Easy Array; Sorting; Counting Sort C
1071. Greatest Common Divisor of Strings Easy Math; String C
1078. Occurrences After Bigram Easy String Rust
1079. Letter Tile Possibilities Medium String; Backtracking C++
1084. Sales Analysis III Easy Database MySQL
1103. Distribute Candies to People Easy Math; Simulation Go
1108. Defanging an IP Address Easy String C
1109. Corporate Flight Bookings Medium Array; Prefix Sum C++
1111. Maximum Nesting Depth of Two Valid Parentheses Strings Medium String; Stack Rust
1114. Print in Order Easy Concurrency Java
1115. Print FooBar Alternately Medium Concurrency Java
1116. Print Zero Even Odd Medium Concurrency Java
1122. Relative Sort Array Easy Array; Hash Table; Sorting; Counting Sort Rust
1128. Number of Equivalent Domino Pairs Easy Array; Hash Table; Counting Rust
1137. N-th Tribonacci Number Easy Math; Dynamic Programming; Memorization Go
1141. User Activity for the Past 30 Days I Easy Database MySQL
1148. Article Views I Easy Database MySQL
1154. Day of the Year Easy Math; String C
1158. Market Analysis I Medium Database MySQL
1160. Find Words That Can Be Formed by Characters Easy Array; Hash Table; String C++
1175. Prime Arrangements Easy Math C++
1179. Reformat Department Table Easy Database MySQL
1184. Distance Between Bus Stops Easy Array Rust
1185. Day of the Week Easy Math Go
1189. Maximum Number of Balloons Easy Hash Table; String; Counting C++
1195. Fizz Buzz Multithreaded Medium Concurrency Java / C++
1200. Minimum Absolute Difference Easy Array; Sorting Rust
1207. Unique Number of Occurrences Easy Array; Hash Table C++
1217. Minimum Cost to Move Chips to The Same Position Easy Array; Math; Greedy Go
1221. Split a String in Balanced Strings Easy String; Greedy; Counting C
1222. Queens That Can Attack the King Medium Array; Matrix; Simulation Rust
1226. The Dining Philosophers Medium Concurrency Java
1227. Airplane Seat Assignment Probability Medium Math; Dynamic Programming; Brainteaser; Probability and Statistics Rust
1232. Check If It Is a Straight Line Easy Array; Math; Geometry C
1238. Circular Permutation in Binary Representation Medium Math; Backtracking; Manipulation C
1252. Cells with Odd Values in a Matrix Easy Array; Math; Simulation Rust
1254. Number of Closed Islands Medium Array; Depth-First Search; Breadth-First Search; Union Find; Matrix Rust
1266. Minimum Time Visiting All Points Easy Array; Math; Geometry Rust
1277. Count Square Submatrices with All Ones Medium Array; Dynamic Programming; Matrix Rust
1281. Subtract the Product and Sum of Digits of an Integer Easy Math C
1282. Group the People Given the Group Size They Belong To Medium Array; Hash Table Rust
1290. Convert Binary Number in a Linked List to Integer Easy Linked List; Math C
1295. Find Numbers with Even Number of Digits Easy Array C
1299. Replace Elements with Greatest Element on Right Side Easy Array Rust
1302. Deepest Leaves Sum Medium Tree; Depth-First Search; Breadth-First Search; Binary Tree C++
1304. Find N Unique Integers Sum up to Zero Easy Array; Math C
1309. Decrypt String from Alphabet to Integer Mapping Easy String C
1310. XOR Queries of a Subarray Medium Array; Bit Manipulation; Prefix Sum Rust
1313. Decompress Run-Length Encoded List Easy Array C
1314. Matrix Block Sum Medium Array; Matrix; Prefix Sum Rust
1318. Minimum Flips to Make a OR b Equal to c Medium Bit Manipulation Rust
1319. Number of Operations to Make Network Connected Medium Depth-First Search; Breadth-First Search; Union Find; Graph C++
1323. Maximum 69 Number Easy Math; Greedy C
1329. Sort the Matrix Diagonally Medium Array; Sorting; Matrix C++
1331. Rank Transform of an Array Easy Array; Hash Table; Sorting C++
1332. Remove Palindromic Subsequences Easy Two Pointers; String Rust
1337. The K Weakest Rows in a Matrix Easy Array; Binary Search; Sorting; Heap (Priority Queue); Matrix C++
1342. Number of Steps to Reduce a Number to Zero Easy Math; Bit Manipulation C
1344. Angle Between Hands of a Clock Medium Math C
1347. Minimum Number of Steps to Make Two Strings Anagram Medium Hash Table; String; Counting Rust
1351. Count Negative Numbers in a Sorted Matrix Easy Array; Binary Search; Matrix Rust
1356. Sort Integers by The Number of 1 Bits Easy Array; Bit Manipulation; Sorting; Counting Rust
1360. Number of Days Between Two Dates Easy Math; String Go
1362. Closest Divisors Medium Math C++
1365. How Many Numbers Are Smaller Than the Current Number Easy Array; Hash Table; Sorting; Counting C++
1370. Increasing Decreasing String Easy Hash Table; String; Counting Rust
1374. Generate a String With Characters That Have Odd Counts Easy String C
1379. Find a Corresponding Node of a Binary Tree in a Clone of That Tree Easy Tree; Depth-First Search; Breadth-First Search; Binary Tree C++
1381. Design a Stack With Increment Operation Medium Array; Stack; Design C++
1389. Create Target Array in the Given Order Easy Array; Simulation C++
1393. Capital Gain/Loss Medium Database MySQL
1394. Find Lucky Integer in an Array Easy Array; Hash Table; Counting Rust
1395. Count Number of Teams Medium Array; Dynamic Programming; Binary Indexed Tree C
1396. Design Underground System Medium Hash Table; String; Design JavaScript
1399. Count Largest Group Easy Hash Table; Math Rust
1403. Minimum Subsequence in Non-Increasing Order Easy Array; Greedy; Sorting Rust
1407. Top Travellers Easy Database MySQL
1402. Reducing Dishes Hard Array; Dynamic Programming; Greedy; Sorting Rust
1413. Minimum Value to Get Positive Step by Step Sum Easy Array; Prefix Sum Rust
1418. Display Table of Food Orders in a Restaurant Medium Array; Hash Table; String; Sorting; Ordered Set Rust
1431. Kids With the Greatest Number of Candies Easy Array C
1436. Destination City Easy Hash Table; String Rust
1447. Simplified Fractions Medium Math C++
1450. Number of Students Doing Homework at a Given Time Easy Array C
1455. Check If a Word Occurs As a Prefix of Any Word in a Sentence Easy String; String Matching Rust
1460. Make Two Arrays Equal by Reversing Subarrays Easy Array; Hash Table; Sorting Rust
1464. Maximum Product of Two Elements in an Array Easy Array; Sorting; Heap (Priority Queue) C
1470. Shuffle the Array Easy Array C
1472. Design Browser History Medium Array; Linked List; Stack; Design; Doubly-Linked List; Data Stream JavaScript
1475. Final Prices With a Special Discount in a Shop Easy Array; Stack; Monotonic Stack Rust
1476. Subrectangle Queries Medium Array; Design; Matrix C++
1480. Running Sum of 1d Array Easy Array; Prefix Sum C
1484. Group Sold Products By The Date Easy Database MySQL
1486. XOR Operation in an Array Easy Math; Bit Manipulation C
1492. The kth Factor of n Medium Math C
1502. Can Make Arithmetic Progression From Sequence Easy Array; Sorting Rust
1503. Last Moment Before All Ants Fall Out of a Plank Medium Array; Brainteaser; Simulation Rust
1512. Number of Good Pairs Easy Array; Hash Table; Math; Counting C++
1518. Water Bottles Easy Math; Simulation Go
1523. Count Odd Numbers in an Interval Range Easy Math C
1527. Patients With a Condition Easy Database MySQL
1528. Shuffle String Easy Array; String C
1529. Minimum Suffix Flips Medium String; Greedy Rust
1550. Three Consecutive Odds Easy Array C
1551. Minimum Operations to Make Array Equal Medium Math C
1557. Minimum Number of Vertices to Reach All Nodes Medium Graph Rust
1561. Maximum Number of Coins You Can Get Medium Array; Math; Greedy; Sorting; Game Theory Rust
1566. Detect Pattern of Length M Repeated K or More Times Easy Array; Enumeration C++
1572. Matrix Diagonal Sum Easy Array; Matrix Rust
1576. Replace All ?'s to Avoid Consecutive Repeating Characters Easy String C
1581. Customer Who Visited but Did Not Make Any Transactions Easy Database MySQL
1587. Bank Account Summary II Easy Database MySQL
1588. Sum of All Odd Length Subarrays Easy Array; Math; Prefix Sum C
1598. Crawler Log Folder Easy Array; String; Stack Rust
1603. Design Parking System Easy Design; Simulation; Counting C++
1605. Find Valid Matrix Given Row and Column Sums Medium Array; Greedy; Matrix Rust
1608. Special Array With X Elements Greater Than or Equal X Easy Array; Binary Search; Sorting C++
1614. Maximum Nesting Depth of the Parentheses Easy String; Stack C++
1637. Widest Vertical Area Between Two Points Containing No Points Medium Array; Sorting C++
1641. Count Sorted Vowel Strings Medium Dynamic Programming C
1646. Get Maximum in Generated Array Easy Array; Dynamic Programming; Simulation C++
1656. Design an Ordered Stream Easy Array; Hash Table; Design; Data Stream C++
1662. Check If Two String Arrays are Equivalent Easy Array; String C++
1667. Fix Names in a Table Easy Database MySQL
1668. Maximum Repeating Substring Easy String; String Matching C++
1669. Merge In Between Linked Lists Medium Linked List C
1672. Richest Customer Wealth Easy Array; Matrix C++
1678. Goal Parser Interpretation Easy String C++
1680. Concatenation of Consecutive Binary Numbers Medium Math; Bit Manipulation; Simulation C++
1684. Count the Number of Consistent Strings Easy Array; Hash Table; String; Bit Manipulation C++
1688. Count of Matches in Tournament Easy Math; Simulation C++
1689. Partitioning Into Minimum Number Of Deci-Binary Numbers Medium String; Greedy C++
1693. Daily Leads and Partners Easy Database MySQL
1694. Reformat Phone Number Easy String C++
1700. Number of Students Unable to Eat Lunch Easy Array; Stack; Queue; Simulation C++
1704. Determine if String Halves Are Alike Easy String; Counting C++
1706. Where Will the Ball Fall Medium Array; Dynamic Programming; Depth-First Search; Matrix; Simulation Go
1710. Maximum Units on a Truck Easy Array; Greedy; Sorting C++
1716. Calculate Money in Leetcode Bank Easy Math C++
1720. Decode XORed Array Easy Array; Bit Manipulation C++
1721. Swapping Nodes in a Linked List Medium Linked List; Two Pointers C++
1725. Number Of Rectangles That Can Form The Largest Square Easy Array C++
1726. Tuple with Same Product Medium Array; Hash Table C++
1729. Find Followers Count Easy Database MySQL
1732. Find the Highest Altitude Easy Array; Prefix Sum C++
1736. Latest Time by Replacing Hidden Digits Easy String; Greedy C++
1741. Find Total Time Spent by Each Employee Easy Database MySQL
1742. Maximum Number of Balls in a Box Easy Hash Table; Math; Counting C++
1748. Sum of Unique Elements Easy Array; Hash Table; Counting C++
1752. Check if Array Is Sorted and Rotated Easy Array C++
1757. Recyclable and Low Fat Products Easy Database MySQL
1758. Minimum Changes To Make Alternating Binary String Easy String C++
1768. Merge Strings Alternately Easy Two Pointers; String C++
1769. Minimum Number of Operations to Move All Balls to Each Box Medium Array; String Rust
1773. Count Items Matching a Rule Easy Array; String C++
1779. Find Nearest Point That Has the Same X or Y Coordinate Easy Array C++
1784. Check if Binary String Has at Most One Segment of Ones Easy String C++
1790. Check if One String Swap Can Make Strings Equal Easy Hash Table; String; Counting C++
1791. Find Center of Star Graph Easy Graph Rust
1795. Rearrange Products Table Easy Database MySQL
1796. Second Largest Digit in a String Easy Hash Table; String C++
1797. Design Authentication Manager Medium Hash Table; Design JavaScript
1800. Maximum Ascending Subarray Sum Easy Array C++
1807. Evaluate the Bracket Pairs of a String Medium Array; Hash Table; String Rust
1812. Determine Color of a Chessboard Square Easy Math; String C++
1816. Truncate Sentence Easy Array; String Rust
1817. Finding the Users Active Minutes Medium Array; Hash Table Rust
1822. Sign of the Product of an Array Easy Array; Math C++
1823. Find the Winner of the Circular Game Medium Array; Math; Recursion; Queue; Simulation Rust
1827. Minimum Operations to Make the Array Increasing Easy Array; Greedy Rust
1828. Queries on Number of Points Inside a Circle Medium Array; Math; Geometry C++
1829. Maximum XOR for Each Query Medium Array; Bit Manipulation; Prefix Sum Rust
1832. Check if the Sentence Is Pangram Easy Hash Table; String Rust
1837. Sum of Digits in Base K Easy Math C++
1844. Replace All Digits with Characters Easy String C++
1845. Seat Reservation Manager Medium Design; Heap (Priority Queue) JavaScript
1848. Minimum Distance to the Target Element Easy Array C++
1859. Sorting the Sentence Easy String; Sorting Rust
1860. Incremental Memory Leak Medium Simulation Rust
1863. Sum of All Subset XOR Totals Easy Array; Math; Backtracking; Bit Manipulation; Combinatorics Go
1869. Longer Contiguous Segments of Ones than Zeros Easy String C++
1873. Calculate Special Bonus Easy Database MySQL
1876. Substrings of Size Three with Distinct Characters Easy Hash Table; String; Sliding Window; Counting C++
1877. Minimize Maximum Pair Sum in Array Medium Array; Two Pointers; Greedy; Sorting Rust
1880. Check if Word Equals Summation of Two Words Easy String C++
1890. The Latest Login in 2020 Easy Database MySQL
1893. Check if All the Integers in a Range Are Covered Easy Array; Hash Table; Prefix Sum C++
1897. Redistribute Characters to Make All Strings Equal Easy Hash Table; String; Counting C++
1903. Largest Odd Number in String Easy Math; String; Greedy C++
1905. Count Sub Islands Medium Array; Depth-First Search; Breadth-First Search; Union Find; Matrix Rust
1909. Remove One Element to Make the Array Strictly Increasing Easy Array C++
1910. Remove All Occurrences of a Substring Medium String Rust
1913. Maximum Product Difference Between Two Pairs Easy Array; Sorting C++
1920. Build Array from Permutation Easy Array; Simulation C++
1925. Count Square Sum Triples Easy Math; Enumeration Go
1929. Concatenation of Array Easy Array C++
1935. Maximum Number of Words You Can Type Easy Hash Table; String C++
1941. Check if All Characters Have Equal Number of Occurrences Easy Hash Table; String; Counting C++
1945. Sum of Digits of String After Convert Easy String; Simulation C++
1952. Three Divisors Easy Math C++
1957. Delete Characters to Make Fancy String Easy String C++
1961. Check If String Is a Prefix of Array Easy Array; String C++
1965. Employees With Missing Information Easy Database MySQL
1967. Number of Strings That Appear as Substrings in Word Easy String C++
1971. Find if Path Exists in Graph Easy Depth-First Search; Breadth-First Search; Graph C++
1974. Minimum Time to Type Word Using Special Typewriter Easy String; Greedy C++
1979. Find Greatest Common Divisor of Array Easy Array; Math C++
1984. Minimum Difference Between Highest and Lowest of K Scores Easy Array; Sliding Window; Sorting C++
1991. Find the Middle Index in Array Easy Array; Prefix Sum C++
2000. Reverse Prefix of Word Easy Two Pointers; String C++
2001. Number of Pairs of Interchangeable Rectangles Medium Array; Hash Table; Math; Counting; Number Theory Ruby
2006. Count Number of Pairs With Absolute Difference K Easy Array; Hash Table; Counting C++
2011. Final Value of Variable After Performing Operations Easy Array; String; Simulation C++
2016. Maximum Difference Between Increasing Elements Easy Array C++
2022. Convert 1D Array Into 2D Array Easy Array; Matrix; Simulation C++
2023. Number of Pairs of Strings With Concatenation Equal to Target Medium Array; String Rust
2027. Minimum Moves to Convert String Easy String; Greedy C++
2032. Two Out of Three Easy Array; Hash Table C++
2037. Minimum Number of Moves to Seat Everyone Easy Array; Sorting C++
2042. Check if Numbers Are Ascending in a Sentence Easy String JavaScript
2043. Simple Bank System Medium Array; Hash Table; Design; Simulation JavaScript
2044. Count Number of Maximum Bitwise-OR Subsets Medium Array; Backtracking; Bit Manipulation Rust
2053. Kth Distinct String in an Array Easy Array; Hash Table; String; Counting JavaScript
2057. Smallest Index With Equal Value Easy Array JavaScript
2068. Check Whether Two Strings are Almost Equivalent Easy Hash Table; String; Counting JavaScript
2073. Time Needed to Buy Tickets Easy Array; Queue; Simulation JavaScript
2078. Two Furthest Houses With Different Colors Easy Array; Greedy JavaScript
2079. Watering Plants Medium Array Rust
2085. Count Common Words With One Occurrence Easy Array; Hash Table; String; Counting JavaScript
2089. Find Target Indices After Sorting Array Easy Array; Binary Search; Sorting JavaScript
2103. Rings and Rods Easy Hash Table; String Go
2108. Find First Palindromic String in the Array Easy Array; Two Pointers; String Go
2114. Maximum Number of Words Found in Sentences Easy Array; String Go
2119. A Number After a Double Reversal Easy Math Go
2124. Check if All A's Appears Before All B's Easy String Go
2125. Number of Laser Beams in a Bank Medium Array; Math; String; Matrix Rust
2129. Capitalize the Title Easy String JavaScript
2130. Maximum Twin Sum of a Linked List Medium Linked List; Two Pointers; Stack C++
2136. Earliest Possible Day of Full Bloom Hard Array; Greedy; Sorting Rust
2138. Divide a String Into Groups of Size k Easy String; Simulation Go
2144. Minimum Cost of Buying Candies With Discount Easy Array; Greedy; Sorting Go
2148. Count Elements With Strictly Smaller and Greater Elements Easy Array; Sorting Go
2149. Rearrange Array Elements by Sign Medium Array; Two Pointers; Simulation Go
2154. Keep Multiplying Found Values by Two Easy Array; Hash Table; Sorting; Simulation Go
2160. Minimum Sum of Four Digit Number After Splitting Digits Easy Math; Greedy; Sorting Go
2161. Partition Array According to Given Pivot Medium Array; Two Pointers; Simulation Rust
2164. Sort Even and Odd Indices Independently Easy Array; Sorting Rust
2166. Design Bitset Medium Array; Hash Table; Design C++
2169. Count Operations to Obtain Zero Easy Math; Simulation Go
2181. Merge Nodes in Between Zeros Medium Linked List; Simulation Go
2185. Counting Words With a Given Prefix Easy Array; String Go
2186. Minimum Number of Steps to Make Two Strings Anagram II Medium Hash Table; String; Counting Rust
2190. Most Frequent Number Following Key In an Array Easy Array; Hash Table; Counting Go
2194. Cells in a Range on an Excel Sheet Easy String Go
2200. Find All K-Distant Indices in an Array Easy Array Go
2206. Divide Array Into Equal Pairs Easy Array; Hash Table; Bit Manipulation; Counting Go
2220. Minimum Bit Flips to Convert Number Easy Bit Manipulation Go
2225. Find Players With Zero or One Losses Medium Array; Hash Table; Sorting; Counting C++
2235. Add Two Integers Easy Math Rust
2236. Root Equals Sum of Children Easy Tree; Binary Tree Rust
2241. Design an ATM Machine Medium Array; Greedy; Design Go
2243. Calculate Digit Sum of a String Easy String; Simulation Go
2244. Minimum Rounds to Complete All Tasks Medium Array; Hash Table; Greedy; Counting Go
2248. Intersection of Multiple Arrays Easy Array; Hash Table; Counting Go
2249. Count Lattice Points Inside a Circle Medium Array; Hash Table; Math; Geometry; Enumeration Go
2251. Number of Flowers in Full Bloom Hard Array; Hash Table; Binary Search; Sorting; Prefix Sum; Ordered Set C++
2255. Count Prefixes of a Given String Easy Array; String Go
2264. Largest 3-Same-Digit Number in String Easy String Go
2265. Count Nodes Equal to Average of Subtree Medium Tree; Depth-First Search; Binary Tree Go
2275. Largest Combination With Bitwise AND Greater Than Zero Medium Array; Hash Table; Bit Manipulation; Counting Rust
2278. Percentage of Letter in String Easy String C++
2283. Check if Number Has Equal Digit Count and Digit Value Easy Hash Table; String; Counting Go
2287. Rearrange Characters to Make Target String Easy Hash Table; String; Counting Go
2293. Min Max Game Easy Array; Simulation Go
2294. Partition Array Such That Maximum Difference Is K Medium Array; Greedy; Sorting Rust
2299. Strong Password Checker II Easy String C++
2303. Calculate Amount Paid in Taxes Easy Array; Simulation Go
2309. Greatest English Letter in Upper and Lower Case Easy Hash Table; String; Enumeration Go
2315. Count Asterisks Easy String Go
2317. Maximum XOR After Operations Medium Array; Math; Bit Manipulation Rust
2319. Check if Matrix Is X-Matrix Easy Array; Matrix Rust
2325. Decode the Message Easy Hash Table; String Go
2331. Evaluate Boolean Binary Tree Easy Binary Search; Tree; Depth-First Search Go
2335. Minimum Amount of Time to Fill Cups Easy Array; Greedy; Heap (Priority Queue) Go
2336. Smallest Number in Infinite Set Medium Hash Table; Design; Heap (Priority Queue) Rust
2341. Maximum Number of Pairs in Array Easy Array; Hash Table; Counting Go
2347. Best Poker Hand Easy Array; Hash Table; Counting Go
2351. First Letter to Appear Twice Easy Hash Table; String; Counting Go
2357. Make Array Zero by Subtracting Equal Amounts Easy Array; Hash Table; Sorting; Heap (Priority Queue); Simulation Go
2363. Merge Similar Items Easy Array; Hash Table; Sorting; Ordered Set Rust
2367. Number of Arithmetic Triplets Easy Array; Hash Table; Two Pointers; Enumeration Rust
2373. Largest Local Values in a Matrix Easy Array; Matrix Rust
2375. Construct Smallest Number From DI String Medium String; Backtracking; Stack; Greedy Rust
2391. Minimum Amount of Time to Collect Garbage Medium Array; String; Prefix Sum Rust
2395. Find Subarrays With Equal Sum Easy Array; Hash Table Rust
2396. Strictly Palindromic Number Medium Math; Two Pointers; Brainteaser Rust
2404. Most Frequent Even Element Easy Array; Hash Table; Counting Rust
2405. Optimal Partition of String Medium Hash Table; String; Greedy Rust
2413. Smallest Even Multiple Easy Math; Number Theory Rust
2418. Sort the People Easy Array; Hash Table; String; Sorting Rust
2425. Bitwise XOR of All Pairings Medium Array; Bit Manipulation; Brainteaser Rust
2428. Maximum Sum of an Hourglass Medium Array; Matrix; Prefix Sum Rust
2433. Find The Original Array of Prefix Xor Medium Array; Bit Manipulation Rust
2441. Largest Positive Integer That Exists With Its Negative Easy Array; Hash Table Rust
2442. Count Number of Distinct Integers After Reverse Operations Medium Array; Hash Table; Math Rust
2446. Determine if Two Events Have Conflict Easy Array; String Rust
2469. Convert the Temperature Easy Math Rust
2485. Find the Pivot Integer Easy Math; Prefix Sum Rust
2490. Circular Sentence Easy String Rust
2496. Maximum Value of a String in an Array Easy Array; String Ruby
2500. Delete Greatest Value in Each Row Easy Array; Sorting; Matrix Ruby
2506. Count Pairs Of Similar Strings Easy Array; Hash Table; String Rust
2520. Count the Digits That Divide a Number Easy Math Rust
2525. Categorize Box According to Criteria Easy Math Rust
2529. Maximum Count of Positive Integer and Negative Integer Easy Array; Binary Search; Counting Ruby
2535. Difference Between Element Sum and Digit Sum of an Array Easy Array; Math Ruby
2544. Alternating Digit Sum Easy Math Rust
2545. Sort the Students by Their Kth Score Medium Array; Sorting; Matrix Rust
2549. Count Distinct Numbers on Board Easy Array; Hash Table; Math; Simulation Rust

License

All solutions are licensed under the MIT License.

About

My LeetCode solutions.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project