forked fromkamyu104/LeetCode-Solutions
- Notifications
You must be signed in to change notification settings - Fork0
(Weekly Update) Python / Modern C++ Solutions of All 1745 LeetCode Problems
License
NotificationsYou must be signed in to change notification settings
pythonmjs/LeetCode-Solutions
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
- R.I.P. to my old Leetcode repository, where there were
5.7k+stars and2.2k+forks (ever the top 3 in the field). - Since free questions may be even mistakenly taken down by some companies, only solutions will be post on now.
- There are new LeetCode questions every week. I'll keep updating for full summary and better solutions.
- For more problem solutions, you can see myLintCode,GoogleKickStart repository.
- For more challenging problem solutions, you can also see myGoogleCodeJam,FacebookHackerCup repositories.
- Hope you enjoy the journey of learning data structures and algorithms.
- Notes: "🔒" means your subscription ofLeetCode premium membership is required for reading the question.
- Bit Manipulation
- Array
- String
- Linked List
- Stack
- Queue
- Binary Heap
- Tree
- Hash Table
- Math
- Two Pointers
- Sort
- Recursion
- Binary Search
- Binary Search Tree
- Breadth-First Search
- Depth-First Search
- Backtracking
- Dynamic Programming
- Greedy
- Graph
- Geometry
- Simulation
- Design
- Concurrency
- C++
- Python
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| 0239 | Sliding Window Maximum | C++Python | O(n) | O(k) | Hard | EPI, LintCode | Mono Deque |
| 0281 | Zigzag Iterator | C++Python | O(n) | O(k) | Medium | 🔒 | |
| 0346 | Moving Average from Data Stream | C++Python | O(1) | O(w) | Easy | 🔒 | |
| 0933 | Number of Recent Calls | C++Python | O(1) on average | O(w) | Easy | ||
| 1424 | Diagonal Traverse II | C++Python | O(m * n) | O(m) | Medium | ||
| 1438 | Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit | C++Python | O(n) | O(n) | Hard | Mono Deque | |
| 1499 | Max Value of Equation | C++Python | O(n) | O(n) | Hard | Mono Deque | |
| 1696 | Jump Game VI | C++Python | O(n) | O(k) | Medium | Mono Deque, Sliding Window |
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| 0220 | Contains Duplicate III | C++Python | O(nlogk) | O(k) | Medium | ||
| 0230 | Kth Smallest Element in a BST | C++Python | O(max(h, k)) | O(min(h, k)) | Medium | ||
| 0235 | Lowest Common Ancestor of a Binary Search Tree | C++Python | O(h) | O(1) | Easy | EPI | |
| 0270 | Closest Binary Search Tree Value | C++Python | O(h) | O(1) | Easy | 🔒 | |
| 0285 | Inorder Successor in BST | C++Python | O(h) | O(1) | Medium | 🔒 | |
| 0352 | Data Stream as Disjoint Intervals | C++Python | O(logn) | O(n) | Hard | ||
| 0449 | Serialize and Deserialize BST | C++Python | O(n) | O(h) | Medium | ||
| 0450 | Delete Node in a BST | C++Python | O(h) | O(h) | Medium | ||
| 0530 | Minimum Absolute Difference in BST | C++Python | O(n) | O(h) | Easy | ||
| 0776 | Split BST | C++Python | O(n) | O(h) | Medium | 🔒 | |
| 0783 | Minimum Distance Between BST Nodes | C++Python | O(n) | O(h) | Easy | ||
| 0510 | Inorder Successor in BST II | C++Python | O(h) | O(1) | Medium | 🔒 | |
| 1373 | Maximum Sum BST in Binary Tree | C++Python | O(n) | O(h) | Hard | DFS, Stack | |
| 1382 | Balance a Binary Search Tree | C++Python | O(n) | O(h) | Medium | DFS, Stack |
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| 0102 | Binary Tree Level Order Traversal | C++Python | O(n) | O(n) | Easy | ||
| 0107 | Binary Tree Level Order Traversal II | C++Python | O(n) | O(n) | Easy | ||
| 0103 | Binary Tree Zigzag Level Order Traversal | Python | O(n) | O(n) | Medium | ||
| 0117 | Populating Next Right Pointers in Each Node II | Python | O(n) | O(1) | Hard | ||
| 0127 | Word Ladder | C++Python | O(b^(d/2)) | O(w * l) | Medium | CTCI | Bi-BFS |
| 0130 | Surrounded Regions | C++Python | O(m * n) | O(m + n) | Medium | ||
| 0133 | Clone Graph | Python | O(n) | O(n) | Medium | ||
| 0207 | Course Schedule | C++Python | O(|V| + |E|) | O(|E|) | Medium | Topological Sort | |
| 0210 | Course Schedule II | C++Python | O(|V| + |E|) | O(|E|) | Medium | Topological Sort | |
| 0261 | Graph Valid Tree | C++Python | O(|V| + |E|) | O(|V| + |E|) | Medium | 🔒 | |
| 0269 | Alien Dictionary | C++Python | O(n) | O(1) | Hard | 🔒 | Topological Sort, BFS, DFS |
| 0286 | Walls and Gates | C++Python | O(m * n) | O(g) | Medium | 🔒 | |
| 0310 | Minimum Height Trees | C++Python | O(n) | O(n) | Medium | ||
| 0317 | Shortest Distance from All Buildings | C++Python | O(k * m * n) | O(m * n) | Hard | 🔒 | |
| 0433 | Minimum Genetic Mutation | C++Python | O(n * b) | O(b) | Medium | ||
| 0444 | Sequence Reconstruction | C++Python | O(n * s) | O(n) | Medium | 🔒 | Topological Sort |
| 0490 | The Maze | C++Python | O(max(r, c) * w) | O(w) | Medium | ||
| 0499 | The Maze III | C++Python | O(max(r, c) * wlogw) | O(w^2) | Hard | ||
| 0505 | The Maze II | C++Python | O(max(r, c) * wlogw) | O(w) | Medium | ||
| 0542 | 01 Matrix | C++Python | O(m * n) | O(1) | Medium | DP | |
| 0666 | Path Sum IV | C++Python | O(n) | O(w) | Medium | 🔒 | Topological Sort |
| 0675 | Cut Off Trees for Golf Event | C++Python | O(t * m * n) | O(m * n) | Hard | A* Search Algorithm | |
| 0742 | Closest Leaf in a Binary Tree | C++Python | O(n) | O(n) | Medium | ||
| 0743 | Network Delay Time | C++Python | O(|E| * log|V|) | O(|E|) | Medium | Dijkstra's Algorithm | |
| 0752 | Open the Lock | C++Python | O(k * n^k + d) | O(k * n^k + d) | Medium | ||
| 0773 | Sliding Puzzle | C++Python | O((m * n) * (m * n)!) | O((m * n) * (m * n)!) | Hard | A* Search Algorithm | |
| 0787 | Cheapest Flights Within K Stops | C++Python | O(|E| * log|V|) | O(|E|) | Medium | Dijkstra's Algorithm | |
| 0815 | Bus Routes | C++Python | O(|E| + |V|) | O(|E| + |V|) | Hard | ||
| 0854 | K-Similar Strings | C++Python | O(n * n!/(c_a!*...*c_z!)) | O(n * n!/(c_a!*...*c_z!)) | Hard | ||
| 0865 | Shortest Path to Get All Keys | C++Python | O(k * r * c + k^3*2^k) | O(k*2^k) | Hard | Dijkstra's Algorithm | |
| 0882 | Reachable Nodes In Subdivided Graph | C++Python | O(|E| * log|V|) | O(|E|) | Hard | Dijkstra's Algorithm | |
| 0886 | Possible Bipartition | C++Python | O(|V| + |E|) | O(|V| + |E|) | Medium | ||
| 0913 | Cat and Mouse | C++Python | O(n^3) | O(n^2) | Hard | MiniMax, Topological Sort | |
| 0934 | Shortest Bridge | C++Python | O(n^2) | O(n^2) | Medium | BFS, DFS | |
| 0967 | Numbers With Same Consecutive Differences | C++Python | O(2^n) | O(2^n) | Medium | ||
| 0994 | Rotting Oranges | C++Python | O(m * n) | O(m * n) | Easy | ||
| 1034 | Coloring A Border | C++Python | O(m * n) | O(m + n) | Medium | ||
| 1036 | Escape a Large Maze | C++Python | O(n^2) | O(n) | Hard | ||
| 1091 | Shortest Path in Binary Matrix | C++Python | O(n^2) | O(n) | Medium | ||
| 1102 | Path With Maximum Minimum Value | C++Python | O((m * n) * log(m * n)) | O(m * n) | Medium | 🔒 | Binary Search, DFS,Dijkstra's Algorithm |
| 1129 | Shortest Path with Alternating Colors | C++Python | O(n + e) | O(n + e) | Medium | ||
| 1136 | Parallel Courses | C++Python | O(|V| + |E|) | O(|E|) | Hard | 🔒 | Topological Sort |
| 1161 | Maximum Level Sum of a Binary Tree | C++Python | O(n) | O(w) | Medium | DFS | |
| 1162 | As Far from Land as Possible | C++Python | O(m * n) | O(m * n) | Medium | ||
| 1203 | Sort Items by Groups Respecting Dependencies | C++Python | O(n + e) | O(n + e) | Hard | Topological Sort | |
| 1210 | Minimum Moves to Reach Target with Rotations | C++Python | O(n) | O(n) | Hard | ||
| 1215 | Stepping Numbers | C++Python | O(logk + r) | O(k) | Medium | 🔒 | Precompute, Binary Search |
| 1245 | Tree Diameter | C++Python | O(|V| + |E|) | O(|E|) | Medium | ||
| 1263 | Minimum Moves to Move a Box to Their Target Location | C++Python | O(m^2 * n^2) | O(m^2 * n^2) | Hard | A* Search Algorithm | |
| 1284 | Minimum Number of Flips to Convert Binary Matrix to Zero Matrix | C++Python | O((m * n) * 2^(m * n)) | O((m * n) * 2^(m * n)) | Hard | ||
| 1291 | Sequential Digits | C++Python | O(1) | O(1) | Medium | ||
| 1293 | Shortest Path in a Grid with Obstacles Elimination | C++Python | O(m * n * k) | O(m * n) | Hard | A* Search Algorithm | |
| 1298 | Maximum Candies You Can Get from Boxes | C++Python | O(n^2) | O(n) | Hard | ||
| 1302 | Deepest Leaves Sum | C++Python | O(n) | O(w) | Medium | ||
| 1306 | Jump Game III | C++Python | O(n) | O(n) | Medium | ||
| 1311 | Get Watched Videos by Your Friends | C++Python | O(n + vlogv) | O(w) | Medium | ||
| 1345 | Jump Game IV | C++Python | O(n) | O(n) | Hard | ||
| 1368 | Minimum Cost to Make at Least One Valid Path in a Grid | C++Python | O(m * n) | O(m * n) | Hard | A* Search Algorithm, 0-1 BFS, Deque | |
| 1514 | Path with Maximum Probability | C++Python | O(|E| * log|V|) | O(|E|) | Medium | Dijkstra's Algorithm | |
| 1602 | Find Nearest Right Node in Binary Tree | C++Python | O(n) | O(w) | Medium | 🔒 | |
| 1609 | Even Odd Tree | C++Python | O(n) | O(w) | Medium | ||
| 1625 | Lexicographically Smallest String After Applying Operations | C++Python | O(n^2) | O(1) | Medium | BFS, String | |
| 1654 | Minimum Jumps to Reach Home | C++Python | O(max(x, max(forbidden)) + a + b) | O(max(x, max(forbidden)) + a + b) | Medium | BFS | |
| 1660 | Correct a Binary Tree | C++Python | O(n) | O(w) | Medium | 🔒 | BFS |
| 1728 | Cat and Mouse II | C++Python | O((m * n)^2 * (m + n)) | O((m * n)^2) | Hard | variant ofCat and Mouse | MiniMax, Topological Sort |
| 1730 | Shortest Path to Get Food | C++Python | O(m * n) | O(m + n) | Medium | 🔒 | BFS |
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| 0017 | Letter Combinations of a Phone Number | C++Python | O(n * 4^n) | O(1) | Medium | ||
| 0022 | Generate Parentheses | C++Python | O(4^n / n^(3/2)) | O(n) | Medium | ||
| 0037 | Sudoku Solver | Python | O((9!)^9) | O(1) | Hard | ||
| 0039 | Combination Sum | Python | O(k * n^k) | O(k) | Medium | ||
| 0040 | Combination Sum II | Python | O(k * C(n, k)) | O(k) | Medium | ||
| 0046 | Permutations | Python | O(n * n!) | O(n) | Medium | ||
| 0047 | Permutations II | Python | O(n * n!) | O(n) | Medium | ||
| 0051 | N-Queens | Python | O(n!) | O(n) | Hard | ||
| 0052 | N-Queens-II | Python | O(n!) | O(n) | Hard | ||
| 0077 | Combinations | C++Python | O(O(k * C(n, k))) | O(k) | Medium | ||
| 0079 | Word Search | C++Python | O(m * n * 3^l) | O(l) | Medium | ||
| 0093 | Restore IP Addresses | Python | O(1) | O(1) | Medium | ||
| 0078 | Subsets | C++Python | O(n * 2^n) | O(1) | Medium | ||
| 0090 | Subsets II | C++Python | O(n * 2^n) | O(1) | Medium | ||
| 0126 | Word Ladder II | C++Python | O(b^(d/2)) | O(w * l) | Hard | CTCI | Bi-BFS |
| 0131 | Palindrome Partitioning | Python | O(n^2) ~O(2^n) | O(n^2) | Medium | ||
| 0140 | Word Break II | C++Python | O(n * l^2 + n * r) | O(n^2) | Hard | ||
| 0212 | Word Search II | C++Python | O(m * n * 3^h) | O(t) | Hard | LintCode | Trie, DFS |
| 0216 | Combination Sum III | C++Python | O(k * C(n, k)) | O(k) | Medium | ||
| 0254 | Factor Combinations | C++Python | O(nlogn) | O(logn) | Medium | 🔒 | |
| 0267 | Palindrome Permutation II | C++Python | O(n * n!) | O(n) | Medium | 🔒 | |
| 0291 | Word Pattern II | C++Python | O(n * C(n - 1, c - 1)) | O(n + c) | Hard | 🔒 | |
| 0294 | Flip Game II | C++Python | O(n + c^2) | O(c) | Medium | 🔒 | DP, Hash |
| 0320 | Generalized Abbreviation | C++Python | O(n * 2^n) | O(n) | Medium | 🔒 | |
| 0425 | Word Squares | C++Python | O(n^2 * n!) | O(n^2) | Hard | 🔒 | |
| 0526 | Beautiful Arrangement | C++Python | O(n!) | O(n) | Medium | ||
| 0676 | Implement Magic Dictionary | C++Python | O(n) | O(d) | Medium | Trie, DFS | |
| 0679 | 24 Game | C++Python | O(1) | O(1) | Hard | DFS | |
| 0698 | Partition to K Equal Sum Subsets | C++Python | O(n * 2^n) | O(2^n) | Medium | DFS, DP, Memoization | |
| 0718 | Maximum Length of Repeated Subarray | C++Python | O(m * n) | O(min(m, n)) | Medium | DP, Hash, Binary Search | |
| 0784 | Letter Case Permutation | C++Python | O(n * 2^n) | O(1) | Easy | ||
| 0996 | Number of Squareful Arrays | C++Python | O(n!) | O(n^2) | Hard | ||
| 1087 | Brace Expansion | C++Python | O(p * l * log(p * l)) | O(p * l) | Medium | 🔒 | |
| 1096 | Brace Expansion II | C++Python | O(p * l * log(p * l)) | O(p * l) | Hard | ||
| 1219 | Path with Maximum Gold | C++Python | O(m^2 * n^2) | O(m * n) | Medium | ||
| 1240 | Tiling a Rectangle with the Fewest Squares | C++Python | O(n^2 * m^2 * m^(n * m)) | O(n * m) | Hard | ||
| 1255 | Maximum Score Words Formed by Letters | C++Python | O(n * 2^n) | O(n) | Hard | ||
| 1258 | Synonymous Sentences | C++Python | O(p * l * log(p * l)) | O(p * l) | Medium | Union Find | |
| 1307 | Verbal Arithmetic Puzzle | C++Python | O(10! * n * l) | O(n * l) | Hard | ||
| 1379 | Find a Corresponding Node of a Binary Tree in a Clone of That Tree | C++Python | O(n) | O(h) | Medium | Stack | |
| 1593 | Split a String Into the Max Number of Unique Substrings | C++Python | O(n * 2^(n - 1)) | O(n) | Medium | ||
| 1659 | Maximize Grid Happiness | C++Python | O(C(m * n, i) * C(m * n - i, e)) | O(min(m * n, i + e)) | Hard | Pruning | |
| 1718 | Construct the Lexicographically Largest Valid Sequence | C++Python | O(n!) | O(b) | Medium | Backtracking | |
| 1723 | Find Minimum Time to Finish All Jobs | C++Python | O(k^n * logr) | O(n + k) | Hard | Backtracking, Pruning, Binary Search |
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| 0587 | Erect the Fence | C++Python | O(nlogn) | O(n) | Hard | Convex Hull,Monotone Chain | |
| 0892 | Surface Area of 3D Shapes | C++Python | O(n^2) | O(1) | Easy | ||
| 1453 | Maximum Number of Darts Inside of a Circular Dartboard | C++Python | O(n^2 * logn) | O(n) | Hard | Line Sweep | |
| 1515 | Best Position for a Service Centre | C++Python | O(n * iter) | O(n) | Hard | Geometric Median, Gradient Descent, Weiszfeld's Algorithm | |
| 1610 | Maximum Number of Visible Points | C++Python | O(nlogn) | O(n) | Hard | Two Pointers, Sliding Window |
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| 0874 | Walking Robot Simulation | C++Python | O(n + k) | O(k) | Easy | ||
| 1138 | Alphabet Board Path | C++Python | O(n) | O(1) | Medium | ||
| 1243 | Array Transformation | C++Python | O(n^2) | O(n) | Easy |
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| 0146 | LRU Cache | C++Python | O(1) | O(k) | Hard | OrderedDict | |
| 0225 | Implement Stack using Queues | C++Python | push:O(n), pop:O(1), top:O(1) | O(n) | Easy | ||
| 0173 | Binary Search Tree Iterator | C++Python | O(1), amortized | O(h) | Medium | ||
| 0284 | Peeking Iterator | C++Python | O(1) | O(1) | Medium | ||
| 0348 | Design Tic-Tac-Toe | C++Python | O(1) | O(n^2) | Medium | 🔒 | |
| 0353 | Design Snake Game | C++Python | O(1) | O(s) | Medium | 🔒 | Deque |
| 0355 | Design Twitter | C++Python | O(klogu) | O(t + f) | Medium | LintCode | Heap |
| 0359 | Logger Rate Limiter | C++Python | O(1), amortized | O(k) | Easy | 🔒 | Deque |
| 0362 | Design Hit Counter | C++Python | O(1), amortized | O(k) | Medium | 🔒 | Deque |
| 0379 | Design Phone Directory | C++Python | O(1) | O(n) | Medium | 🔒 | |
| 0380 | Insert Delete GetRandom O(1) | C++Python | O(1) | O(n) | Hard | ||
| 0381 | Insert Delete GetRandom O(1) - Duplicates allowed | C++Python | O(1) | O(n) | Hard | ||
| 0432 | All O`one Data Structure | C++Python | O(1) | O(n) | Hard | ||
| 0460 | LFU Cache | C++Python | O(1) | O(k) | Hard | ||
| 0489 | Robot Room Cleaner | C++Python | O(n) | O(n) | Hard | 🔒 | |
| 0535 | Encode and Decode TinyURL | C++Python | O(1) | O(n) | Medium | ||
| 0588 | Design In-Memory File System | C++Python | ls:O(l + klogk) mkdir:O(l) addContentToFile:O(l + c) readContentFromFile:O(l + c) | O(n + s) | Hard | 🔒 | |
| 0604 | Design Compressed String Iterator | C++Python | O(1) | O(1) | Easy | 🔒 | |
| 0631 | Design Excel Sum Formula | C++Python | set:O((r * c)^2) get:O(1) sum:O((r * c)^2) | O(r * c) | Hard | 🔒 | |
| 0635 | Design Log Storage System | C++Python | put:O(1) retrieve:O(n + dlogd) | O(n) | Medium | 🔒 | |
| 0642 | Design Search Autocomplete System | C++Python | O(p^2) | O(p * t + s) | Hard | 🔒 | |
| 0715 | Range Module | C++Python | add:O(n) remove:O(n) query:O(logn) | O(n) | Hard | ||
| 0716 | Max Stack | C++Python | push:O(logn) pop:O(logn) popMax:O(logn) top:O(1) peekMax:O(1) | O(n) | Easy | ||
| 0745 | Prefix and Suffix Search | C++Python | ctor:O(w * l^2) search :O(p + s) | O(t) | Hard | Trie | |
| 0900 | RLE Iterator | C++Python | O(n) | O(1) | Medium | ||
| 1146 | Snapshot Array | C++Python | set:O(1) get:O(logn) | O(n) | Medium | ||
| 1166 | Design File System | C++Python | create:O(n) get:O(n) | O(n) | Medium | 🔒 | |
| 1172 | Dinner Plate Stacks | C++Python | push:O(logn) pop:O(1), amortized popAtStack:(logn) | O(n * c) | Hard | ||
| 1206 | Design Skiplist | C++Python | O(logn), on average | O(n) | Hard | ||
| 1236 | Web Crawler | C++Python | O(|V| + |E|) | O(|V|) | Medium | 🔒 | BFS, DFS |
| 1244 | Design A Leaderboard | C++Python | ctor:O(1) add:O(1) top:O(n) reset:O(1) | O(n) | Medium | ||
| 1268 | Search Suggestions System | C++Python | ctor:O(n * l) suggest:O(l^2) | O(t) | Medium | Trie | |
| 1286 | Iterator for Combination | C++Python | O(k) | O(k) | Medium | Stack | |
| 1348 | Tweet Counts Per Frequency | C++Python | add:O(logn) query:O(c) | O(n) | Medium | ||
| 1352 | Product of the Last K Numbers | C++Python | ctor:O(1) add:O(1) get:O(1) | O(n) | Medium | ||
| 1357 | Apply Discount Every n Orders | C++Python | ctor:O(m) getBill:O(p) | O(m) | Medium | ||
| 1381 | Design a Stack With Increment Operation | C++Python | ctor:O(1) push:O(1) pop:O(1) increment:O(1) | O(n) | Medium | ||
| 1396 | Design Underground System | C++Python | ctor:O(1) checkin:O(1) checkout:O(1) getaverage:O(1) | O(n) | Medium | ||
| 1429 | First Unique Number | C++Python | ctor:O(k) add:O(1) showFirstUnique:O(1) | O(n) | Medium | 🔒 | LinkedHashSet |
| 1472 | Design Browser History | C++Python | ctor:O(1) visit:O(1) back:O(1) forward:O(1) | O(n) | Medium | ||
| 1476 | Subrectangle Queries | C++Python | ctor:O(1) update:O(1) get:O(u) | O(u) | Medium | ||
| 1483 | Kth Ancestor of a Tree Node | C++Python | ctor:O(n * logh) get:O(logh) | O(n * logh) | Hard | DP, Binary Lifting | |
| 1500 | Design a File Sharing System | C++Python | ctor:O(1) join:O(logu + c) leave:O(logu + c) request:O(u) | O(u * c) | Medium | 🔒 | |
| 1570 | Dot Product of Two Sparse Vectors | C++Python | ctor:O(n) dot_product:O(min(n, m)) | O(n) | Medium | 🔒 | |
| 1586 | Binary Search Tree Iterator II | C++Python | O(1), amortized | O(h) | Medium | 🔒 | |
| 1600 | Throne Inheritance | C++Python | ctor:O(1) birth:O(1) death:O(1) inherit:O(n) | O(n) | Medium | ||
| 1603 | Design Parking System | C++Python | O(1) | O(1) | Easy | ||
| 1622 | Fancy Sequence | C++Python | O(1) | O(n) | Hard | Euler's Theorem | |
| 1628 | Design an Expression Tree With Evaluate Function | C++Python | O(n) | O(h) | Medium | 🔒 | |
| 1656 | Design an Ordered Stream | C++Python | O(1), amortized | O(n) | Easy | ||
| 1670 | Design Front Middle Back Queue | C++Python | O(1) | O(n) | Medium |
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| 1114 | Print in Order | C++Python | O(n) | O(1) | Easy | ||
| 1115 | Print FooBar Alternately | C++Python | O(n) | O(1) | Medium | ||
| 1116 | Print Zero Even Odd | C++Python | O(n) | O(1) | Medium | ||
| 1117 | Building H2O | C++Python | O(n) | O(1) | Hard | ||
| 1188 | Design Bounded Blocking Queue | C++Python | O(n) | O(1) | Medium | 🔒 | |
| 1195 | Fizz Buzz Multithreaded | C++Python | O(n) | O(1) | Medium | ||
| 1226 | The Dining Philosophers | C++Python | O(n) | O(1) | Medium | ||
| 1242 | Web Crawler Multithreaded | C++Python | O(|V| + |E|) | O(|V|) | Medium | 🔒 | |
| 1279 | Traffic Light Controlled Intersection | C++Python | O(n) | O(1) | Easy | 🔒 |
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| 0192 | Word Frequency | Shell | O(n) | O(k) | Medium | ||
| 0193 | Valid Phone Numbers | Shell | O(n) | O(1) | Easy | ||
| 0194 | Transpose File | Shell | O(n^2) | O(n^2) | Medium | ||
| 0195 | Tenth Line | Shell | O(n) | O(1) | Easy |
About
(Weekly Update) Python / Modern C++ Solutions of All 1745 LeetCode Problems
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
No releases published
Packages0
No packages published
Languages
- C++54.4%
- Python45.3%
- Other0.3%