This repository is created by an awkward programmer who always struggles with coding problems on LeetCode, even with some Easy questions.
How on earth can I ever think of a solution like that in an interview?!
I'm working on implementing common Algorithms and Data Structures in Python (with test cases, of course), as well as straightforward solutions to some problems from LeetCode and HackerRank which I solved with frustration in mind.
Well, there are SO MUCH things to learn in Computer Science. I'm just a peasant who happens to write some crappy code for living.
This project requires Python 3.6 or higher.
A list of companies (or teams) that don't do "whiteboard" interviews.
- Discussing a real world problem (with or without whiteboard) is ๐
- Solving CS trivia, technical puzzles, riddles, brainteasers (with or without whiteboard) is ๐
- Algorithms
- Searching
- Sorting
- Data Structures
- Array
- Linked List
- Stack
- Queue
- HashMap
- Set
- Tree
- Heap
- B-tree
- Graph
- Coding Problems
- Array
- [Easy] Missing Number on LeetCode
- [Easy] Shuffle the Array on LeetCode
- [Medium] Container With Most Water on LeetCode
- [Medium] Find Minimum in Rotated Sorted Array on LeetCode
- [Medium] Find the Duplicate Number on LeetCode
- [Medium] Merge Intervals on LeetCode
- [Medium] Product of Array Except Self on LeetCode
- Linked List
- [Easy] Reverse Linked List on LeetCode
- [Medium] Add Two Numbers on LeetCode
- [Medium] Remove Nth Node From End of List on LeetCode
- Stack
- [Easy] Maximum Element on HackerRank
- [Easy] Min Stack on LeetCode
- [Easy] Valid Parentheses on LeetCode
- [Medium] Simple Text Editor on HackerRank
- String
- [Easy] CamelCase on HackerRank
- [Easy] HackerRank in a String on HackerRank
- [Easy] Implement strStr() on LeetCode
- [Easy] Repeated String on HackerRank
- [Easy] Reverse Integer on LeetCode
- [Easy] Reverse String on LeetCode
- [Easy] Valid Anagram on LeetCode
- [Medium] Group Anagrams on LeetCode
- HashMap
- Set
- [Easy] Contains Duplicate on LeetCode
- Multiset
- [Easy] Equalize the Array on HackerRank
- [Easy] Hash Tables: Ransom Note on HackerRank
- [Easy] Single Number on LeetCode
- [Easy] Sock Merchant on HackerRank
- [Medium] Top K Frequent Elements on LeetCode
- Heap
- [Easy] Merge Two Sorted Lists on LeetCode
- [Easy] Third Maximum Number on LeetCode
- [Medium] Kth Largest Element in an Array on LeetCode
- [Medium] Task Scheduler on LeetCode
- [Hard] Median of Two Sorted Arrays on LeetCode
- [Hard] Merge k Sorted Lists on LeetCode
- Binary Tree
- [Easy] Balanced Binary Tree on LeetCode
- [Easy] Find Mode in Binary Search Tree on LeetCode
- [Easy] Invert Binary Tree on LeetCode
- [Easy] Maximum Depth of Binary Tree on LeetCode
- [Easy] Minimum Depth of Binary Tree on LeetCode
- [Easy] Path Sum on LeetCode
- [Easy] Same Tree on LeetCode
- [Easy] Search in a Binary Search Tree on LeetCode
- [Easy] Tree: Height of a Binary Tree on HackerRank
- [Easy] Tree: Top View on HackerRank
- [Easy] Univalued Binary Tree on LeetCode
- [Medium] Binary Search Tree Iterator on LeetCode
- [Medium] Binary Tree Inorder Traversal on LeetCode
- [Medium] Binary Tree Level Order Traversal on LeetCode
- [Medium] Binary Tree Postorder Traversal on LeetCode
- [Medium] Binary Tree Preorder Traversal on LeetCode
- [Medium] Check Completeness of a Binary Tree on LeetCode
- [Medium] Kth Smallest Element in a BST on LeetCode
- [Medium] Validate Binary Search Tree on LeetCode
- [Hard] Binary Tree Maximum Path Sum on LeetCode
- [Hard] Serialize and Deserialize Binary Tree on LeetCode
- Trie
- [Medium] Implement Trie (Prefix Tree) on LeetCode
- Graph
- [Medium] Clone Graph on LeetCode
- [Medium] Course Schedule on LeetCode
- [Medium] Prim's (MST): Special Subtree on HackerRank
- [Medium] Kruskal's (MST): Really Special Subtree on HackerRank
- [Hard] BFS: Shortest Reach in a Graph on HackerRank
- [Hard] Dijkstra: Shortest Reach 2 on HackerRank
- Sorting
- [Medium] Sort Colors on LeetCode
- [Medium] Sort List on LeetCode
- Two Pointers
- [Easy] Best Time to Buy and Sell Stock on LeetCode
- [Easy] Linked List Cycle on LeetCode
- [Easy] Middle of the Linked List on LeetCode
- [Easy] Two Sum II - Input array is sorted on LeetCode
- [Easy] Valid Palindrome on LeetCode
- [Medium] Search in Rotated Sorted Array on LeetCode
- Reverse Only Alphabetical on AlgoDaily
- Bit Manipulation
- [Easy] Power of Two on LeetCode
- Backtracking
- [Easy] Two Characters on HackerRank
- [Medium] Combinations on LeetCode
- [Medium] Permutations on LeetCode
- [Medium] Subsets on LeetCode
- Dynamic Programming
- [Easy] Is Subsequence on LeetCode
- [Easy] Maximum Subarray on LeetCode
- [Medium] Coin Change on LeetCode
- [Medium] Maximum Product Subarray on LeetCode
- [Hard] Trapping Rain Water on LeetCode
- Uncategorized
- [Easy] Fibonacci Number on LeetCode
- [Easy] Fizz Buzz on LeetCode
- Array
- Networking
$ poetry install
$ poetry run pytest --benchmark-skip
If you don't use poetry, there is also a classic requirements-dev.txt
file.
If you find any bug or incorrect implementation in this repo, please let me know by opening an issue or pull request. Me and my cats would appreciate your help since they provide some random strings which are used in two of test cases.