Skip to content

This list contains solutions to most questions I have solved on LeetCode

Notifications You must be signed in to change notification settings

trung-hn/leetcode-solutions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Solutions list

# Title Level Time Space Tags Note Premium πŸ”’
1 Two Sum Easy O(N) O(N)
7 Reverse Integer Easy O(log x) O(1) Tricky
15 3Sum Medium O(N) O(1)
20 Valid Parentheses Easy O(N) O(N) String, Stack
21 Merge Two Sorted Lists Easy O(N) O(1) Linked List
22 Generate Parentheses Medium Complicated Complicated String, Backtracking
30 Substring with Concatenation of All Words Hard O(NK) O(K) Array, Backtracking
39 Combination Sum Medium O(N^2) O(N) Array, Backtracking
46 Permutations Medium O(N!) O(N!) Backtracking
47 Permutations II Medium O(N!) O(N!) Backtracking
53 Maximum Subarray Easy O(N) O(1)
57 Insert Interval Hard O(N) O(N) Array, Sort, Greedy
61 Rotate List Medium O(N) O(1) Linked List, Two Pointers
72 Edit Distance Hard O(N * M) O(N) String, Dynamic Programming
74 Search a 2D Matrix Medium O(logN + logM) O(1) Binary Search
78 Subsets Medium O(N*2^N) O(N*2^N) Backtracking, Bit Manipulation
99 Recover Binary Search Tree Hard O(N) O(N) Tree, DFS
100 Same Tree Easy O(N) O(H) Tree, Pythonic
107 Binary Tree Level Order Traversal II Easy O(N) O(N) Tree, Breath First Search
111 Minimum Depth of Binary Tree Easy O(N) O(H) Tree, DFS, BFS
114 Flatten Binary Tree to Linked List Medium O(N) O(1) Tree, Depth First Search
116 Populating Next Right Pointers in Each Node Medium O(N) O(N) Tree, DFS, BFS
119 Pascal's Triangle II Easy O(k^2) O(k) Array
121 Best Time to Buy and Sell Stock Easy O(N) O(1) Dynamic Programming
122 Best Time to Buy and Sell Stock II Easy O(N) O(1) Array, Greedy
125 Valid Palindrome Easy O(1) O(1) String
133 Clone Graph Medium O(N+M) O(N) DFS, BFS, Graph
134 Gas Station Medium O(N) O(N) Dynamic Programming, Greedy
139 Word Break Medium O(N^2) O(N) Dynamic Programming
142 Linked List Cycle II Medium O(N) O(1) Linked List, Two Pointers
143 Reorder List Medium O(N) O(1) Linked List
147 Sort, Linked List Medium O(N^2) O(1) Sort, Linked List
151 Reverse Words in a String Easy O(N) O(N) String
152 Maximum Product Subarray Medium O(N) O(N) Dynamic Programming, Array
153 Find Minimum in Rotated Sorted Array Medium O(logN) O(1) Binary Search
154 Find Minimum in Rotated Sorted Array II Hard O(logN) O(1) Binary Search
159 Longest Substring with At Most Two Distinct Characters Medium O(N) O(1) Premium, Hash Table, Two Pointers, String, Sliding Window
165 Compare Version Numbers Medium O(N) O(1) String
171 Excel Sheet Column Number Easy O(N) O(1) String
179 Largest Number Medium O(NlogN) O(1) Sort
187 Repeated DNA Sequences Medium O(N-L) O(N-L) Hash Table, Bit Manipulation
190 Reverse Bits Easy O(1) O(1) Bit Manipulation
198 House Robber Easy O(N) O(1) Dynamic Programming
207 Course Schedule Medium O(N + E) O(N + E) Breath First Search, Depth First Search, Graph, Topological Sort
208 Implement Trie (Prefix Tree) Medium Varying Varying Design, Trie
211 Add and Search Word - Data structure design Medium O(M) O(1) Trie, Design
213 House Robber II Medium O(N) O(1) Dynamic Programming
216 Combination Sum III Medium O(N^2) O(N^2) Array, Backtracking
220 Contains Duplicate III Medium O(N) O(N) Sort, Ordered Map
221 Maximal Square Medium O(N * M) O(1) Array, Dynamic Programming
222 Count Complete Tree Nodes Medium O(logN * logN) O(1) Binary Search, Tree
227 Basic Calculator II Medium O(N) O(N) String, Stack
228 Summary Ranges Easy O(N) O(1) Array
229 Majority Element II Medium O(N) O(1) Array
230 Kth Smallest Element in a BST Medium O(H + k) O(H + k) Tree, Depth First Search Use general formula for tree traversal
231 Power of Two Easy O(1) O(1) Bit Manipulation Important technique in bit manipulation
252 Meeting Rooms Easy O(NlogN) O(1) Premium, Sort πŸ”’
253 Meeting Rooms II Medium O(NlogN) O(N) Premium, Heap, Greedy, Sort πŸ”’
264 Ugly Number II Medium O(1) O(1) Heap, Dynamic Programming
270 Closest Binary Search Tree Value Easy O(H) O(1) Premium, Binary Search, Tree πŸ”’
274 H-Index Medium O(NlogN) O(N) Hash Table, Sort There is a better solution
284 Peeking Iterator Medium O(NlogN) O(N) Design
290 Word Pattern Easy O(N) O(N) Hash Table
295 Find Median from Data Stream Hard O(logN) O(N) Design, Hard, Heap
296 Best Meeting Point Hard O(M*N) O(M+N) Premium, Math πŸ”’
299 Bulls and Cows Easy O(N) O(N) Hash Table
310 Minimum Height Trees Medium O(V) O(V) BFS, Graph
316 Remove Duplicate Letters Hard O(N) O(1) Greedy, Tricky, Stack
317 Shortest Distance from All Buildings Hard O(N*M) O(N*M) BFS, Premium πŸ”’
319 Bulb Switcher Medium O(1) O(1) Math, Tricky
320 Generalized Abbreviation Medium O(N*2^N) O(N) Premium, Backtracking πŸ”’
328 Odd Even Linked List Medium O(N) O(1) Linked List
337 House Robber III Medium O(N) O(N) Dynamic Programming, Tree, DFS
338 Counting Bits Medium O(N) O(N) Dynamic Programming, Bit Manipulation
342 Power of Four Easy O(1) O(1) Math, Bit Manipulation
344 Reverse String Easy O(N) O(1) Two Pointers, String
346 Moving Average from Data Stream Easy O(1) O(N) Premium, Design πŸ”’
347 Top K Frequent Elements Medium O(N) O(N) Hash Table, Heap
348 Design Tic-Tac-Toe Medium O(1) O(N^2) Premium, Design πŸ”’
351 Android Unlock Patterns Medium O(N!) O(N) Dynamic Programming, Backtracking, Premium πŸ”’
361 Bomb Enemy Medium O(N*M) O(N*M) Premium, Dynamic Programming πŸ”’
362 Design Hit Counter Medium O(1) O(N) Design, Premium πŸ”’
367 Valid Perfect Square Easy O(logN) O(1) Math, Binary Search
378 Kth Smallest Element in a Sorted Matrix Medium O(N^2logK) O(K) Heap, Binary Search
380 Insert Delete GetRandom Medium O(1) O(N) Array, Hash Table, Design
389 Find the Difference Medium O(N) O(1) Hash Table, Bit Manipulation
387 First Unique Character in a String Easy O(N) O(N)
394 Decode String Medium O(maxK*N) O(N) Stack, DFS
395 Longest Substring with At Least K Repeating Characters Medium O(NlogN) O(N) Divide and Conquer, Recursion, Sliding Window
399 Evaluate Division Medium O(N*M) O(N) Union Find, Graph
402 Remove K Digits Medium O(N) O(N) Greedy
404 Sum of Left Leaves Easy O(N) O(H) Tree
406 Queue Reconstruction by Height Medium O(N^2) O(N) Greedy Clever solution
419 Battleships in a Board Medium O(N*N) O(1) Array, Depth First Search
425 Word Squares Hard Complex Complex Back Tracking, Trie, Premium πŸ”’
428 Serialize and Deserialize N-ary Tree Hard O(N) O(H) Tree, Premium πŸ”’
431 Encode N-ary Tree to Binary Tree Hard O(N) O(H) Tree, Premium πŸ”’
435 Non-overlapping Intervals Medium O(NlogN) O(1) Greedy Tricky, Hard
436 Find Right Interval Medium O(NlogN) O(N) Binary Search Bad Description
437 Path Sum III Medium O(N) O(N) Tree Tricky, Hard
438 Find All Anagrams in a String Medium O(N_s + N_p) O(1) Hash Table
442 Find All Duplicates in an Array Medium O(N) O(1) Array
445 Add Two Numbers II Medium O(N) O(N) Linked List
449 Serialize and Deserialize BST Medium O(N) O(N) Tree
450 Delete Node in a BST Medium O(H) O(H) Binary Search Tree
451 Sort Characters By Frequency Medium O(N) O(N) Hash Table, Sorting, Pythonic
452 Minimum Number of Arrows to Burst Balloons Medium O(NlogN) O(1) Sort, Greedy
456 132 Pattern Medium O(N) O(N) Stack
458 Poor Pigs Hard O(1) O(1) Math
462 Minimum Moves to Equal Array Elements II Median O(NlogN) O(N) Math
463 Island Perimeter Easy O(N*M) O(1) Greedy
470 Implement Rand10() Using Rand7() Medium O(1) O(1) Math
476 Number Complement Easy O(N) O(1) Bit Manipulation
495 Teemo Attacking Medium O(N) O(1) Array
497 Random Point in Non-overlapping Rectangles Medium O(logN) O(N) Design, Binary Search
510 Inorder Successor in BST II Medium O(H) O(1) Tree, Premium πŸ”’
520 Detect Capital Easy O(N) O(1)
525 Contiguous Array Medium O(N) O(N) Hash Table Very good problem
528 Random Pick with Weight Medium O(N), O(logN) O(N), O(1) Binary Search, Random Pythonic
532 K-diff Pairs in an Array Medium O(N) O(N) Array, Two Pointers
540 Single Element in a Sorted Array Medium O(logN) O(1) Binary Search
563 Binary Tree Tilt Easy O(N) O(H) Tree, DFS, Recursion
567 Permutation in String Medium O(S1 + S2) O(1) String, Two Pointers, Sliding Window
573 Squirrel Simulation Medium O(N) O(1) Premium, Math πŸ”’
593 Valid Square Medium O(1) O(1) Math
622 Design Circular Queue Medium O(1) O(1) Design, Queue
624 Maximum Distance in Arrays Easy O(N) O(1) Hash Table, Array, Premium πŸ”’
646 Maximum Length of Pair Chain Medium O(NlogN) O(N) Greedy, Dynamic Programming
655 Print Binary Tree Medium O(N) O(H) Tree
658 Find K Closest Elements Medium O(logN+K) O(K) Tree
662 Maximum Width of Binary Tree Medium O(N) O(N) Tree
673 Number of Longest Increasing Subsequence Medium O(N^2) O(N) Dynamic Programming
677 Map Sum Pairs Medium O(K) O(K) Trie
700 Search in a Binary Search Tree Easy O(H) O(1) Tree
701 Insert into a Binary Search Tree Medium O(H) O(1) Tree
702 Search in a Sorted Array of Unknown Size Medium O(logN) O(1) Binary Search, Premium πŸ”’
705 Design HashSet Easy Varies Varies Design HashSet
708 Insert into a Sorted Circular Linked List Medium O(N) O(1) Linked List, Premium πŸ”’
713 Subarray Product Less Than K Medium O(N) O(1) Array, Two Pointers
729 My Calendar I Medium O(NlogN) O(N) Tree
733 Flood Fill Easy O(N) O(N) Depth First Search
734 Sentence Similarity Easy O(N) O(N) Premium, Hash Table πŸ”’
735 Asteroid Collision Medium O(N) O(N) Stack
737 Sentence Similarity II Medium O(NlogP + P) or o(NP) O(N) Premium, DFS, Union Find πŸ”’
763 Partition Labels Medium O(N) O(N) Greedy, Two Pointers
767 Reorganize String Medium O(NlogN) O(N) String, Heap, Greedy, Sort
768 Max Chunks To Make Sorted II Hard O(N) O(N) Array
769 Max Chunks To Make Sorted Medium O(N) O(1) Array
787 Cheapest Flights Within K Stops Medium Complex Complex Dijkstra's Algorithm, Graph Quite hard
791 Custom Sort String Medium O(N) O(N) String
794 Valid Tic-Tac-Toe State Medium O(1) O(1) Array, String
797 All Paths From Source to Target Medium O(2^N * N) O(2^N * N) Backtracking, Depth First Search
799 Champagne Tower Medium O(R^2) O(R^2) Dynamic Programming
820 Short Encoding of Words Medium O(N*M) O(N*M) Trie
825 Friends Of Appropriate Ages Medium O(N) O(1) Array
830 Positions of Large Groups Easy O(N) O(1)
833 Find And Replace in String Medium O(N) O(N) String
835 Image Overlap Medium O(N^2) O(N)
838 Push Dominoes Medium O(N) O(N)
845 Longest Mountain in Array Medium O(N) O(1) Two Pointers
846 Hand of Straights Medium O(MlogM+NW) O(N) Ordered Map
849 Maximize Distance to Closest Person Medium O(N) O(1) Array
851 Loud and Rich Medium O(N^2) O(N^2) DFS
853 Car Fleet Medium O(NlogN) O(N) Sort
858 Mirror Reflection Medium O(logN) O(1) Math
859 Buddy Strings Easy O(N) O(1) String
875 Koko Eating Bananas Medium O(NlogN) O(1) Binary Search
886 Possible Bipartition Medium O(N + E) O(N + E) Depth First Search Good problem
901 Online Stock Span Medium O(1) O(N) Monotonic Stack
902 Numbers At Most N Given Digit Set Hard O(LogN) O(1) Math, Dynamic Programming
905 Sort Array By Parity Easy O(N) O(1) Array
918 Maximum Sum Circular Subarray Medium O(N) O(1) Array, Dynamic Programming
926 Flip String to Monotone Increasing Medium O(N) O(N) Array
930 Binary Subarrays With Sum Medium O(N) O(N) Hash Table, Two Pointers
933 Number of Recent Calls Easy O(1) O(1) Queue
935 Knight Dialer Medium O(N) O(1) Dynamic Programming
946 Validate Stack Sequences Medium O(N) O(N) Stack
948 Bag of Tokens Medium O(NlogN) O(N) Greedy
957 Prison Cells After N Days Medium O(1) O(1) Has Table
967 Numbers With Same Consecutive Differences Medium O(N*2^N) O(2^N) DFS
969 Pancake Sorting Medium O(N^2) O(N) Array
973 K Closest Points to Origin Medium O(N log(K)) O(K) Divide and Conquer, Heap, Sort
976 Largest Perimeter Triangle Medium O(NlogN) O(N) Math, Sort
979 Distribute Coins in Binary Tree Medium O(N) O(H) Tree, DFS
980 Unique Paths III Medium O(2^N) O(N) Backtracking, DFS
983 Minimum Cost For Tickets Medium O(365) O(365) LRU Cache, Dynamic Programming
986 Interval List Intersections Medium O(N + M) O(1) Two Pointers
987 Vertical Order Traversal of a Binary Tree Medium O(NlogN) O(N) Hash Table, Tree
993 Cousins in Binary Tree Easy O(N) O(H) Trees, Recursion
994 Rotting Oranges Medium O(N^2) O(N) Trees, Recursion
1004 Max Consecutive Ones III Medium O(N) O(1) Sliding Window, Two Pointers
1007 Minimum Domino Rotations For Equal Row Medium O(N) O(1) Array, Greedy
1015 Smallest Integer Divisible by K Medium O(K) O(K) Math
1022 Sum of Root To Leaf Binary Numbers Easy O(N) O(H) Tree
1026 Maximum Difference Between Node and Ancestor Medium O(N) O(H) Tree, DFS
1029 Two City Scheduling Easy O(NlogN) O(N) Greedy Good Problem
1032 Stream of Characters Hard O(M) O(M) Trie
1035 Uncrossed Lines Medium O(N^2) O(N) Array, Dynamic Programming
1060 Missing Element in Sorted Array Medium O(logN) O(1) Binary Search, Premium πŸ”’
1061 Lexicographically Smallest Equivalent String Medium O(N) O(N) DFS, Union Find, Premium πŸ”’
1094 Car Pooling Medium O(N) O(1) Car Pooling
1162 As Far from Land as Possible Medium O(N*M) O(N*M) Graph, BFS
1217 Minimum Cost to Move Chips to The Same Position Easy O(N) O(1) Math, Greedy, Array
1232 Check If It Is a Straight Line Easy O(N) O(1) Math, Pythonic, Geometry
1249 Minimum Remove to Make Valid Parentheses Medium O(N) O(N) Stack, String
1277 Count Square Submatrices with All Ones Medium O(N * M) O(1) Array, Dynamic Programming
1283 Find the Smallest Divisor Given a Threshold Medium O(NlogNmax) O(1) Binary Search
1288 Remove Covered Intervals Medium O(N) O(1) Greedy, Sort, Line Sweep
1290 Convert Binary Number in a Linked List to Integer Easy O(N) O(1) Linked List, Bit Manipulation
1291 Sequential Digits Medium O(N) O(N) Backtracking
1305 All Elements in Two Binary Search Trees Medium O(N) O(N) Sort, Tree
1344 Angle Between Hands of a Clock Medium O(1) O(1) Math
1375 Bulb Switcher III Medium O(N) O(1) Array
1426 Counting Elements Easy O(N) O(N) Array, Premium πŸ”’
1427 Perform String Shifts Easy O(N + S) O(1) πŸ”’
1441 Build an Array With Stack Operations Easy O(N) O(N) Pythonic
1442 Count Triplets That Can Form Two Arrays of Equal XOR Medium O(N) O(N) Array, Math, Bit Manipulation
1443 Minimum Time to Collect All Apples in a Tree Medium O(E) O(E) Tree, Depth First Search
1446 Consecutive Characters Easy O(N) O(1) String
1447 Simplified Fractions Medium Varying Varying
1448 Count Good Nodes in Binary Tree Medium O(N) O(H) Tree, Depth First Search
1450 Number of Students Doing Homework at a Given Time Easy O(N) O(1)
1451 Rearrange Words in a Sentence Medium O(N * logN) O(1) String, Sort
1452 People Whose List of Favorite Companies Is Not a Subset of Another List Medium O(N^2) O(N) String, Sort There is a better solution
1455 Check If a Word Occurs As a Prefix of Any Word in a Sentence Medium O(N) O(1) String, Pythonic
1456 Maximum Number of Vowels in a Substring of Given Length Medium O(N) O(1) String, Sliding Window
1457 Pseudo-Palindromic Paths in a Binary Tree Medium O(N) O(H) Bit Manipulation, Tree, Depth First Search
1460 Make Two Arrays Equal by Reversing Sub-arrays Easy O(N) O(1) Array
1464 Maximum Product of Two Elements in an Array Easy O(N) O(1) Array
1466 Reorder Routes to Make All Paths Lead to the City Zero Medium O(|V|) O(|V|) Tree, Depth First Search
1470 Shuffle the Array Easy O(N) O(N) Array There is a better solution
1471 The k Strongest Values in an Array Medium O(NlogN) O(N) Array, Sort There is a better solution
1472 Design Browser History Medium O(1) O(1) Design
1474 Delete N Nodes After M Nodes of a Linked List Easy O(N) O(1) Linked List, Premium πŸ”’
1475 Final Prices With a Special Discount in a Shop Easy O(N) O(1) Monotonic Stack
1476 Subrectangle Queries Easy Varies Varies Design
1480 Running Sum of 1d Array Easy O(N) O(1)
1481 Least Number of Unique Integers after K Removals Medium O(NlogN) O(N) Array, Sort
1482 Minimum Number of Days to Make m Bouquets Medium O(NlogN) O(N) Array, Binary Search
1486 XOR Operation in an Array Easy O(1) O(1) Bit Manipulation
1491 Average Salary Excluding the Minimum and Maximum Salary Easy O(N) O(1)
1492 The kth Factor of n Medium O(logN) O(logN) Math, Tricky
1493 Longest Subarray of 1's After Deleting One Element Medium O(N) O(1) Array
1496 Path Crossing Easy O(N) O(N) String
1502 Can Make Arithmetic Progression From Sequence Easy O(NlogN) O(1) Array
1507 Reformat Date Easy O(1) O(1) String
1508 Range Sum of Sorted Subarray Sums Medium O(N^2logN) O(N^2)
1509 Minimum Difference Between Largest and Smallest Value in Three Moves Medium O(NlogN) O(1)
1510 Stone Game IV Hard O(N*N^0.5) O(N) Dynamic Programming
1512 Number of Good Pairs Easy O(N) O(N)
1513 Number of Substrings With Only 1s Medium O(N) O(N) String, Math
1518 Water Bottles Easy O(1) O(1) Greedy, Simulation
1523 Count Odd Numbers in an Interval Range Easy O(1) O(1) Math
1524 Number of Sub-arrays With Odd Sum Medium O(N) O(1) Array, Math, Dynamic Programming
1525 Number of Good Ways to Split a String Medium O(N) O(N) String
1528 Shuffle String Easy O(N) O(N) String
1529 Bulb Switcher IV Medium O(N) O(1) String
1530 Number of Good Leaf Nodes Pairs Medium O(N^2logN) O(N) Tree, Depth First Search
1533 Find the Index of the Large Integer Medium O(logN) O(1) Premium, Binary Search πŸ”’
1535 Find the Winner of an Array Game Medium O(N) O(1) Array
1539 Kth Missing Positive Number Easy O(logN) O(1) Binary Search
1544 Make The String Great Easy O(N) O(N) String, Stack
1545 Find Kth Bit in Nth Binary String Medium O(N^2) O(N^2) String Not Optimal
1550 Three Consecutive Odds Easy O(N) O(1) Array
1551 Minimum Operations to Make Array Equal Medium O(1) O(1) Math
1552 Magnetic Force Between Two Balls Medium O(NlogN) O(1) Binary Search Template for Binary Search
1556 Thousand Separator Easy O(N) O(N) String
1557 Minimum Number of Vertices to Reach All Nodes Medium O(N) O(N) Graph
1558 Minimum Numbers of Function Calls to Make Target Array Medium O(NlogK) O(N) Greedy, Simulation
1560 Most Visited Sector in a Circular Track Easy O(N) O(1) Array
1561 Maximum Number of Coins You Can Get Medium O(N) O(1) Sort
1564 Put Boxes Into the Warehouse I Medium O(NlogN) O(N) Greedy πŸ”’
1566 Detect Pattern of Length M Repeated K or More Times Easy O(N) O(1) Array
1572 Matrix Diagonal Sum Easy O(N) O(1) Array
1573 Number of Ways to Split a String Medium O(N) O(N) String
1576 Replace All ?'s to Avoid Consecutive Repeating Characters Easy O(N) O(N) String
1578 Minimum Deletion Cost to Avoid Repeating Letters Medium O(N) O(1) Greedy
1580 Put Boxes Into the Warehouse II Medium O(NlogN) O(N) Greedy πŸ”’
1582 Special Positions in a Binary Matrix Easy O(N) O(N) Array
1583 Count Unhappy Friends Medium O(N^2) O(N^2) Array
1588 Sum of All Odd Length Subarrays Easy O(N) O(1) Array
1592 Rearrange Spaces Between Words Easy O(N) O(N) String
1598 Crawler Log Folder Easy O(N) O(1) Stack
1600 Throne Inheritance Medium O(N) O(N) Tree, Design
1602 Find Nearest Right Node in Binary Tree Medium O(N) O(N) Premium, Tree, BFS πŸ”’
1604 Alert Using Same Key-Card Three or More Times in a One Hour Period Medium O(NlogN) O(N) String, Ordered Map
1605 Find Valid Matrix Given Row and Column Sums Medium O(NM) O(NM) Greedy
1608 Special Array With X Elements Greater Than or Equal X Easy O(NlogN) O(N) Binary Search, Array
1609 Even Odd Tree Easy O(N) O(N) Tree
1614 Maximum Nesting Depth of the Parentheses Easy O(N) O(1) String
1615 Maximal Network Rank Medium O(N) O(1) Graph
1618 Maximum Font to Fit a Sentence in a Screen Medium O(logN) O(1) Premium, String, Binary Search πŸ”’
1624 Largest Substring Between Two Equal Characters Easy O(N) O(1) String
1629 Slowest Key Easy O(N) O(1) String
1634 Add Two Polynomials Represented as Linked Lists Medium O(N) O(1) Premium, Linked List πŸ”’
1639 Number of Ways to Form a Target String Given a Dictionary Hard O(N*M) O(N*M) Dynamic Programming
1640 Check Array Formation Through Concatenation Medium O(N) O(N) Array
1641 Count Sorted Vowel Strings Medium O(N) O(1) Dynamic Programming, Math, Backtracking
1642 Furthest Building You Can Reach Medium O(NlogN) O(N) Binary Search, Heap
1644 Lowest Common Ancestor of a Binary Tree II Medium O(N) O(H) Premium, Tree πŸ”’
1646 Get Maximum in Generated Array Easy O(N) O(N) Array
1647 Minimum Deletions to Make Character Frequencies Unique Medium O(1) O(1) Greedy, Sort
1650 Lowest Common Ancestor of a Binary Tree III Medium O(H) O(1) Premium, Tree πŸ”’
1652 Defuse the Bomb Medium O(N) O(N) Array

For premium problems, question description are available as screenshots here

My profile:

https://leetcode.com/jummyegg/

Posts:

Dynamic Programming:

Others:

About

This list contains solutions to most questions I have solved on LeetCode

Topics

Resources

Stars

Watchers

Forks

Languages