Skip to content

Krazune/LeetCode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 

Repository files navigation

LeetCode

Solutions for the LeetCode problems.

Problems

# Title Difficulty Solution
1 Two Sum πŸ’š C++
2 Add Two Numbers πŸ’› C
3 Longest Substring Without Repeating Characters πŸ’› C#
6 ZigZag Conversion πŸ’› C++
7 Reverse Integer πŸ’š C++
8 String to Integer (atoi) πŸ’› C
9 Palindrome Number πŸ’š C
13 Roman to Integer πŸ’š C++
14 Longest Common Prefix πŸ’š C++
20 Valid Parentheses πŸ’š C++
21 Merge Two Sorted Lists πŸ’š C++
24 Swap Nodes in Pairs πŸ’› C++
26 Remove Duplicates from Sorted Array πŸ’š C
27 Remove Element πŸ’š C
33 Search in Rotated Sorted Array πŸ’› C++
34 Search for a Range πŸ’› C++
35 Search Insert Position πŸ’š C / C#
50 Pow(x, n) πŸ’š C
58 Length of Last Word πŸ’š C#
62 Unique Paths πŸ’› Java
63 Unique Paths II πŸ’› Java
66 Plus One πŸ’š C++
69 Sqrt(x) πŸ’š C++
71 Simplify Path πŸ’› Java
75 Sort Colors πŸ’› C
83 Remove Duplicates from Sorted List πŸ’š C
88 Merge Sorted Array πŸ’š C++
94 Binary Tree Inorder Traversal πŸ’› C++
98 Validate Binary Search Tree πŸ’› C++
100 Same Tree πŸ’š C
101 Symmetric Tree πŸ’š C++
102 Binary Tree Level Order Traversal πŸ’› C++
103 Binary Tree Zigzag Level Order Traversal πŸ’› C++
104 Maximum Depth of Binary Tree πŸ’š C / Java
105 Construct Binary Tree from Preorder and Inorder Traversal πŸ’› C++
106 Construct Binary Tree from Inorder and Postorder Traversal πŸ’› C++
107 Binary Tree Level Order Traversal II πŸ’š C++
111 Minimum Depth of Binary Tree πŸ’š C++
112 Path Sum πŸ’š C++
116 Populating Next Right Pointers in Each Node πŸ’› C++
117 Populating Next Right Pointers in Each Node II πŸ’› C
118 Pascal's Triangle πŸ’š C++
119 Pascal's Triangle II πŸ’š C++
125 Valid Palindrome πŸ’š C++
136 Single Number πŸ’š C
141 Linked List Cycle πŸ’š C
144 Binary Tree Preorder Traversal πŸ’š C++ / Java
145 Binary Tree Postorder Traversal πŸ’š C++ / Java
150 Evaluate Reverse Polish Notation πŸ’› C++
153 Find Minimum in Rotated Sorted Array πŸ’› C++
154 Find Minimum in Rotated Sorted Array II ❀️ C++
155 Min Stack πŸ’š C++
160 Intersection of Two Linked Lists πŸ’š C++
162 Find Peak Element πŸ’› C++
168 Excel Sheet Column Title πŸ’š C++
169 Majority Element πŸ’š C++
171 Excel Sheet Column Number πŸ’š C++
173 Binary Search Tree Iterator πŸ’› C++
181 Employees Earning More Than Their Managers πŸ’š MySQL
182 Duplicate Emails πŸ’š MySQL
183 Customers Who Never Order πŸ’š MySQL
190 Reverse Bits πŸ’š C
191 Number of 1 Bits πŸ’š C++
200 Number of Islands πŸ’› C++
201 Bitwise AND of Numbers Range πŸ’› C++
205 Isomorphic Strings πŸ’š C++
206 Reverse Linked List πŸ’š C
208 Implement Trie (Prefix Tree) πŸ’› C++
217 Contains Duplicate πŸ’š C++
225 Implement Stack using Queues πŸ’š C++
226 Invert Binary Tree πŸ’š C / C++
231 Power of Two πŸ’š C++
232 Implement Queue using Stacks πŸ’š C++
236 Lowest Common Ancestor of a Binary Tree πŸ’› C
237 Delete Node in a Linked List πŸ’š C++
238 Product of Array Except Self πŸ’› C++
242 Valid Anagram πŸ’š C++
257 Binary Tree Paths πŸ’š C++
258 Add Digits πŸ’š C
268 Missing Number πŸ’š C
278 First Bad Version πŸ’š C++
283 Move Zeroes πŸ’š C
289 Game of Life πŸ’› C / C++
292 Nim Game πŸ’š C
297 Serialize and Deserialize Binary Tree ❀️ C++
303 Range Sum Query - Immutable πŸ’š Java
326 Power of Three πŸ’š C
338 Counting Bits πŸ’› C
344 Reverse String πŸ’š C++
345 Reverse Vowels of a String πŸ’š C++
349 Intersection of Two Arrays πŸ’š C++
350 Intersection of Two Arrays II πŸ’š C++
367 Valid Perfect Square πŸ’š C++
374 Guess Number Higher or Lower πŸ’š C++
383 Ransom Note πŸ’š C++
384 Shuffle an Array πŸ’› C++
387 First Unique Character in a String πŸ’š C
389 Find the Difference πŸ’š C / C#
404 Sum of Left Leaves πŸ’š C
405 Convert a Number to Hexadecimal πŸ’š C++
409 Longest Palindrome πŸ’š C
412 Fizz Buzz πŸ’š C++ / C#
414 Third Maximum Number πŸ’š C++
429 N-ary Tree Level Order Traversal πŸ’š C++
430 Flatten a Multilevel Doubly Linked List πŸ’› Java
434 Number of Segments in a String πŸ’š C++
441 Arranging Coins πŸ’š C++
442 Find All Duplicates in an Array πŸ’› C++
450 Delete Node in a BST πŸ’› C++
461 Hamming Distance πŸ’š C++
463 Island Perimeter πŸ’š C++
476 Number Complement πŸ’š C
478 Generate Random Point in a Circle πŸ’› C++ / JavaScript
482 License Key Formatting πŸ’š C++
485 Max Consecutive Ones πŸ’š C++
495 Teemo Attacking πŸ’› C / C++
496 Next Greater Element I πŸ’š C++
500 Keyboard Row πŸ’š C++
504 Base 7 πŸ’š C++
506 Relative Ranks πŸ’š C++
509 Fibonacci Number πŸ’š C
513 Find Bottom Left Tree Value πŸ’› C++
515 Find Largest Value in Each Tree Row πŸ’› C++
520 Detect Capital πŸ’š C
529 Minesweeper πŸ’› C++
535 Encode and Decode TinyURL πŸ’› C++
538 Convert BST to Greater Tree πŸ’š C++
557 Reverse Words in a String III πŸ’š C++
559 Maximum Depth of N-ary Tree πŸ’š C++
566 Reshape the Matrix πŸ’š C++
575 Distribute Candies πŸ’š C++
589 N-ary Tree Preorder Traversal πŸ’š C++
590 N-ary Tree Postorder Traversal πŸ’š C++
594 Longest Harmonious Subsequence πŸ’š Java
595 Big Countries πŸ’š MySQL
596 Classes More Than 5 Students πŸ’š MySQL
598 Range Addition II πŸ’š C++
599 Minimum Index Sum of Two Lists πŸ’š C++
606 Construct String from Binary Tree πŸ’š C++
617 Merge Two Binary Trees πŸ’š C++
620 Not Boring Movies πŸ’š MySQL
622 Design Circular Queue πŸ’› C
627 Swap Salary πŸ’š MySQL
628 Maximum Product of Three Numbers πŸ’š C++
637 Average of Levels in Binary Tree πŸ’š C++
643 Maximum Average Subarray I πŸ’š C++
653 Two Sum IV - Input is a BST πŸ’š C++
654 Maximum Binary Tree πŸ’› C++
657 Judge Route Circle πŸ’š C#
658 Find K Closest Elements πŸ’› C++
661 Image Smoother πŸ’š C++
669 Trim a Binary Search Tree πŸ’š C
670 Maximum Swap πŸ’› C++
682 Baseball Game πŸ’š C++
690 Employee Importance πŸ’š C++
693 Binary Number with Alternating Bits πŸ’š C#
695 Max Area of Island πŸ’› C++
700 Search in a Binary Search Tree πŸ’š C++
701 Insert into a Binary Search Tree πŸ’› C++
704 Binary Search πŸ’š C++
705 Design HashSet πŸ’š C++
706 Design HashMap πŸ’š C++
709 To Lower Case πŸ’š C
717 1-bit and 2-bit Characters πŸ’š C#
722 Remove Comments πŸ’› C++
724 Find Pivot Index πŸ’š C++
728 Self Dividing Numbers πŸ’š C++
733 Flood Fill πŸ’š C++
744 Find Smallest Letter Greater Than Target πŸ’š C
747 Largest Number At Least Twice of Others πŸ’š C
752 Open the Lock πŸ’› C++
766 Toeplitz Matrix πŸ’š C++
771 Jewels and Stones πŸ’š C++ / Java
784 Letter Case Permutation πŸ’š C++
788 Rotated Digits πŸ’š C
791 Custom Sort String πŸ’› C++
796 Rotate String πŸ’š C++
804 Unique Morse Code Words πŸ’š C++
806 Number of Lines To Write String πŸ’š C / C++
807 Max Increase to Keep City Skyline πŸ’› C++
811 Subdomain Visit Count πŸ’š C++
814 Binary Tree Pruning πŸ’› C++
817 Linked List Components πŸ’› C++
821 Shortest Distance to a Character πŸ’š C++
824 Goat Latin πŸ’š C++
830 Positions of Large Groups πŸ’š C++
831 Masking Personal Information πŸ’› C++
832 Flipping an Image πŸ’š C++
841 Keys and Rooms πŸ’› C++
852 Peak Index in a Mountain Array πŸ’š C++
859 Buddy Strings πŸ’š C++
860 Lemonade Change πŸ’š C++
867 Transpose Matrix πŸ’š C++
868 Binary Gap πŸ’š C++
872 Leaf-Similar Trees πŸ’š C++
876 Middle of the Linked List πŸ’š C
884 Uncommon Words from Two Sentences πŸ’š C++
890 Find and Replace Pattern πŸ’› C++
896 Monotonic Array πŸ’š C
897 Increasing Order Search Tree πŸ’š C++
905 Sort Array By Parity πŸ’š C++
908 Smallest Range I πŸ’š C
912 Sort an Array πŸ’› C++
917 Reverse Only Letters πŸ’š C++
921 Minimum Add to Make Parentheses Valid πŸ’› C / C++
922 Sort Array By Parity II πŸ’š C++
925 Long Pressed Name πŸ’š C
929 Unique Email Addresses πŸ’š C++
933 Number of Recent Calls πŸ’š C++
938 Range Sum of BST πŸ’› C / Java
941 Valid Mountain Array πŸ’š C++
944 Delete Columns to Make Sorted πŸ’š C++
946 Validate Stack Sequences πŸ’› C++
951 Flip Equivalent Binary Trees πŸ’› C++
953 Verifying an Alien Dictionary πŸ’š C++
961 N-Repeated Element in Size 2N Array πŸ’š C / C++
965 Univalued Binary Tree πŸ’š C++
976 Largest Perimeter Triangle πŸ’š C++
977 Squares of a Sorted Array πŸ’š C++
993 Cousins in Binary Tree πŸ’š C++
997 Find the Town Judge πŸ’š C++
999 Available Captures for Rook πŸ’š C++
1002 Find Common Characters πŸ’š C++
1008 Construct Binary Search Tree from Preorder Traversal πŸ’› Java
1021 Remove Outermost Parentheses πŸ’š C++
1028 Recover a Tree From Preorder Traversal ❀️ C++
1038 Binary Search Tree to Greater Sum Tree πŸ’› C++
1046 Last Stone Weight πŸ’š C++
1071 Greatest Common Divisor of Strings πŸ’š Java
1078 Occurrences After Bigram πŸ’š Java
1089 Duplicate Zeros πŸ’š C++
1108 Defanging an IP Address πŸ’š C / C++
1114 Print in Order πŸ’š Java
1115 Print FooBar Alternately πŸ’š Java
1116 Print Zero Even Odd πŸ’› Java
1117 Building H2O πŸ’› Java
1154 Day of the Year πŸ’š C++
1189 Maximum Number of Balloons πŸ’š C++
1195 Fizz Buzz Multithreaded πŸ’› Java
1207 Unique Number of Occurrences πŸ’š C++
1221 Split a String in Balanced Strings πŸ’š C
1227 Airplane Seat Assignment Probability πŸ’› C++
1252 Cells with Odd Values in a Matrix πŸ’š C++ / JavaScript
1260 Shift 2D Grid πŸ’š C++
1281 Subtract the Product and Sum of Digits of an Integer πŸ’š C
1282 Group the People Given the Group Size They Belong To πŸ’› JavaScript
1287 Element Appearing More Than 25% In Sorted Array πŸ’š C++
1290 Convert Binary Number in a Linked List to Integer πŸ’š JavaScript
1295 Find Numbers with Even Number of Digits πŸ’š C
1304 Find N Unique Integers Sum up to Zero πŸ’š C++
1309 Decrypt String from Alphabet to Integer Mapping πŸ’š C++
1313 Decompress Run-Length Encoded List πŸ’š C
1323 Maximum 69 Number πŸ’š C++ / JavaScript
1331 Rank Transform of an Array πŸ’š C++
1342 Number of Steps to Reduce a Number to Zero πŸ’š C++ / JavaScript
1365 How Many Numbers Are Smaller Than the Current Number πŸ’š C++ / JS
1379 Find a Corresponding Node of a Binary Tree in a Clone of That Tree πŸ’› C++ / JavaScript
1380 Lucky Numbers in a Matrix πŸ’š C++
1394 Find Lucky Integer in an Array πŸ’š C++
1417 Reformat The String πŸ’š C
1431 Kids With the Greatest Number of Candies πŸ’š C++
1436 Destination City πŸ’š C++
1446 Consecutive Characters πŸ’š C++
1447 Simplified Fractions πŸ’› C++
1455 Check If a Word Occurs As a Prefix of Any Word in a Sentence πŸ’š C++
1464 Maximum Product of Two Elements in an Array πŸ’š C++
1470 Shuffle the Array πŸ’š C++
1476 Subrectangle Queries πŸ’› C++
1480 Running Sum of 1d Array πŸ’š C++
1486 XOR Operation in an Array πŸ’š C++ / JavaScript
1496 Path Crossing πŸ’š C++
1512 Number of Good Pairs πŸ’š C++
1518 Water Bottles πŸ’š C++
1528 Shuffle String πŸ’š C / C++ / JavaScript
1539 Kth Missing Positive Number πŸ’š C++
1556 Thousand Separator πŸ’š C++
1572 Matrix Diagonal Sum πŸ’š C++ / JavaScript
1576 Replace All ?'s to Avoid Consecutive Repeating Characters πŸ’š C++
1588 Sum of All Odd Length Subarrays πŸ’š C++
1592 Rearrange Spaces Between Words πŸ’š C++
1598 Crawler Log Folder πŸ’š C++
1603 Design Parking System πŸ’š JavaScript
1609 Even Odd Tree πŸ’› C++
1614 Maximum Nesting Depth of the Parentheses πŸ’š C++
1624 Largest Substring Between Two Equal Characters πŸ’š C++
1637 Widest Vertical Area Between Two Points Containing No Points πŸ’› C++
1646 Get Maximum in Generated Array πŸ’š C++
1656 Design an Ordered Stream πŸ’š C++ / Java / JavaScript
1662 Check If Two String Arrays are Equivalent πŸ’š C++
1672 Richest Customer Wealth πŸ’š C++
1678 Goal Parser Interpretation πŸ’š Java
1684 Count the Number of Consistent Strings πŸ’š C++ / Java / JavaScript
1694 Reformat Phone Number πŸ’š C++
1704 Determine if String Halves Are Alike πŸ’š Java
1732 Find the Highest Altitude πŸ’š C++ / Java / JavaScript
1736 Latest Time by Replacing Hidden Digits πŸ’š C++ / Java / JavaScript
1743 Restore the Array From Adjacent Pairs πŸ’› C++
1748 Sum of Unique Elements πŸ’š C++ / Java / JavaScript
1752 Check if Array Is Sorted and Rotated πŸ’š C++ / Java / JavaScript
1758 Minimum Changes To Make Alternating Binary String πŸ’š C++ / Java / JavaScript
1768 Merge Strings Alternately πŸ’š C++ / Java / JavaScript
1773 Count Items Matching a Rule πŸ’š C++ / Java / JavaScript
1779 Find Nearest Point That Has the Same X or Y Coordinate πŸ’š C++ / Java / JavaScript
1784 Check if Binary String Has at Most One Segment of Ones πŸ’š C++ / Java / JavaScript
2278 Percentage of Letter in String πŸ’š Java

πŸ’š - Easy problem; πŸ’› - Medium problem; ❀️ - Hard problem.

About

Solutions for the LeetCode problems using various languages.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published