Skip to content
Craig's Leetcode Solutions
About
Initializing search
GitHub
Craig's Leetcode Solutions
GitHub
Home
About
Problems
Problems
1. Two Sum
2. Add Two Numbers
3. Longest Substring Without Repeating Characters
4. Median of Two Sorted Arrays
5. Longest Palindromic Substring
6. ZigZag Conversion
7. Reverse Integer
8. String to Integer (atoi)
9. Palindrome Number
11. Container With Most Water
12. Integer to Roman
13. Roman to Integer
14. Longest Common Prefix
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
21. Merge Two Sorted Lists
22. Generate Parentheses
23. Merge k Sorted Lists
24. Swap Nodes in Pairs
26. Remove Duplicates from Sorted Array
27. Remove Element
28. Find the Index of the First Occurrence in a String
31. Next Permutation
33. Search in Rotated Sorted Array
34. Find First and Last Position of Element in Sorted Array
35. Search Insert Position
36. Valid Sudoku
38. Count and Say
39. Combination Sum
40. Combination Sum II
41. First Missing Positive
43. Multiply Strings
46. Permutations
48. Rotate Image
49. Group Anagrams
50. Pow(x, n)
53. Maximum Subarray
54. Spiral Matrix
55. Jump Game
56. Merge Intervals
57. Insert Interval
58. Length of Last Word
59. Spiral Matrix II
61. Rotate List
62. Unique Paths
63. Unique Paths II
64. Minimum Path Sum
66. Plus One
67. Add Binary
69. Sqrt(x)
70. Climbing Stairs
73. Set Matrix Zeroes
74. Search a 2D Matrix
75. Sort Colors
78. Subsets
79. Word Search
83. Remove Duplicates from Sorted List
86. Partition List
88. Merge Sorted Array
92. Reverse Linked List II
94. Binary Tree Inorder Traversal
98. Validate Binary Search Tree
100. Same Tree
101. Symmetric Tree
102. Binary Tree Level Order Traversal
103. Binary Tree Zigzag Level Order Traversal
104. Maximum Depth of Binary Tree
105. Construct Binary Tree from Preorder and Inorder Traversal
107. Binary Tree Level Order Traversal II
108. Convert Sorted Array to Binary Search Tree
110. Balanced Binary Tree
111. Minimum Depth of Binary Tree
112. Path Sum
118. Pascal's Triangle
119. Pascal's Triangle II
121. Best Time to Buy and Sell Stock
122. Best Time to Buy and Sell Stock II
125. Valid Palindrome
128. Longest Consecutive Sequence
136. Single Number
139 word break
141. Linked List Cycle
142. Linked List Cycle II
143. Reorder List
144. Binary Tree Preorder Traversal
145. Binary Tree Postorder Traversal
146. LRU Cache
152. Maximum Product Subarray
153. Find Minimum in Rotated Sorted Array
155. Min Stack
160. Intersection of Two Linked Lists
165. Compare Version Numbers
167. Two Sum II - Input array is sorted
168. Excel Sheet Column Title
169. Majority Element
171. Excel Sheet Column Number
172. Factorial Trailing Zeroes
173. Binary Search Tree Iterator
190. Reverse Bits
191. Number of 1 Bits
198. House Robber
200. Number of Islands
202. Happy Number
203. Remove Linked List Elements
204. Count Primes
205. Isomorphic Strings
206. Reverse Linked List
208. Implement Trie (Prefix Tree)
211. Design Add and Search Words Data Structure
213. House Robber II
217. Contains Duplicate
219. Contains Duplicate II
225. Implement Stack using Queues
226. Invert Binary Tree
228. Summary Ranges
230. Kth Smallest Element in a BST
231. Power of Two
232 implement queue using stacks
234. Palindrome Linked List
235. Lowest Common Ancestor of a Binary Search Tree
237. Delete Node in a Linked List
238. Product of Array Except Self
242. Valid Anagram
257. Binary Tree Paths
263. Ugly Number
268. Missing Number
278. First Bad Version
283. Move Zeroes
290. Word Pattern
292. Nim Game
295. Find Median from Data Stream
299. Bulls and Cows
300. Longest Increasing Subsequence
303. Range Sum Query - Immutable
326. Power of Three
338. Counting Bits
342. Power of Four
344. Reverse String
345. Reverse Vowels of a String
347. Top K Frequent Elements
349. Intersection of Two Arrays
350. Intersection of Two Arrays II
367. Valid Perfect Square
374. Guess Number Higher or Lower
383. Ransom Note
387. First Unique Character in a String
389. Find the Difference
392. Is Subsequence
394. Decode String
404. Sum of Left Leaves
405. Convert a Number to Hexadecimal
409. Longest Palindrome
412. Fizz Buzz
414. Third Maximum Number
415. Add Strings
424. Longest Repeating Character Replacement
434. Number of Segments in a String
438. Find All Anagrams in a String
441. Arranging Coins
443. String Compression
448. Find All Numbers Disappeared in an Array
455. Assign Cookies
459. Repeated Substring Pattern
461. Hamming Distance
463. Island Perimeter
476. Number Complement
482. License Key Formatting
485. Max Consecutive Ones
492. Construct the Rectangle
495. Teemo Attacking
496. Next Greater Element I
498. Diagonal Traverse
500. Keyboard Row
501. Find Mode in Binary Search Tree
504. Base 7
506. Relative Ranks
507. Perfect Number
509. Fibonacci Number
520. Detect Capital
521. Longest Uncommon Subsequence I
530. Minimum Absolute Difference in BST
541. Reverse String II
543. Diameter of Binary Tree
551. Student Attendance Record I
557. Reverse Words in a String III
559. Maximum Depth of N-ary Tree
561. Array Partition
563. Binary Tree Tilt
566. Reshape the Matrix
572. Subtree of Another Tree
575. Distribute Candies
589. N-ary Tree Preorder Traversal
590. N-ary Tree Postorder Traversal
594. Longest Harmonious Subsequence
599. Minimum Index Sum of Two Lists
605. Can Place Flowers
606. Construct String from Binary Tree
617. Merge Two Binary Trees
628. Maximum Product of Three Numbers
637. Average of Levels in Binary Tree
643. Maximum Average Subarray I
645. Set Mismatch
647. Palindromic Substrings
653. Two Sum IV - Input is a BST
671. Second Minimum Node In a Binary Tree
674. Longest Continuous Increasing Subsequence
680. Valid Palindrome II
682. Baseball Game
692. Top K Frequent Words
693. Binary Number with Alternating Bits
697. Degree of an Array
700. Search in a Binary Search Tree
703. Kth Largest Element in a Stream
704. Binary Search
705. Design HashSet
706. Design HashMap
709. To Lower Case
717. 1-bit and 2-bit Characters
724. Find Pivot Index
728. Self Dividing Numbers
733. Flood Fill
735. Asteroid Collision
744. Find Smallest Letter Greater Than Target
746. Min Cost Climbing Stairs
747. Largest Number At Least Twice of Others
748. Shortest Completing Word
762. Prime Number of Set Bits in Binary Representation
766. Toeplitz Matrix
771. Jewels and Stones
783. Minimum Distance Between BST Nodes
796. Rotate String
804. Unique Morse Code Words
806. Number of Lines To Write String
812. Largest Triangle Area
819. Most Common Word
821. Shortest Distance to a Character
824. Goat Latin
830. Positions of Large Groups
832. Flipping an Image
836. Rectangle Overlap
844. Backspace String Compare
859. Buddy Strings
860. Lemonade Change
867. Transpose Matrix
868. Binary Gap
872. Leaf-Similar Trees
874. Walking Robot Simulation
875. Koko Eating Bananas
876. Middle of the Linked List
883. Projection Area of 3D Shapes
884. Uncommon Words from Two Sentences
888. Fair Candy Swap
892. Surface Area of 3D Shapes
896. Monotonic Array
897. Increasing Order Search Tree
905. Sort Array By Parity
908. Smallest Range I
914. X of a Kind in a Deck of Cards
917. Reverse Only Letters
922. Sort Array By Parity II
925. Long Pressed Name
929. Unique Email Addresses
933. Number of Recent Calls
938. Range Sum of BST
941. Valid Mountain Array
942. DI String Match
944. Delete Columns to Make Sorted
961. N-Repeated Element in Size 2N Array
965. Univalued Binary Tree
976. Largest Perimeter Triangle
977. Squares of a Sorted Array
993. Cousins in Binary Tree
997. Find the Town Judge
1002. Find Common Characters
1005. Maximize Sum Of Array After K Negations
1009. Complement of Base 10 Integer
1013. Partition Array Into Three Parts With Equal Sum
1018. Binary Prefix Divisible By 5
1021. Remove Outermost Parentheses
1022. Sum of Root To Leaf Binary Numbers
1025. Divisor Game
1037. Valid Boomerang
1041. Robot Bounded In Circle
1046. Last Stone Weight
1047. Remove All Adjacent Duplicates In String
1051. Height Checker
1108. Defanging an IP Address
1122. Relative Sort Array
1137. N-th Tribonacci Number
1190. Reverse Substrings Between Each Pair of Parentheses
1200. Minimum Absolute Difference
1217. Minimum Cost to Move Chips to The Same Position
1275 find winner on a tic tac toe game
1283. Find the Smallest Divisor Given a Threshold
1309. Decrypt String from Alphabet to Integer Mapping
1331. Rank Transform of an Array
1332. Remove Palindromic Subsequences
1460. Make Two Arrays Equal by Reversing Subarrays
1480. Running Sum of 1d Array
1578. Minimum Time to Make Rope Colorful
1752. Check if Array Is Sorted and Rotated
1846. Maximum Element After Decreasing and Rearranging
1869. Longer Contiguous Segments of Ones than Zeros
1876. Substrings of Size Three with Distinct Characters
1909. Remove One Element to Make the Array Strictly Increasing
2296. Design a Text Editor
2710. Remove Trailing Zeros From a String
2716. Minimize String Length
2717. Semi-Ordered Permutation
2729. Check if The Number is Fascinating
2731. Movement of Robots
2733. Neither Minimum nor Maximum
2739. Total Distance Traveled
2744. Find Maximum Number of String Pairs
2748. Number of Beautiful Pairs
About
👋 My name is Craig Pastro. I'm a minimalist.