Skip to content
/ LeetCode Public

A collection of efficient C/C++ solutions for LeetCode problems.

Notifications You must be signed in to change notification settings

0xm4n/LeetCode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LeetCode

# Title Solution
1 Two Sum Solution
2 Add Two Numbers Solution
3 Longest Substring Without Repeating Characters Solution
5 Longest Palindromic Substring Solution
6 ZigZag Conversion Solution
7 Reverse Integer Solution
8 String to Integer (atoi) Solution
9 Palindrome Number Solution
11 Container With Most Water Solution
13 Roman to Integer Solution
14 Longest Common Prefix Solution
15 3Sum Solution
17 Letter Combinations of a Phone Number Solution
19 Remove Nth Node From End of List Solution
20 Valid Parentheses Solution
21 Merge Two Sorted Lists Solution
22 Generate Parentheses Solution
23 Merge k Sorted Lists Solution
25 Reverse Nodes in k-Group Solution
26 Remove Duplicates from Sorted Array Solution
27 Remove Element Solution
28 Implement strStr() Solution
29 Divide Two Integers Solution
32 Longest Valid Parentheses Solution
33 Search in Rotated Sorted Array Solution
34 Find First and Last Position of Element in Sorted Array Solution
37 Sudoku Solver Solution
39 Combination Sum Solution
40 Combination Sum II Solution
41 First Missing Positive Solution
42 Trapping Rain Water Solution
43 Multiply Strings Solution
45 Jump Game II Solution
46 Permutations Solution
47 Permutations II Solution
48 Rotate Image Solution
49 Group Anagrams Solution
50 Pow(x, n) Solution
51 N-Queens Solution
53 Maximum Subarray Solution
53 Maximum Subarray Solution
54 Spiral Matrix Solution
55 Jump Game Solution
56 Merge Intervals Solution
57 Insert Interval Solution
58 Length of Last Word Solution
59 Spiral Matrix II Solution
61 Rotate List Solution
62 Unique Paths Solution
63 Unique Paths II Solution
64 Minimum Path Sum Solution
66 Plus One Solution
67 Add Binary Solution
71 Simplify Path Solution
73 Set Matrix Zeroes Solution
74 Search a 2D Matrix Solution
75 Sort Colors Solution
76 Minimum Window Substring Solution
77 Combinations Solution
78 Subsets Solution
80 Remove Duplicates from Sorted Array II Solution
81 Search in Rotated Sorted Array II Solution
82 Remove Duplicates from Sorted List II Solution
83 Remove Duplicates from Sorted List Solution
84 Largest Rectangle in Histogram Solution
85 Maximal Rectangle Solution
86 Partition List Solution
88 Merge Sorted Array Solution
90 Subsets II Solution
92 Reverse Linked List II Solution
93 Restore IP Addresses Solution
94 Binary Tree Inorder Traversal Solution
95 Unique Binary Search Trees II Solution
96 Unique Binary Search Trees Solution
98 Validate Binary Search Tree Solution
100 Same Tree Solution
101 Symmetric Tree Solution
102 Binary Tree Level Order Traversal Solution
103 Binary Tree Zigzag Level Order Traversal Solution
104 Maximum Depth of Binary Tree Solution
105 Construct Binary Tree from Preorder and Inorder Traversal Solution
106 Construct Binary Tree from Inorder and Postorder Traversal Solution
107 Binary Tree Level Order Traversal II Solution
108 Convert Sorted Array to Binary Search Tree Solution
110 Balanced Binary Tree Solution
111 Minimum Depth of Binary Tree Solution
112 Path Sum Solution
113 Path Sum II Solution
114 Flatten Binary Tree to Linked List Solution
118 Pascal's Triangle Solution
119 Pascal's Triangle II Solution
121 Best Time to Buy and Sell Stock Solution
122 Best Time to Buy and Sell Stock II Solution
123 Best Time to Buy and Sell Stock III Solution
124 Binary Tree Maximum Path Sum Solution
125 Valid Palindrome Solution
128 Longest Consecutive Sequence Solution
131 Palindrome Partitioning Solution
134 Gas Station Solution
135 Candy Solution
139 Word Break Solution
141 Linked List Cycle Solution
142 Linked List Cycle II Solution
144 Binary Tree Preorder Traversal Solution
145 Binary Tree Postorder Traversal Solution
146 LRU Cache Solution
148 Sort List Solution
150 Evaluate Reverse Polish Notation Solution
151 Reverse Words in a String Solution
152 Maximum Product Subarray Solution
153 Find Minimum in Rotated Sorted Array Solution
154 Find Minimum in Rotated Sorted Array II Solution
160 Intersection of Two Linked Lists Solution
162 Find Peak Element Solution
167 Two Sum II - Input Array Is Sorted Solution
168 Excel Sheet Column Title Solution
171 Excel Sheet Column Number Solution
172 Factorial Trailing Zeroes Solution
173 Binary Search Tree Iterator Solution
179 Largest Number Solution
187 Repeated DNA Sequences Solution
188 Best Time to Buy and Sell Stock IV Solution
189 Rotate Array Solution
190 Reverse Bits Solution
191 Number of 1 Bits Solution
199 Binary Tree Right Side View Solution
200 Number of Islands Solution
202 Happy Number Solution
203 Remove Linked List Elements Solution
205 Isomorphic Strings Solution
206 Reverse Linked List Solution
207 Course Schedule Solution
208 Implement Trie (Prefix Tree) Solution
209 Minimum Size Subarray Sum Solution
211 Design Add and Search Words Data Structure Solution
214 Shortest Palindrome Solution
215 Kth Largest Element in an Array Solution
216 Combination Sum III Solution
217 Contains Duplicate Solution
219 Contains Duplicate II Solution
220 Contains Duplicate III Solution
221 Maximal Square Solution
222 Count Complete Tree Nodes Solution
224 Basic Calculator Solution
225 Implement Stack using Queues Solution
227 Basic Calculator II Solution
230 Kth Smallest Element in a BST Solution
231 Power of Two Solution
232 Implement Queue using Stacks Solution
234 Palindrome Linked List Solution
235 Lowest Common Ancestor of a Binary Search Tree Solution
236 Lowest Common Ancestor of a Binary Tree Solution
238 Product of Array Except Self Solution
239 Sliding Window Maximum Solution
242 Valid Anagram Solution
252 Meeting Rooms Solution
253 Meeting Rooms II Solution
254 Factor Combinations Solution
257 Binary Tree Paths Solution
258 Add Digits Solution
263 Ugly Number Solution
274 H-Index Solution
278 First Bad Version Solution
283 Move Zeroes Solution
285 Inorder Successor in BST Solution
287 Find the Duplicate Number Solution
289 Game of Life Solution
290 Word Pattern Solution
295 Find Median from Data Stream Solution
297 Serialize and Deserialize Binary Tree Solution
299 Bulls and Cows Solution
300 Longest Increasing Subsequence Solution
303 Range Sum Query - Immutable Solution
304 Range Sum Query 2D - Immutable Solution
319 Bulb Switcher Solution
324 Wiggle Sort II Solution
326 Power of Three Solution
328 Odd Even Linked List Solution
331 Verify Preorder Serialization of a Binary Tree Solution
334 Increasing Triplet Subsequence Solution
341 Flatten Nested List Iterator Solution
342 Power of Four Solution
344 Reverse String Solution
345 Reverse Vowels of a String Solution
347 Top K Frequent Elements Solution
349 Intersection of Two Arrays Solution
350 Intersection of Two Arrays II Solution
376 Wiggle Subsequence Solution
380 Insert Delete GetRandom O(1) Solution
383 Ransom Note Solution
385 Mini Parser Solution
387 First Unique Character in a String Solution
388 Longest Absolute File Path Solution
389 Find the Difference Solution
392 Is Subsequence Solution
394 Decode String Solution
395 Longest Substring with At Least K Repeating Characters Solution
396 Rotate Function Solution
405 Convert a Number to Hexadecimal Solution
406 Queue Reconstruction by Height Solution
412 Fizz Buzz Solution
414 Third Maximum Number Solution
415 Add Strings Solution
419 Battleships in a Board Solution
424 Longest Repeating Character Replacement Solution
429 N-ary Tree Level Order Traversal Solution
434 Number of Segments in a String Solution
438 Find All Anagrams in a String Solution
442 Find All Duplicates in an Array Solution
445 Add Two Numbers II Solution
448 Find All Numbers Disappeared in an Array Solution
449 Serialize and Deserialize BST Solution
451 Sort Characters By Frequency Solution
452 Minimum Number of Arrows to Burst Balloons Solution
454 4Sum II Solution
455 Assign Cookies Solution
459 Repeated Substring Pattern Solution
460 LFU Cache Solution
461 Hamming Distance Solution
467 Unique Substrings in Wraparound String Solution
475 Heaters Solution
476 Number Complement Solution
477 Total Hamming Distance Solution
480 Sliding Window Median Solution
482 License Key Formatting Solution
485 Max Consecutive Ones Solution
491 Increasing Subsequences Solution
495 Teemo Attacking Solution
496 Next Greater Element I Solution
498 Diagonal Traverse Solution
500 Keyboard Row Solution
503 Next Greater Element II Solution
504 Base 7 Solution
506 Relative Ranks Solution
507 Perfect Number Solution
508 Most Frequent Subtree Sum Solution
513 Find Bottom Left Tree Value Solution
515 Find Largest Value in Each Tree Row Solution
520 Detect Capital Solution
523 Continuous Subarray Sum Solution
524 Longest Word in Dictionary through Deleting Solution
525 Contiguous Array Solution
528 Random Pick with Weight Solution
530 Minimum Absolute Difference in BST Solution
532 K-diff Pairs in an Array Solution
537 Complex Number Multiplication Solution
538 Convert BST to Greater Tree Solution
539 Minimum Time Difference Solution
541 Reverse String II Solution
543 Diameter of Binary Tree Solution
551 Student Attendance Record I Solution
554 Brick Wall Solution
557 Reverse Words in a String III Solution
559 Maximum Depth of N-ary Tree Solution
560 Subarray Sum Equals K Solution
563 Binary Tree Tilt Solution
566 Reshape the Matrix Solution
567 Permutation in String Solution
572 Subtree of Another Tree Solution
575 Distribute Candies Solution
581 Shortest Unsorted Continuous Subarray Solution
589 N-ary Tree Preorder Traversal Solution
590 N-ary Tree Postorder Traversal Solution
592 Fraction Addition and Subtraction Solution
594 Longest Harmonious Subsequence Solution
598 Range Addition II Solution
599 Minimum Index Sum of Two Lists Solution
605 Can Place Flowers Solution
606 Construct String from Binary Tree Solution
609 Find Duplicate File in System Solution
611 Valid Triangle Number Solution
617 Merge Two Binary Trees Solution
621 Task Scheduler Solution
628 Maximum Product of Three Numbers Solution
633 Sum of Square Numbers Solution
637 Average of Levels in Binary Tree Solution
643 Maximum Average Subarray I Solution
645 Set Mismatch Solution
646 Maximum Length of Pair Chain Solution
647 Palindromic Substrings Solution
652 Find Duplicate Subtrees Solution
654 Maximum Binary Tree Solution
657 Robot Return to Origin Solution
658 Find K Closest Elements Solution
662 Maximum Width of Binary Tree Solution
665 Non-decreasing Array Solution
669 Trim a Binary Search Tree Solution
670 Maximum Swap Solution
671 Second Minimum Node In a Binary Tree Solution
674 Longest Continuous Increasing Subsequence Solution
678 Valid Parenthesis String Solution
680 Valid Palindrome II Solution
682 Baseball Game Solution
686 Repeated String Match Solution
687 Longest Univalue Path Solution
692 Top K Frequent Words Solution
693 Binary Number with Alternating Bits Solution
696 Count Binary Substrings Solution
697 Degree of an Array Solution
700 Search in a Binary Search Tree Solution
702 Search in a Sorted Array of Unknown Size Solution
703 Kth Largest Element in a Stream Solution
704 Binary Search Solution
706 Design HashMap Solution
713 Subarray Product Less Than K Solution
739 Daily Temperatures Solution
767 Reorganize String Solution
796 Rotate String Solution
845 Longest Mountain in Array Solution
875 Koko Eating Bananas Solution
876 Middle of the Linked List Solution
889 Construct Binary Tree from Preorder and Postorder Traversal Solution
912 Sort an Array Solution
953 Verifying an Alien Dictionary Solution
973 K Closest Points to Origin Solution
986 Interval List Intersections Solution
1019 Next Greater Node In Linked List Solution
1021 Remove Outermost Parentheses Solution
1032 Stream of Characters Solution
1047 Remove All Adjacent Duplicates In String Solution

About

A collection of efficient C/C++ solutions for LeetCode problems.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published