Skip to content

caramelthunder/leetcodeBlind75

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

339 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LeetCode Blind 75 Questions and More

By Thinh Nguyen

Tree | Binary Tree | Depth-First Search | Breadth-First Search | Binary Search | Array | Dynamic Programming | Stack | Design | Two Pointers | Greedy | Math | Bit Manipulation | Hash Table | Heap (Priority Queue) | Graph | Topological Sort | String | Sliding Window | Linked List | Recursion | Backtracking | Sorting | Union Find | Minimum Spanning Tree | Trie | Prefix Sum | Divide and Conquer | Grid | Binary Search Tree | Queue | Counting | Sort | Easy | Medium | Hard |


Blind 75

LC# Problem Level Python Solution(s) Unittest
1 Two Sum Easy Solution Test
3 Longest Substring Without Repeating Characters Medium Solution Test
4 Median of Two Sorted Arrays Hard Sol 1, Sol 2, Sol 3 Test
5 Longest Palindromic Substring Medium Sol 1, Sol 2 Test
7 Reverse Interger Medium Solution Test
8 String to Integer (atoi) Medium Solution Test
11 Container With Most Water Medium Solution Test
14 Longest Common Prefix Easy Sol 1, Sol 2 Test
15 3Sum Medium Sol 1, Sol 2 Test
17 Letter Combinations of a Phone Number Medium Sol 1, Sol 2 Test
19 Remove Nth Node From End of List Medium Sol 1, Sol 2 Test
20 Valid Parentheses Easy Solution Test
21 Merge Two Sorted Lists Easy Sol 1, Sol 2 Test
23 Merge k Sorted Lists Hard Sol 1, Sol 2 Test
29 Divide Two Integers Medium Sol 1, Sol 2 Test
33 Search in Rotated Sorted Array Medium Solution Test
34 Find First and Last Position of Element in Sorted Array Medium Solution Test
39 Combination Sum Medium Sol 1, Sol 2 Test
42 Trapping Rain Water Hard Sol 1, Sol 2, Sol 3 Test
46 Permutations Medium Sol 1, Sol 2 Test
53 Maximum Subarray Medium Solution Test
54 Spiral Matrix Medium Solution Test
56 Merge Intervals Medium Solution Test
57 Insert Interval Medium Solution Test
62 Unique Paths Medium Sol 1, Sol 2 Test
67 Add Binary Easy Solution Test
70 Climbing Stairs Medium Sol 1, Sol 2, Sol 3 Test
72 Edit Distance Hard Sol 1, Sol 2 Test
75 Sort Colors Medium Solution Test
76 Minimum Window Substring Hard Solution Test
78 Subsets Medium Sol 1, Sol 2 Test
79 Word Search Medium Sol 1, Sol 2, Sol 3 Test
84 Largest Rectangle in Histogram Hard Solution Test
98 Validate Binary Search Tree Medium Sol 1, Sol 2, Sol 3 Test
102 Binary Tree Level Order Traversal Medium Sol 1, Sol 2 Test
104 Maximum Depth of Binary Tree Easy Solution Test
105 Construct Binary Tree from Preorder and Inorder Traversal Medium Sol 1, Sol 2 Test
110 Balanced Binary Tree Easy Solution Test
121 Best Time to Buy and Sell Stock Easy Solution Test
125 Valid Palindrome Easy Solution Test
127 Word Ladder Hard Solution Test
133 Clone Graph Medium Sol 1, Sol 2 Test
139 Word Break Medium Sol 1, Sol 2 Test
141 Linked List Cycle Easy Solution Test
146 LRU Cache Medium Solution Test
150 Evaluate Reverse Polish Notation Medium Solution Test
155 Min Stack Medium Sol 1, Sol 2, Sol 3 Test
169 Majority Element Easy Solution Test
199 Binary Tree Right Side View Medium Sol 1, Sol 2 Test
200 Number of Islands Medium Sol 1, Sol 2, Sol 3 Test
202 Happy Number Easy Sol 1, Sol 2 Test
206 Reverse Linked List Easy Sol 1, Sol 2 Test
207 Course Schedule Medium Sol 1, Sol 2 Test
208 Implement Trie (Prefix Tree) Medium Solution Test
217 Contains Duplicate Easy Solution Test
224 Basic Calculator Hard Sol 1, Sol 2, Sol 3 Test
226 Invert Binary Tree Easy Sol 1, Sol 2 Test
230 Kth Smallest Element in a BST Medium Sol 1, Sol 2 Test
232 Implement Queue using Stacks Easy Solution Test
234 Palindrome Linked List Easy Sol 1, Sol 2 Test
235 Lowest Common Ancestor of a Binary Search Tree Medium Sol 1, Sol 2 Test
236 Lowest Common Ancestor of a Binary Tree Medium Sol 1, Sol 2 Test
238 Product of Array Except Self Medium Sol 1, Sol 2 Test
242 Valid Anagram Easy Solution Test
247 Strobogrammatic Number II Medium Solution Test
252 Meeting Rooms Easy Solution Test
263 Ugly Number Easy Solution Test
264 Ugly Number II Medium Sol 1, Sol 2 Test
266 Palindrome Permutation Easy Solution Test
268 Missing Number Easy Sol 1, Sol 2, Sol 3 Test
269 Alien Dictionary Hard Sol 1, Sol 2 Test
270 Closest Binary Search Tree Value Easy Sol 1, Sol 2 Test
277 Find the Celebrity Medium Solution Test
278 First Bad Version Easy Solution Test
279 Perfect Squares Medium Sol 1, Sol 2, Sol 3 Test
295 Find Median from Data Stream Hard Solution Test
297 Serialize and Deserialize Binary Tree Hard Solution Test
298 Binary Tree Longest Consecutive Sequence Medium Solution Test
300 Longest Increasing Subsequence Medium Sol 1, Sol 2, Sol 3 Test
310 Minimum Height Trees Medium Sol 1, Sol 2 Test
312 Burst Balloons Hard Sol 1, Sol 2, Sol 3 Test
322 Coin Change Medium Sol 1, Sol 2, Sol 3 Test
348 Design Tic-Tac-Toe Medium Solution Test
368 Largest Divisible Subset Medium Sol 1, Sol 2 Test
383 Ransom Note Easy Solution Test
409 Longest Palindrome Easy Solution Test
416 Partition Equal Subset Sum Medium Sol 1, Sol 2, Sol 3 Test
422 Valid Word Square Easy Solution Test
438 Find All Anagrams in a String Medium Solution Test
439 Ternary Expression Parser Medium Solution Test
456 132 Pattern Medium Sol 1, Sol 2 Test
487 Max Consecutive Ones II Medium Sol 1, Sol 2 Test
490 The Maze Medium Sol 1, Sol 2 Test
496 Next Greater Element I Easy Solution Test
518 Coin Change II Medium Sol 1, Sol 2, Sol 3 Test
542 01 Matrix Medium Sol 1, Sol 2 Test
543 Diameter of Binary Tree Easy Solution Test
556 Next Greater Element III Medium Solution Test
560 Subarray Sum Equals K Medium Solution Test
583 Delete Operation for Two Strings Medium Sol 1, Sol 2 Test
588 Design In-Memory File System Hard Sol 1, Sol 2, Sol 3 Test
621 Task Scheduler Medium Solution Test
704 Binary Search Easy Solution Test
712 Minimum ASCII Delete Sum for Two Strings Medium Sol 1, Sol 2 Test
721 Accounts Merge Medium Sol 1, Sol 2, Sol 3 Test
733 Flood Fill Easy Sol 1, Sol 2 Test
876 Middle of the Linked List Easy Solution Test
877 Stone Game Medium Solution Test
973 K Closest Points to Origin Medium Sol 1, Sol 2 Test
981 Time Based Key-Value Store Medium Solution Test
994 Rotting Oranges Medium Solution Test
1029 Two City Scheduling Medium Solution Test
1056 Confusing Number Easy Solution Test
1135 Connecting Cities With Minimum Cost Medium Sol 1, Sol 2 Test
1143 Longest Common Subsequence Medium Sol 1, Sol 2 Test
1155 Number of Dice Rolls With Target Sum Medium Sol 1, Sol 2 Test
1228 Missing Number In Arithmetic Progression Easy Sol 1, Sol 2 Test
1235 Maximum Profit in Job Scheduling Hard Sol 1, Sol 2, Sol 3 Test
1396 Design Underground System Medium Sol 1, Sol 2 Test
1429 First Unique Number Medium Sol 1, Sol 2 Test
1466 Reorder Routes to Make All Paths Lead to the City Zero Medium Sol 1, Sol 2 Test
1474 Delete N Nodes After M Nodes of a Linked List Easy Solution Test
1490 Clone N-ary Tree Medium Sol 1, Sol 2 Test
1537 Get The Maximum Score Hard Solution Test
2050 Parallel Courses III Hard Sol 1, Sol 2 Test

Easy

LC# Problem Level Python Solution(s) Unittest
1 Two Sum Easy Solution Test
14 Longest Common Prefix Easy Sol 1, Sol 2 Test
20 Valid Parentheses Easy Solution Test
21 Merge Two Sorted Lists Easy Sol 1, Sol 2 Test
67 Add Binary Easy Solution Test
104 Maximum Depth of Binary Tree Easy Solution Test
110 Balanced Binary Tree Easy Solution Test
121 Best Time to Buy and Sell Stock Easy Solution Test
125 Valid Palindrome Easy Solution Test
141 Linked List Cycle Easy Solution Test
169 Majority Element Easy Solution Test
202 Happy Number Easy Sol 1, Sol 2 Test
206 Reverse Linked List Easy Sol 1, Sol 2 Test
217 Contains Duplicate Easy Solution Test
226 Invert Binary Tree Easy Sol 1, Sol 2 Test
232 Implement Queue using Stacks Easy Solution Test
234 Palindrome Linked List Easy Sol 1, Sol 2 Test
242 Valid Anagram Easy Solution Test
252 Meeting Rooms Easy Solution Test
263 Ugly Number Easy Solution Test
266 Palindrome Permutation Easy Solution Test
268 Missing Number Easy Sol 1, Sol 2, Sol 3 Test
270 Closest Binary Search Tree Value Easy Sol 1, Sol 2 Test
278 First Bad Version Easy Solution Test
383 Ransom Note Easy Solution Test
409 Longest Palindrome Easy Solution Test
422 Valid Word Square Easy Solution Test
496 Next Greater Element I Easy Solution Test
543 Diameter of Binary Tree Easy Solution Test
704 Binary Search Easy Solution Test
733 Flood Fill Easy Sol 1, Sol 2 Test
876 Middle of the Linked List Easy Solution Test
1056 Confusing Number Easy Solution Test
1228 Missing Number In Arithmetic Progression Easy Sol 1, Sol 2 Test
1474 Delete N Nodes After M Nodes of a Linked List Easy Solution Test

Medium

LC# Problem Level Python Solution(s) Unittest
3 Longest Substring Without Repeating Characters Medium Solution Test
5 Longest Palindromic Substring Medium Sol 1, Sol 2 Test
7 Reverse Interger Medium Solution Test
8 String to Integer (atoi) Medium Solution Test
11 Container With Most Water Medium Solution Test
15 3Sum Medium Sol 1, Sol 2 Test
17 Letter Combinations of a Phone Number Medium Sol 1, Sol 2 Test
19 Remove Nth Node From End of List Medium Sol 1, Sol 2 Test
29 Divide Two Integers Medium Sol 1, Sol 2 Test
33 Search in Rotated Sorted Array Medium Solution Test
34 Find First and Last Position of Element in Sorted Array Medium Solution Test
39 Combination Sum Medium Sol 1, Sol 2 Test
46 Permutations Medium Sol 1, Sol 2 Test
53 Maximum Subarray Medium Solution Test
54 Spiral Matrix Medium Solution Test
56 Merge Intervals Medium Solution Test
57 Insert Interval Medium Solution Test
62 Unique Paths Medium Sol 1, Sol 2 Test
70 Climbing Stairs Medium Sol 1, Sol 2, Sol 3 Test
75 Sort Colors Medium Solution Test
78 Subsets Medium Sol 1, Sol 2 Test
79 Word Search Medium Sol 1, Sol 2, Sol 3 Test
98 Validate Binary Search Tree Medium Sol 1, Sol 2, Sol 3 Test
102 Binary Tree Level Order Traversal Medium Sol 1, Sol 2 Test
105 Construct Binary Tree from Preorder and Inorder Traversal Medium Sol 1, Sol 2 Test
133 Clone Graph Medium Sol 1, Sol 2 Test
139 Word Break Medium Sol 1, Sol 2 Test
146 LRU Cache Medium Solution Test
150 Evaluate Reverse Polish Notation Medium Solution Test
155 Min Stack Medium Sol 1, Sol 2, Sol 3 Test
199 Binary Tree Right Side View Medium Sol 1, Sol 2 Test
200 Number of Islands Medium Sol 1, Sol 2, Sol 3 Test
207 Course Schedule Medium Sol 1, Sol 2 Test
208 Implement Trie (Prefix Tree) Medium Solution Test
230 Kth Smallest Element in a BST Medium Sol 1, Sol 2 Test
235 Lowest Common Ancestor of a Binary Search Tree Medium Sol 1, Sol 2 Test
236 Lowest Common Ancestor of a Binary Tree Medium Sol 1, Sol 2 Test
238 Product of Array Except Self Medium Sol 1, Sol 2 Test
247 Strobogrammatic Number II Medium Solution Test
264 Ugly Number II Medium Sol 1, Sol 2 Test
277 Find the Celebrity Medium Solution Test
279 Perfect Squares Medium Sol 1, Sol 2, Sol 3 Test
298 Binary Tree Longest Consecutive Sequence Medium Solution Test
300 Longest Increasing Subsequence Medium Sol 1, Sol 2, Sol 3 Test
310 Minimum Height Trees Medium Sol 1, Sol 2 Test
322 Coin Change Medium Sol 1, Sol 2, Sol 3 Test
348 Design Tic-Tac-Toe Medium Solution Test
368 Largest Divisible Subset Medium Sol 1, Sol 2 Test
416 Partition Equal Subset Sum Medium Sol 1, Sol 2, Sol 3 Test
438 Find All Anagrams in a String Medium Solution Test
439 Ternary Expression Parser Medium Solution Test
456 132 Pattern Medium Sol 1, Sol 2 Test
487 Max Consecutive Ones II Medium Sol 1, Sol 2 Test
490 The Maze Medium Sol 1, Sol 2 Test
518 Coin Change II Medium Sol 1, Sol 2, Sol 3 Test
542 01 Matrix Medium Sol 1, Sol 2 Test
556 Next Greater Element III Medium Solution Test
560 Subarray Sum Equals K Medium Solution Test
583 Delete Operation for Two Strings Medium Sol 1, Sol 2 Test
621 Task Scheduler Medium Solution Test
712 Minimum ASCII Delete Sum for Two Strings Medium Sol 1, Sol 2 Test
721 Accounts Merge Medium Sol 1, Sol 2, Sol 3 Test
877 Stone Game Medium Solution Test
973 K Closest Points to Origin Medium Sol 1, Sol 2 Test
981 Time Based Key-Value Store Medium Solution Test
994 Rotting Oranges Medium Solution Test
1029 Two City Scheduling Medium Solution Test
1135 Connecting Cities With Minimum Cost Medium Sol 1, Sol 2 Test
1143 Longest Common Subsequence Medium Sol 1, Sol 2 Test
1155 Number of Dice Rolls With Target Sum Medium Sol 1, Sol 2 Test
1396 Design Underground System Medium Sol 1, Sol 2 Test
1429 First Unique Number Medium Sol 1, Sol 2 Test
1466 Reorder Routes to Make All Paths Lead to the City Zero Medium Sol 1, Sol 2 Test
1490 Clone N-ary Tree Medium Sol 1, Sol 2 Test

Hard

LC# Problem Level Python Solution(s) Unittest
4 Median of Two Sorted Arrays Hard Sol 1, Sol 2, Sol 3 Test
23 Merge k Sorted Lists Hard Sol 1, Sol 2 Test
42 Trapping Rain Water Hard Sol 1, Sol 2, Sol 3 Test
72 Edit Distance Hard Sol 1, Sol 2 Test
76 Minimum Window Substring Hard Solution Test
84 Largest Rectangle in Histogram Hard Solution Test
127 Word Ladder Hard Solution Test
224 Basic Calculator Hard Sol 1, Sol 2, Sol 3 Test
269 Alien Dictionary Hard Sol 1, Sol 2 Test
295 Find Median from Data Stream Hard Solution Test
297 Serialize and Deserialize Binary Tree Hard Solution Test
312 Burst Balloons Hard Sol 1, Sol 2, Sol 3 Test
588 Design In-Memory File System Hard Sol 1, Sol 2, Sol 3 Test
1235 Maximum Profit in Job Scheduling Hard Sol 1, Sol 2, Sol 3 Test
1537 Get The Maximum Score Hard Solution Test
2050 Parallel Courses III Hard Sol 1, Sol 2 Test

Tree

LC# Problem Level Python Solution(s) Unittest
104 Maximum Depth of Binary Tree Easy Solution Test
110 Balanced Binary Tree Easy Solution Test
226 Invert Binary Tree Easy Sol 1, Sol 2 Test
543 Diameter of Binary Tree Easy Solution Test
98 Validate Binary Search Tree Medium Sol 1, Sol 2, Sol 3 Test
102 Binary Tree Level Order Traversal Medium Sol 1, Sol 2 Test
105 Construct Binary Tree from Preorder and Inorder Traversal Medium Sol 1, Sol 2 Test
199 Binary Tree Right Side View Medium Sol 1, Sol 2 Test
230 Kth Smallest Element in a BST Medium Sol 1, Sol 2 Test
235 Lowest Common Ancestor of a Binary Search Tree Medium Sol 1, Sol 2 Test
236 Lowest Common Ancestor of a Binary Tree Medium Sol 1, Sol 2 Test
1490 Clone N-ary Tree Medium Sol 1, Sol 2 Test
297 Serialize and Deserialize Binary Tree Hard Solution Test

Binary Tree

LC# Problem Level Python Solution(s) Unittest
104 Maximum Depth of Binary Tree Easy Solution Test
110 Balanced Binary Tree Easy Solution Test
226 Invert Binary Tree Easy Sol 1, Sol 2 Test
543 Diameter of Binary Tree Easy Solution Test
98 Validate Binary Search Tree Medium Sol 1, Sol 2, Sol 3 Test
102 Binary Tree Level Order Traversal Medium Sol 1, Sol 2 Test
105 Construct Binary Tree from Preorder and Inorder Traversal Medium Sol 1, Sol 2 Test
199 Binary Tree Right Side View Medium Sol 1, Sol 2 Test
230 Kth Smallest Element in a BST Medium Sol 1, Sol 2 Test
235 Lowest Common Ancestor of a Binary Search Tree Medium Sol 1, Sol 2 Test
236 Lowest Common Ancestor of a Binary Tree Medium Sol 1, Sol 2 Test
298 Binary Tree Longest Consecutive Sequence Medium Solution Test
297 Serialize and Deserialize Binary Tree Hard Solution Test

Depth-First Search

LC# Problem Level Python Solution(s) Unittest
104 Maximum Depth of Binary Tree Easy Solution Test
110 Balanced Binary Tree Easy Solution Test
226 Invert Binary Tree Easy Sol 1, Sol 2 Test
270 Closest Binary Search Tree Value Easy Sol 1, Sol 2 Test
543 Diameter of Binary Tree Easy Solution Test
733 Flood Fill Easy Sol 1, Sol 2 Test
79 Word Search Medium Sol 1, Sol 2, Sol 3 Test
98 Validate Binary Search Tree Medium Sol 1, Sol 2, Sol 3 Test
102 Binary Tree Level Order Traversal Medium Sol 1, Sol 2 Test
133 Clone Graph Medium Sol 1, Sol 2 Test
199 Binary Tree Right Side View Medium Sol 1, Sol 2 Test
200 Number of Islands Medium Sol 1, Sol 2, Sol 3 Test
207 Course Schedule Medium Sol 1, Sol 2 Test
230 Kth Smallest Element in a BST Medium Sol 1, Sol 2 Test
235 Lowest Common Ancestor of a Binary Search Tree Medium Sol 1, Sol 2 Test
236 Lowest Common Ancestor of a Binary Tree Medium Sol 1, Sol 2 Test
298 Binary Tree Longest Consecutive Sequence Medium Solution Test
490 The Maze Medium Sol 1, Sol 2 Test
721 Accounts Merge Medium Sol 1, Sol 2, Sol 3 Test
1466 Reorder Routes to Make All Paths Lead to the City Zero Medium Sol 1, Sol 2 Test
1490 Clone N-ary Tree Medium Sol 1, Sol 2 Test
297 Serialize and Deserialize Binary Tree Hard Solution Test

Breadth-First Search

LC# Problem Level Python Solution(s) Unittest
226 Invert Binary Tree Easy Sol 1, Sol 2 Test
733 Flood Fill Easy Sol 1, Sol 2 Test
102 Binary Tree Level Order Traversal Medium Sol 1, Sol 2 Test
133 Clone Graph Medium Sol 1, Sol 2 Test
199 Binary Tree Right Side View Medium Sol 1, Sol 2 Test
200 Number of Islands Medium Sol 1, Sol 2, Sol 3 Test
235 Lowest Common Ancestor of a Binary Search Tree Medium Sol 1, Sol 2 Test
279 Perfect Squares Medium Sol 1, Sol 2, Sol 3 Test
310 Minimum Height Trees Medium Sol 1, Sol 2 Test
322 Coin Change Medium Sol 1, Sol 2, Sol 3 Test
490 The Maze Medium Sol 1, Sol 2 Test
542 01 Matrix Medium Sol 1, Sol 2 Test
721 Accounts Merge Medium Sol 1, Sol 2, Sol 3 Test
994 Rotting Oranges Medium Solution Test
1466 Reorder Routes to Make All Paths Lead to the City Zero Medium Sol 1, Sol 2 Test
1490 Clone N-ary Tree Medium Sol 1, Sol 2 Test
127 Word Ladder Hard Solution Test
269 Alien Dictionary Hard Sol 1, Sol 2 Test
297 Serialize and Deserialize Binary Tree Hard Solution Test

Binary Search

LC# Problem Level Python Solution(s) Unittest
278 First Bad Version Easy Solution Test
704 Binary Search Easy Solution Test
1228 Missing Number In Arithmetic Progression Easy Sol 1, Sol 2 Test
33 Search in Rotated Sorted Array Medium Solution Test
34 Find First and Last Position of Element in Sorted Array Medium Solution Test
300 Longest Increasing Subsequence Medium Sol 1, Sol 2, Sol 3 Test
981 Time Based Key-Value Store Medium Solution Test
4 Median of Two Sorted Arrays Hard Sol 1, Sol 2, Sol 3 Test
1235 Maximum Profit in Job Scheduling Hard Sol 1, Sol 2, Sol 3 Test

Array

LC# Problem Level Python Solution(s) Unittest
1 Two Sum Easy Solution Test
121 Best Time to Buy and Sell Stock Easy Solution Test
169 Majority Element Easy Solution Test
217 Contains Duplicate Easy Solution Test
252 Meeting Rooms Easy Solution Test
268 Missing Number Easy Sol 1, Sol 2, Sol 3 Test
704 Binary Search Easy Solution Test
1228 Missing Number In Arithmetic Progression Easy Sol 1, Sol 2 Test
3 Longest Substring Without Repeating Characters Medium Solution Test
11 Container With Most Water Medium Solution Test
15 3Sum Medium Sol 1, Sol 2 Test
33 Search in Rotated Sorted Array Medium Solution Test
34 Find First and Last Position of Element in Sorted Array Medium Solution Test
39 Combination Sum Medium Sol 1, Sol 2 Test
46 Permutations Medium Sol 1, Sol 2 Test
53 Maximum Subarray Medium Solution Test
56 Merge Intervals Medium Solution Test
57 Insert Interval Medium Solution Test
75 Sort Colors Medium Solution Test
78 Subsets Medium Sol 1, Sol 2 Test
150 Evaluate Reverse Polish Notation Medium Solution Test
238 Product of Array Except Self Medium Sol 1, Sol 2 Test
300 Longest Increasing Subsequence Medium Sol 1, Sol 2, Sol 3 Test
368 Largest Divisible Subset Medium Sol 1, Sol 2 Test
416 Partition Equal Subset Sum Medium Sol 1, Sol 2, Sol 3 Test
456 132 Pattern Medium Sol 1, Sol 2 Test
487 Max Consecutive Ones II Medium Sol 1, Sol 2 Test
556 Next Greater Element III Medium Solution Test
560 Subarray Sum Equals K Medium Solution Test
1029 Two City Scheduling Medium Solution Test
4 Median of Two Sorted Arrays Hard Sol 1, Sol 2, Sol 3 Test
42 Trapping Rain Water Hard Sol 1, Sol 2, Sol 3 Test
84 Largest Rectangle in Histogram Hard Solution Test
1537 Get The Maximum Score Hard Solution Test

Dynamic Programming

LC# Problem Level Python Solution(s) Unittest
121 Best Time to Buy and Sell Stock Easy Solution Test
53 Maximum Subarray Medium Solution Test
62 Unique Paths Medium Sol 1, Sol 2 Test
70 Climbing Stairs Medium Sol 1, Sol 2, Sol 3 Test
139 Word Break Medium Sol 1, Sol 2 Test
264 Ugly Number II Medium Sol 1, Sol 2 Test
279 Perfect Squares Medium Sol 1, Sol 2, Sol 3 Test
300 Longest Increasing Subsequence Medium Sol 1, Sol 2, Sol 3 Test
322 Coin Change Medium Sol 1, Sol 2, Sol 3 Test
368 Largest Divisible Subset Medium Sol 1, Sol 2 Test
416 Partition Equal Subset Sum Medium Sol 1, Sol 2, Sol 3 Test
487 Max Consecutive Ones II Medium Sol 1, Sol 2 Test
518 Coin Change II Medium Sol 1, Sol 2, Sol 3 Test
542 01 Matrix Medium Sol 1, Sol 2 Test
583 Delete Operation for Two Strings Medium Sol 1, Sol 2 Test
712 Minimum ASCII Delete Sum for Two Strings Medium Sol 1, Sol 2 Test
877 Stone Game Medium Solution Test
1143 Longest Common Subsequence Medium Sol 1, Sol 2 Test
1155 Number of Dice Rolls With Target Sum Medium Sol 1, Sol 2 Test
42 Trapping Rain Water Hard Sol 1, Sol 2, Sol 3 Test
72 Edit Distance Hard Sol 1, Sol 2 Test
312 Burst Balloons Hard Sol 1, Sol 2, Sol 3 Test
1235 Maximum Profit in Job Scheduling Hard Sol 1, Sol 2, Sol 3 Test
2050 Parallel Courses III Hard Sol 1, Sol 2 Test

Stack

LC# Problem Level Python Solution(s) Unittest
20 Valid Parentheses Easy Solution Test
232 Implement Queue using Stacks Easy Solution Test
496 Next Greater Element I Easy Solution Test
150 Evaluate Reverse Polish Notation Medium Solution Test
155 Min Stack Medium Sol 1, Sol 2, Sol 3 Test
439 Ternary Expression Parser Medium Solution Test
456 132 Pattern Medium Sol 1, Sol 2 Test
42 Trapping Rain Water Hard Sol 1, Sol 2, Sol 3 Test
84 Largest Rectangle in Histogram Hard Solution Test
224 Basic Calculator Hard Sol 1, Sol 2, Sol 3 Test

Design

LC# Problem Level Python Solution(s) Unittest
232 Implement Queue using Stacks Easy Solution Test
146 LRU Cache Medium Solution Test
155 Min Stack Medium Sol 1, Sol 2, Sol 3 Test
208 Implement Trie (Prefix Tree) Medium Solution Test
348 Design Tic-Tac-Toe Medium Solution Test
981 Time Based Key-Value Store Medium Solution Test
1396 Design Underground System Medium Sol 1, Sol 2 Test
1429 First Unique Number Medium Sol 1, Sol 2 Test
295 Find Median from Data Stream Hard Solution Test
297 Serialize and Deserialize Binary Tree Hard Solution Test
588 Design In-Memory File System Hard Sol 1, Sol 2, Sol 3 Test

Two Pointers

LC# Problem Level Python Solution(s) Unittest
125 Valid Palindrome Easy Solution Test
141 Linked List Cycle Easy Solution Test
202 Happy Number Easy Sol 1, Sol 2 Test
234 Palindrome Linked List Easy Sol 1, Sol 2 Test
876 Middle of the Linked List Easy Solution Test
11 Container With Most Water Medium Solution Test
15 3Sum Medium Sol 1, Sol 2 Test
19 Remove Nth Node From End of List Medium Sol 1, Sol 2 Test
75 Sort Colors Medium Solution Test
556 Next Greater Element III Medium Solution Test
42 Trapping Rain Water Hard Sol 1, Sol 2, Sol 3 Test
1537 Get The Maximum Score Hard Solution Test

Greedy

LC# Problem Level Python Solution(s) Unittest
409 Longest Palindrome Easy Solution Test
11 Container With Most Water Medium Solution Test
277 Find the Celebrity Medium Solution Test
621 Task Scheduler Medium Solution Test
1029 Two City Scheduling Medium Solution Test
1537 Get The Maximum Score Hard Solution Test

Math

LC# Problem Level Python Solution(s) Unittest
67 Add Binary Easy Solution Test
202 Happy Number Easy Sol 1, Sol 2 Test
263 Ugly Number Easy Solution Test
268 Missing Number Easy Sol 1, Sol 2, Sol 3 Test
422 Valid Word Square Easy Solution Test
1056 Confusing Number Easy Solution Test
1228 Missing Number In Arithmetic Progression Easy Sol 1, Sol 2 Test
7 Reverse Interger Medium Solution Test
29 Divide Two Integers Medium Sol 1, Sol 2 Test
70 Climbing Stairs Medium Sol 1, Sol 2, Sol 3 Test
877 Stone Game Medium Solution Test
224 Basic Calculator Hard Sol 1, Sol 2, Sol 3 Test

Bit Manipulation

LC# Problem Level Python Solution(s) Unittest
67 Add Binary Easy Solution Test
29 Divide Two Integers Medium Sol 1, Sol 2 Test

Hash Table

LC# Problem Level Python Solution(s) Unittest
1 Two Sum Easy Solution Test
141 Linked List Cycle Easy Solution Test
202 Happy Number Easy Sol 1, Sol 2 Test
217 Contains Duplicate Easy Solution Test
242 Valid Anagram Easy Solution Test
266 Palindrome Permutation Easy Solution Test
268 Missing Number Easy Sol 1, Sol 2, Sol 3 Test
383 Ransom Note Easy Solution Test
409 Longest Palindrome Easy Solution Test
496 Next Greater Element I Easy Solution Test
1056 Confusing Number Easy Solution Test
3 Longest Substring Without Repeating Characters Medium Solution Test
15 3Sum Medium Sol 1, Sol 2 Test
133 Clone Graph Medium Sol 1, Sol 2 Test
208 Implement Trie (Prefix Tree) Medium Solution Test
438 Find All Anagrams in a String Medium Solution Test
560 Subarray Sum Equals K Medium Solution Test
621 Task Scheduler Medium Solution Test
981 Time Based Key-Value Store Medium Solution Test
1396 Design Underground System Medium Sol 1, Sol 2 Test
1429 First Unique Number Medium Sol 1, Sol 2 Test
76 Minimum Window Substring Hard Solution Test
127 Word Ladder Hard Solution Test

Heap (Priority Queue)

LC# Problem Level Python Solution(s) Unittest
264 Ugly Number II Medium Sol 1, Sol 2 Test
621 Task Scheduler Medium Solution Test
973 K Closest Points to Origin Medium Sol 1, Sol 2 Test
1135 Connecting Cities With Minimum Cost Medium Sol 1, Sol 2 Test
23 Merge k Sorted Lists Hard Sol 1, Sol 2 Test
295 Find Median from Data Stream Hard Solution Test

Graph

LC# Problem Level Python Solution(s) Unittest
733 Flood Fill Easy Sol 1, Sol 2 Test
200 Number of Islands Medium Sol 1, Sol 2, Sol 3 Test
207 Course Schedule Medium Sol 1, Sol 2 Test
277 Find the Celebrity Medium Solution Test
310 Minimum Height Trees Medium Sol 1, Sol 2 Test
490 The Maze Medium Sol 1, Sol 2 Test
721 Accounts Merge Medium Sol 1, Sol 2, Sol 3 Test
994 Rotting Oranges Medium Solution Test
1135 Connecting Cities With Minimum Cost Medium Sol 1, Sol 2 Test
1466 Reorder Routes to Make All Paths Lead to the City Zero Medium Sol 1, Sol 2 Test
127 Word Ladder Hard Solution Test
269 Alien Dictionary Hard Sol 1, Sol 2 Test
2050 Parallel Courses III Hard Sol 1, Sol 2 Test

Topological Sort

LC# Problem Level Python Solution(s) Unittest
207 Course Schedule Medium Sol 1, Sol 2 Test
310 Minimum Height Trees Medium Sol 1, Sol 2 Test
269 Alien Dictionary Hard Sol 1, Sol 2 Test
2050 Parallel Courses III Hard Sol 1, Sol 2 Test

String

LC# Problem Level Python Solution(s) Unittest
14 Longest Common Prefix Easy Sol 1, Sol 2 Test
20 Valid Parentheses Easy Solution Test
67 Add Binary Easy Solution Test
125 Valid Palindrome Easy Solution Test
242 Valid Anagram Easy Solution Test
266 Palindrome Permutation Easy Solution Test
383 Ransom Note Easy Solution Test
409 Longest Palindrome Easy Solution Test
5 Longest Palindromic Substring Medium Sol 1, Sol 2 Test
8 String to Integer (atoi) Medium Solution Test
139 Word Break Medium Sol 1, Sol 2 Test
208 Implement Trie (Prefix Tree) Medium Solution Test
247 Strobogrammatic Number II Medium Solution Test
438 Find All Anagrams in a String Medium Solution Test
439 Ternary Expression Parser Medium Solution Test
556 Next Greater Element III Medium Solution Test
76 Minimum Window Substring Hard Solution Test
224 Basic Calculator Hard Sol 1, Sol 2, Sol 3 Test

Sliding Window

LC# Problem Level Python Solution(s) Unittest
438 Find All Anagrams in a String Medium Solution Test
487 Max Consecutive Ones II Medium Sol 1, Sol 2 Test
76 Minimum Window Substring Hard Solution Test

Linked List

LC# Problem Level Python Solution(s) Unittest
21 Merge Two Sorted Lists Easy Sol 1, Sol 2 Test
141 Linked List Cycle Easy Solution Test
206 Reverse Linked List Easy Sol 1, Sol 2 Test
234 Palindrome Linked List Easy Sol 1, Sol 2 Test
876 Middle of the Linked List Easy Solution Test
1474 Delete N Nodes After M Nodes of a Linked List Easy Solution Test
19 Remove Nth Node From End of List Medium Sol 1, Sol 2 Test
146 LRU Cache Medium Solution Test
1429 First Unique Number Medium Sol 1, Sol 2 Test
23 Merge k Sorted Lists Hard Sol 1, Sol 2 Test

Recursion

LC# Problem Level Python Solution(s) Unittest
21 Merge Two Sorted Lists Easy Sol 1, Sol 2 Test
206 Reverse Linked List Easy Sol 1, Sol 2 Test
270 Closest Binary Search Tree Value Easy Sol 1, Sol 2 Test
236 Lowest Common Ancestor of a Binary Tree Medium Sol 1, Sol 2 Test
247 Strobogrammatic Number II Medium Solution Test

Backtracking

LC# Problem Level Python Solution(s) Unittest
17 Letter Combinations of a Phone Number Medium Sol 1, Sol 2 Test
39 Combination Sum Medium Sol 1, Sol 2 Test
46 Permutations Medium Sol 1, Sol 2 Test
78 Subsets Medium Sol 1, Sol 2 Test
79 Word Search Medium Sol 1, Sol 2, Sol 3 Test
490 The Maze Medium Sol 1, Sol 2 Test

Sorting

LC# Problem Level Python Solution(s) Unittest
268 Missing Number Easy Sol 1, Sol 2, Sol 3 Test
56 Merge Intervals Medium Solution Test
75 Sort Colors Medium Solution Test
368 Largest Divisible Subset Medium Sol 1, Sol 2 Test
973 K Closest Points to Origin Medium Sol 1, Sol 2 Test
1029 Two City Scheduling Medium Solution Test
1135 Connecting Cities With Minimum Cost Medium Sol 1, Sol 2 Test
23 Merge k Sorted Lists Hard Sol 1, Sol 2 Test
1235 Maximum Profit in Job Scheduling Hard Sol 1, Sol 2, Sol 3 Test

Union Find

LC# Problem Level Python Solution(s) Unittest
200 Number of Islands Medium Sol 1, Sol 2, Sol 3 Test
721 Accounts Merge Medium Sol 1, Sol 2, Sol 3 Test
1135 Connecting Cities With Minimum Cost Medium Sol 1, Sol 2 Test

Minimum Spanning Tree

LC# Problem Level Python Solution(s) Unittest
1135 Connecting Cities With Minimum Cost Medium Sol 1, Sol 2 Test

Trie

LC# Problem Level Python Solution(s) Unittest
14 Longest Common Prefix Easy Sol 1, Sol 2 Test
208 Implement Trie (Prefix Tree) Medium Solution Test
588 Design In-Memory File System Hard Sol 1, Sol 2, Sol 3 Test

Prefix Sum

LC# Problem Level Python Solution(s) Unittest
238 Product of Array Except Self Medium Sol 1, Sol 2 Test
487 Max Consecutive Ones II Medium Sol 1, Sol 2 Test
560 Subarray Sum Equals K Medium Solution Test
1537 Get The Maximum Score Hard Solution Test

Divide and Conquer

LC# Problem Level Python Solution(s) Unittest
105 Construct Binary Tree from Preorder and Inorder Traversal Medium Sol 1, Sol 2 Test
4 Median of Two Sorted Arrays Hard Sol 1, Sol 2, Sol 3 Test
23 Merge k Sorted Lists Hard Sol 1, Sol 2 Test

Grid

LC# Problem Level Python Solution(s) Unittest
422 Valid Word Square Easy Solution Test
733 Flood Fill Easy Sol 1, Sol 2 Test
54 Spiral Matrix Medium Solution Test
62 Unique Paths Medium Sol 1, Sol 2 Test
79 Word Search Medium Sol 1, Sol 2, Sol 3 Test
200 Number of Islands Medium Sol 1, Sol 2, Sol 3 Test
348 Design Tic-Tac-Toe Medium Solution Test
490 The Maze Medium Sol 1, Sol 2 Test
542 01 Matrix Medium Sol 1, Sol 2 Test
994 Rotting Oranges Medium Solution Test

Binary Search Tree

LC# Problem Level Python Solution(s) Unittest
270 Closest Binary Search Tree Value Easy Sol 1, Sol 2 Test
98 Validate Binary Search Tree Medium Sol 1, Sol 2, Sol 3 Test
230 Kth Smallest Element in a BST Medium Sol 1, Sol 2 Test

Queue

LC# Problem Level Python Solution(s) Unittest
232 Implement Queue using Stacks Easy Solution Test
1429 First Unique Number Medium Sol 1, Sol 2 Test

Counting

LC# Problem Level Python Solution(s) Unittest
169 Majority Element Easy Solution Test

Sort

LC# Problem Level Python Solution(s) Unittest
252 Meeting Rooms Easy Solution Test

How to run _unittest.py

Each solved problem have a unittest/ folder.

To locate the Python test script, click on the test link of the problem.

To run the test script, add the below code and Run the _unittest.py:

        if __name__ == '__main__':
            unittest.main()

You can also add more test cases by appending to the class Test(unittest.TestCase):

For example:

        def test_your_test_case(self):
            input_nums = [3,3]
            target = 6
            expected_output = {0,1}

            output = set(self.s.twoSum(input_nums, target))
            self.assertEqual(output, expected_output)

Note:

Each problem is already equipped with helpers functions to execute the test cases without additional dependencies. Please follow the format of the existing test cases when creating your own.

Happy coding :)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages