Skip to content

gorthitk/leetcode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The code in this repository is my attempts at solving several algo-datastructure problems as found on Leetcode. The solutions here are not always the best or optimal. That being said, feel free to fork the repo and use them for any purposes. Good luck !

Number of Problems solved : 292

Solutions in the following languages : Language Language Language Language 

# Title Solution
1 Two Sum Java
2 Add Two Numbers Java
3 Longest Substring Without Repeating Characters Java
4 Median of Two Sorted Arrays Add to List Java
5 Longest Palindromic Substring Java
6 ZigZag Conversion Java
7 Reverse Integer Java
8 String to Integer (atoi) Java
9 Palindrome Number Java
11 Container With Most Water Java
12 Integer to Roman Java
14 Longest Common Prefix Java
15 3Sum Java,Javascript
16 3Sum Closest Java
18 4Sum Java
21 Merge Two Sorted Lists Golang,Java,Javascript
25 Reverse Nodes in k-Group Java
26 Remove Duplicates from Sorted Array Java
28 Implement strStr() Java
31 Next Permutation Java
32 Longest Valid Parentheses Java
33 Search in Rotated Sorted Array Java
34 Search for a Range Java
35 Search Insert Position Java
37 Sudoku Solver Java
38 Count and Say Java
39 Combination Sum Java
40 Combination Sum II Java
45 Jump Game II Java
48 Rotate Image Java
53 Maximum Subarray Golang,Java
54 Spiral Matrix Java
55 Jump Game Java
56 Merge Intervals Java
58 Length of Last Word Java
59 Spiral Matrix II Java
60 Permutation Sequence Java
64 Minimum Path Sum Golang,Java
65 Valid Number Golang,Java
69 Sqrt(x) Java
70 Climbing Stairs Golang,Java
71 Simplify Path Java
72 Edit Distance Java
73 Set Matrix Zeroes Java
75 Sort Colors Java
79 Word Search Java
80 Remove Duplicates from Sorted Array II Java
83 Remove Duplicates from Sorted List Golang,Java
87 Scramble String Java
90 Subsets II Java
91 Decode Ways Java
92 Reverse Linked List II Java
93 Restore IP Addresses Java
94 Binary Tree Inorder Traversal Java
97 Interleaving String Java
98 Validate Binary Search Tree Golang,Java
100 Same Tree Golang,Java
101 Symmetric Tree Java
102 Binary Tree Level Order Traversal Golang,Java
103 Binary Tree Zigzag Level Order Traversal Java
104 Maximum Depth of Binary Tree Java
105 Construct Binary Tree from Preorder and Inorder Traversal Golang,Java
106 Construct Binary Tree from Inorder and Postorder Traversal Golang,Java
107 Binary Tree Level Order Traversal II Java
108 Convert Sorted Array to Binary Search Tree Golang,Java
110 Balanced Binary Tree Golang,Java
111 Minimum Depth of Binary Tree Golang,Java
112 Path Sum Golang,Java
113 Path Sum II Golang,Java
114 Flatten Binary Tree to Linked List Golang,Java
116 Populating Next Right Pointers in Each Node Java
117 Refer to Problem 116 Java
118 Refer to Problem 116 Java
120 Triangle Golang,Java
121 Best Time to Buy and Sell Stock Java
122 Best Time to Buy and Sell Stock II Java
124 Binary Tree Maximum Path Sum Java
129 Sum Root to Leaf Numbers Java
130 Surrounded Regions Java
131 Palindrome Partitioning Java
136 Single Number Java
139 Word Break Java
141 Linked List Cycle Java
144 Binary Tree Preorder Traversal Golang,Java
146 LRU Cache Java
148 Sort List Java
150 Evaluate Reverse Polish Notation Java
155 Min Stack Java
160 Intersection of Two Linked Lists Java
162 Find Peak Element Java
165 Compare Version Numbers Java
166 Fraction to Recurring Decimal Java
168 Excel Sheet Column Title Java
169 Majority Element Java
172 Factorial Trailing Zeroes Java
192 Word Frequency Bash
193 Valid Phone Numbers Bash
195 Tenth Line Bash
198 House Robber Golang,Java
199 Binary Tree Right Side View Golang,Java
200 Number of Islands Java
201 Bitwise AND of Numbers Range Java
202 Happy Number Java
203 Remove Linked List Elements Golang,Java
206 Reverse Linked List Golang,Java
208 Implement Trie (Prefix Tree) Java
212 Word Search II Java
216 Combination Sum III Java
226 Longest Substring Without Repeating Characters Golang,Java
230 Kth Smallest Element in a BST Golang,Java
234 Palindrome Linked List Golang,Java
235 Lowest Common Ancestor of a Binary Search Tree Java
236 Lowest Common Ancestor of a Binary Tree Java
237 Delete Node in a Linked List Java
238 Product of Array Except Self Java
240 Search a 2D Matrix II Java
241 Different Ways to Add Parentheses Java
257 Binary Tree Paths Java
279 Perfect Squares Java
281 Zigzag Iterator Java
289 Game of Life Java
297 Serialize and Deserialize Binary Tree Java
299 Bulls and Cows Java
300 Longest Increasing Subsequence Java
322 Coin Change Java
326 Power of Three Java
331 Verify Preorder Serialization of a Binary Tree Java
334 Increasing Triplet Subsequence Java
341 Flatten Nested List Iterator Java
343 Integer Break Java
355 Design Twitter Java
357 Count Numbers with Unique Digits Java
365 Water and Jug Problem Java
367 Valid Perfect Square Java
376 Wiggle Subsequence Java
377 Combination Sum IV Java
380 Insert Delete GetRandom O(1) Java
381 Insert Delete GetRandom O(1) - Duplicates allowed Java
383 Ransom Note Java
384 Shuffle an Array Java
388 Longest Absolute File Path Java
392 Is Subsequence Golang,Java
394 Decode String Java
395 Longest Substring with At Least K Repeating Characters Java
396 Rotate Function Java
404 Sum of Left Leaves Golang,Java
413 Arithmetic Slices Golang,Java
416 Partition Equal Subset Sum Java
424 Longest Repeating Character Replacement Java
432 All O`one Data Structure Java
437 Path Sum III Golang,Java
449 Serialize and Deserialize BST Java
450 Delete Node in a BST Golang,Java
451 Sort Characters By Frequency Java
454 4Sum II Java
456 Pattern Java
460 LFU Cache Java
468 Validate IP Address Java
472 Concatenated Words Java
486 Predict the Winner Golang,Java
495 Teemo Attacking Java
501 Find Mode in Binary Search Tree Java
504 Base 7 Java
507 Perfect Number Java
508 Most Frequent Subtree Sum Golang,Java
513 Find Bottom Left Tree Value Golang,Java
515 Find Largest Value in Each Tree Row Java
516 Longest Palindromic Subsequence Java
520 Detect Capital Java
521 Longest Uncommon Subsequence I Java
522 Longest Uncommon Subsequence II Java
524 Longest Word in Dictionary through Deleting Java
526 Beautiful Arrangement Java
538 Convert BST to Greater Tree Java
540 Single Element in a Sorted Array Java
541 Reverse String II Java
542 01 Matrix Golang,Java
543 Diameter of Binary Tree Golang,Java
547 Friend Circles Java
551 Student Attendance Record I Java
552 Student Attendance Record II Java
554 Brick Wall Java
556 Next Greater Element III Java
557 Reverse Words in a String III Java
560 Subarray Sum Equals K Java
561 Array Partition I Java
562 Longest Line of Consecutive One in Matrix Java
563 Binary Tree Tilt Java
565 Array Nesting Java
566 Reshape the Matrix Java
567 Permutation in String Java
572 Subtree of Another Tree Golang,Java
575 Distribute Candies Java
581 Shortest Unsorted Continuous Subarray Golang,Java
582 ZigZag Conversion Golang,Java
583 Delete Operation for Two Strings Java
588 Design In-Memory File System Java
591 Tag Validator Java
592 Fraction Addition and Subtraction Java
593 Valid Square Java
594 Longest Harmonious Subsequence Java
598 Range Addition II Java
599 Minimum Index Sum of Two Lists Java
605 Can Place Flowers Java
606 Construct String from Binary Tree Java
609 Find Duplicate File in System Java
611 Valid Triangle Number Java
616 Add Bold Tag in String Java
617 Merge Two Binary Trees Java
621 Task Scheduler Java
623 Add One Row to Tree Java
624 Maximum Distance in Arrays Java
625 Minimum Factorization Java
628 Maximum Product of Three Numbers Java
630 Course Schedule III Java
631 Design Excel Sum Formula Java
633 Sum of Square Numbers Java
635 Design Log Storage System Java
637 Average of Levels in Binary Tree Java
649 Dota2 Senate My SubmissionsBack to Contest Java
650 2 Keys Keyboard My SubmissionsBack to Contest Java
651 4 Keys Keyboard My SubmissionsBack to Contest Java
653 Two Sum IV - Input is a BST Java
657 Judge Route Circle Java
669 Trim a Binary Search Tree Java
671 Second Minimum Node In a Binary Tree Java
690 Employee Importance Java
692 Top K Frequent Words Java
695 Max Area of Island Java
697 Degree of an Array Java
717 1-bit and 2-bit Characters Java
720 Longest Word in Dictionary Java
724 Find Pivot Index Java
725 Split Linked List in Parts Java
728 Self Dividing Numbers Java
733 Flood Fill Java
739 Daily Temperatures Java
740 Delete and Earn Java
744 Find Smallest Letter Greater Than Target Java
746 Min Cost Climbing Stairs Java
747 Largest Number Greater Than Twice of Others Java
749 Shortest Completing Word Java
760 Find Anagram Mappings Java
766 Toeplitz Matrix Java
783 Minimum Distance Between BST Nodes Java
784 Letter Case Permutation Java
788 Rotated Digits Java
796 Rotate String Java
804 Unique Morse Code Words Java
811 Subdomain Visit Count Java
875 Koko Eating Bananas Java
938 Range Sum of BST Java
997 Find the Town Judge Java
999 Available Captures for Rook Java
1020 Number of Enclaves Java
1231 Divide Chocolate Java
1265 Print Immutable Linked List in Reverse Java
1269 Number of Ways to Stay in the Same Place After Some Steps Java
1272 Remove Interval Java
1273 Delete Tree Nodes Java
1302 Deepest Leaves Sum Java
1306 Sum of Nodes with Even-Valued Grandparent Java
1315 Sum of Nodes with Even-Valued Grandparent Java
1324 Print Words Vertically Java
1325 Delete Leaves With a Given Value Java
1338 Reduce Array Size to The Half Java
1339 Maximum Product of Splitted Binary Tree Java
1357 Apply Discount Every n Orders Java
1358 Number of Substrings Containing All Three Characters Java
1371 Find the Longest Substring Containing Vowels in Even Counts Java
1385 Find the Distance Value Between Two Arrays Java
1394 Find Lucky Integer in an Array Java
1395 Count Number of Teams Java
1413 Minimum Value to Get Positive Step by Step Sum Java
1423 Maximum Points You Can Obtain from Cards Java
1429 First Unique Number Java
1441 Build an Array With Stack Operations Java
1443 Minimum Time to Collect All Apples in a Tree Java
1448 Count Good Nodes in Binary Tree Java
1451 Rearrange Words in a Sentence Java
1456 Maximum Number of Vowels in a Substring of Given Length Java
1457 Pseudo-Palindromic Paths in a Binary Tree Java
1471 The k Strongest Values in an Array Java
1472 Design Browser History Java
1480 Running Sum of 1d Array Java
1481 Least Number of Unique Integers after K Removals Java
1482 Minimum Number of Days to Make m Bouquets Java
1483 Kth Ancestor of a Tree Node Java
1485 Clone Binary Tree With Random Pointer Java
1486 XOR Operation in an Array Java
1487 Making File Names Unique Java
1488 Avoid Flood in The City Java