Skip to content

alexprut/LeetCode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Solutions Languages Author MIT



Disclaimer

Most of the problems are solved by using the Algo library.
Solutions to HackerRank problems.
Solutions to InterviewBit problems.

The problem solutions and implementations are entirely provided by Alex Prut. The code is not refactored, no coding style is followed, the only purpose of the written code is to pass all the platform tests of a given problem.

Problems

Number Title Difficulty Solution
1 Two Sum Easy Solution.java
2 Add Two Numbers Medium Solution.java
3 Longest Substring Without Repeating Characters Medium Solution.java
11 Container With Most Water Medium Solution.java
14 Longest Common Prefix Easy Solution.java
20 Valid Parentheses Easy Solution.java
21 Merge Two Sorted Lists Easy Solution.java
23 Merge k Sorted Lists Hard Solution.java
27 Remove Element Easy Solution.java
34 Find First and Last Position of Element in Sorted Array Medium Solution.java
39 Combination Sum Medium Solution.java
46 Permutations Medium Solution.java
47 Permutations II Medium Solution.java
49 Group Anagrams Medium Solution.java
53 Maximum Subarray Medium Solution.java
56 Merge Intervals Medium Solution.java
61 Rotate List Medium Solution.java
62 Unique Paths](https://leetcode.com/problems/unique-paths/) Medium Solution.java
64 Minimum Path Sum](https://leetcode.com/problems/minimum-path-sum/) Medium Solution.java
70 Climbing Stairs Easy Solution.java
72 Edit Distance Medium Solution.java
73 Set Matrix Zeroes Medium Solution.java
77 Combinations Medium Solution.java
88 Merge Sorted Array Easy Solution.java
92 Reverse Linked List II Medium Solution.java
94 Binary Tree Inorder Traversal Medium Solution.java
98 Validate Binary Search Tree Medium Solution.java
100 Same Tree Easy Solution.java
102 Binary Tree Level Order Traversal Medium Solution.java
103 Binary Tree Zigzag Level Order Traversal Medium Solution.java
104 Maximum Depth of Binary Tree Easy Solution.java
108 Convert Sorted Array to Binary Search Tree Easy Solution.java
111 Minimum Depth of Binary Tree Easy Solution.java
114 Flatten Binary Tree to Linked List Medium Solution.java
115 Min Stack Medium Solution.java
129 Sum Root to Leaf Numbers Medium Solution.java
130 Surrounded Regions Medium Solution.java
133 Clone Graph Medium Solution.java
136 Single Number Easy Solution.java
139 Word Break Medium Solution.java
146 LRU Cache Medium Solution.java
151 Reverse Words in a String Medium Solution.java
162 Find Peak Element Medium Solution.java
167 Two Sum II - Input Array Is Sorted Medium Solution.java
173 Binary Search Tree Iterator Medium Solution.java
189 Rotate Array Medium Solution.java
190 Reverse Bits Easy Solution.java
200 Number of Islands Medium Solution.java
211 Design Add and Search Words Data Structure Medium Solution.java
206 Reverse Linked List Easy Solution.java
208 Implement Trie (Prefix Tree) Medium Solution.java
209 Minimum Size Subarray Sum Medium Solution.java
225 Implement Stack using Queues Easy Solution.java
230 Kth Smallest Element in a BST Medium Solution.java
232 Implement Queue using Stacks Easy Solution.java
235 Implement Stack using Queues Easy Solution.java
236 Lowest Common Ancestor of a Binary Tree Medium Solution.java
237 Delete Node in a Linked List Easy Solution.java
240 Search a 2D Matrix II Medium Solution.java
274 H-Index Medium Solution.java
300 Longest Increasing Subsequence Medium Solution.java
344 Reverse String Easy Solution.java
412 Fizz Buzz Easy Solution.java
433 Minimum Genetic Mutation Medium Solution.java
451 Sort Characters By Frequency Medium Solution.java
460 LFU Cache Hard Solution.java
535 Encode and Decode TinyURL Medium Solution.java
538 Convert BST to Greater Tree Medium Solution.java
559 Maximum Depth of N-ary Tree Easy Solution.java
566 Reshape the Matrix Easy Solution.java
567 Permutation in String Medium Solution.java
589 N-ary Tree Preorder Traversal Easy Solution.java
590 N-ary Tree Postorder Traversal Easy Solution.java
595 Big Countries Easy Solution.java
620 Not Boring Movies Easy Solution.txt
617 Merge Two Binary Trees Easy Solution.java
695 Max Area of Island Medium Solution.java
700 Search in a Binary Search Tree Easy Solution.java
701 Insert into a Binary Search Tree Medium Solution.java
705 Design HashSet Easy Solution.java
706 Design HashMap Easy Solution.java
707 Design Linked List Medium Solution.java
709 To Lower Case Easy Solution.java
763 Partition Labels Medium Solution.java
771 Jewels and Stones Easy Solution.java
784 Letter Case Permutation Medium Solution.java
797 All Paths From Source to Target Medium Solution.java
804 Unique Morse Code Words Easy Solution.java
814 Binary Tree Pruning Medium Solution.java
832 Flipping an Image Easy Solution.java
867 Transpose Matrix Easy Solution.java
938 Range Sum of BST Easy Solution.java
946 Validate Stack Sequences Medium Solution.java
950 Reveal Cards In Increasing Order Medium Solution.java
965 Univalued Binary Tree Easy Solution.java
1008 Construct Binary Search Tree from Preorder Traversal Medium Solution.java
1021 Remove Outermost Parentheses Easy Solution.java
1038 Binary Search Tree to Greater Sum Tree Medium Solution.java
1091 Shortest Path in Binary Matrix Medium Solution.java
1108 Defanging an IP Address Easy Solution.java
1137 N-th Tribonacci Number Easy Solution.java
1143 Longest Common Subsequence Medium Solution.java
1179 Reformat Department Table Easy Solution.java
1206 Design Skiplist Hard Solution.java
1221 Split a String in Balanced Strings Easy Solution.java
1252 Cells with Odd Values in a Matrix Easy Solution.java
1266 Minimum Time Visiting All Points Easy Solution.java
1268 Search Suggestions System Medium Solution.java
1281 Subtract the Product and Sum of Digits of an Integer Easy Solution.java
1282 Group the People Given the Group Size They Belong To Medium Solution.java
1290 Convert Binary Number in a Linked List to Integer Easy Solution.java
1295 Find Numbers with Even Number of Digits Easy Solution.java
1299 Replace Elements with Greatest Element on Right Side Easy Solution.java
1302 Deepest Leaves Sum Medium Solution.java
1304 Find N Unique Integers Sum up to Zero Easy Solution.java
1305 All Elements in Two Binary Search Trees Medium Solution.java
1309 Decrypt String from Alphabet to Integer Mapping Easy Solution.java
1313 Decompress Run-Length Encoded List Easy Solution.java
1315 Sum of Nodes with Even-Valued Grandparent Medium Solution.java
1323 Maximum 69 Number Easy Solution.java
1329 Sort the Matrix Diagonally Medium Solution.java
1337 The K Weakest Rows in a Matrix Easy Solution.java
1342 Number of Steps to Reduce a Number to Zero Easy Solution.java
1347 Minimum Number of Steps to Make Two Strings Anagram Medium Solution.java
1351 Count Negative Numbers in a Sorted Matrix Easy Solution.java
1365 How Many Numbers Are Smaller Than the Current Number Easy Solution.java
1370 Increasing Decreasing String Easy Solution.java
1374 Generate a String With Characters That Have Odd Counts Easy Solution.java
1379 Find a Corresponding Node of a Binary Tree in a Clone of That Tree Medium Solution.java
1380 Lucky Numbers in a Matrix Easy Solution.java
1382 Balance a Binary Search Tree Medium Solution.java
1389 Create Target Array in the Given Order Easy Solution.java
1395 Count Number of Teams Medium Solution.java
1408 String Matching in an Array Easy Solution.java
1409 Queries on a Permutation With Key Medium Solution.java
1447 Simplified Fractions Medium Solution.java
1450 Number of Students Doing Homework at a Given Time Easy Solution.java
1464 Maximum Product of Two Elements in an Array Easy Solution.java
1470 Shuffle the Array Easy Solution.java
1480 Running Sum of 1d Array Easy Solution.java
1512 Number of Good Pairs Easy Solution.java
1534 Count Good Triplets Easy Solution.java
1557 Minimum Number of Vertices to Reach All Nodes Medium Solution.java
1588 Sum of All Odd Length Subarrays Easy Solution.java
1603 Design Parking System Easy Solution.java
1605 Find Valid Matrix Given Row and Column Sums Medium Solution.java
1684 Count the Number of Consistent Strings Easy Solution.java
1700 Number of Students Unable to Eat Lunch Easy Solution.java
1742 Maximum Number of Balls in a Box Easy Solution.java
1784 Check if Binary String Has at Most One Segment of Ones Easy Solution.java
1791 Find Center of Star Graph Easy Solution.java
1817 Finding the Users Active Minutes Medium Solution.java
1829 Maximum XOR for Each Query Medium Solution.java
1971 Find if Path Exists in Graph Easy Solution.java
2102 Sequentially Ordinal Rank Tracker Hard Solution.java
2130 Maximum Twin Sum of a Linked List Medium Solution.java
2181 Merge Nodes in Between Zeros Medium Solution.java
2315 Count Asterisks Easy Solution.java
2336 Smallest Number in Infinite Set Medium Solution.java
2363 Merge Similar Items Easy Solution.java
2427 Number of Common Factors Easy Solution.java
2485 Find the Pivot Integer Easy Solution.java
2545 Sort the Students by Their Kth Score Medium Solution.java

License

Licensed under MIT.