- As for algorithms, solved mainly in Python 3, and partly in C++ and Java.
- There are totally 808 solutions in this repo.
- My leetcode profile: https://leetcode.com/441858734/.
NO. | Title | Solution | Note | Difficulty | Time | Space | Tag |
---|---|---|---|---|---|---|---|
No.136 | Single Number | Solution | Note | Easy | O(n) | O(1) | --- |
No.29 | Divide Two Integers | Solution | Note | Medium | O(n) | O(1) | --- |
No.1356 | Sort Integers by The Number of 1 Bits | Solution | Note | Easy | O(n) | O(n) | --- |
No.201 | Bitwise AND of Numbers Range | Solution | Note | Medium | O(n) | O(1) | --- |
No.260 | Single Number III | Solution | Note | Medium | O(n) | O(1) | --- |
No.421 | Maximum XOR of Two Numbers in an Array | Solution | Note | Medium | O(n) | O(n) | Trie |
NO. | Title | Solution | Note | Difficulty | Time | Space | Tag |
---|---|---|---|---|---|---|---|
No.56 | Merge Intervals | Solution | Note | Medium | O(n) | O(n) | --- |
No.20 | Valid Parentheses | Solution | Note | Easy | O(n) | O(n) | --- |
No.224 | Basic Calculator | Solution | Note | Hard | O(n) | O(n) | --- |
No.739 | Daily Temperatures | Solution | Note | Medium | O(n) | O(n) | --- |
No.456 | 132 Pattern | Solution | Note | Medium | O(n) | O(n) | --- |
No.32 | Longest Valid Parentheses | Solution | Note | Hard | O(n) | O(n) | --- |
No.582 | Kill Process | Solution | Note | Medium | O(n) | O(n) | --- |
No.716 | Max Stack | Solution | Note | Easy | O(n) | O(n) | --- |
No.636 | Exclusive Time of Functions | Solution | Note | Medium | O(n) | O(n) | --- |
No.678 | Valid Parenthesis String | Solution | Note | Medium | O(n) | O(n) | --- |
No.1130 | Minimum Cost Tree From Leaf Values | Solution | Note | Medium | O(n) | O(n) | --- |
No.735 | Asteroid Collision | Solution | Note | Medium | O(n) | O(n) | --- |
No.503 | Next Greater Element II | Solution | Note | Medium | O(n) | O(n) | monotonous stack |
No.901 | Online Stock Span | Solution | Note | Medium | O(n) | O(n) | monotonous stack |
No.84 | Largest Rectangle in Histogram | Solution | Note | Hard | O(n) | O(n) | monotonous stack |
No.1249 | Minimum Remove to Make Valid Parentheses | Solution | Note | Medium | O(n) | O(n) | --- |
No.1209 | Remove All Adjacent Duplicates in String II | Solution | Note | Medium | O(n) | O(n) | --- |
NO. | Title | Solution | Note | Difficulty | Time | Space | Tag |
---|---|---|---|---|---|---|---|
No.346 | Moving Average from Data Stream | Solution | Note | Easy | O(n) | O(n) | --- |
No.127 | Word Ladder | Solution | Note | Medium | O(nlogn) | O(n) | bfs |
No.126 | Word Ladder II | Solution | Note | Hard | O(nlogn) | O(n) | bfs/dfs |
No.743 | Network Delay Time | Solution | Note | Medium | O(n) | O(n) | graph+heap/queue |
No.752 | Open the Lock | Solution | Note | Medium | O(8*10000) | O(10000) | bfs deque |
No.1197 | Minimum Knight Moves | Solution | Note | Medium | O(n) | O(n) | bfs deque |
No.133 | Clone Graph | Solution | Note | Medium | O(n) | O(n) | bfs deque |
No.773 | Sliding Puzzle | Solution | Note | Hard | O(n) | O(n) | bfs deque |
No.286 | Walls and Gates | Solution | Note | Medium | O(n) | O(n) | bfs deque |
No.1236 | Web Crawler | Solution | Note | Medium | O(n) | O(n) | bfs deque |
NO. | Title | Solution | Note | Difficulty | Time | Space | Tag |
---|---|---|---|---|---|---|---|
No.247 | Strobogrammatic Number II | Solution | Note | Medium | O(2^n) | O(n) | dfs/bottom-up/top-down |
No.39 | Combination Sum | Solution | Note | Medium | O(2^n) | O(n) | dfs |
No.40 | Combination Sum II | Solution | Note | Medium | O(2^n) | O(n) | dfs |
No.339 | Nested List Weight Sum | Solution | Note | Easy | O(n) | O(1) | --- |
No.216 | Combination Sum III | Solution | Note | Medium | O(2^n) | O(n) | dfs |
No.967 | Numbers With Same Consecutive Differences | Solution | Note | Medium | O(2^n) | O(n) | dfs |
No.490 | The Maze | Solution | Note | Medium | O(mn) | O(mn) | bfs dfs |
No.505 | The Maze II | Solution | Note | Medium | O(mnmax(m,n)) | O(mn) | bfs dfs |
No.499 | The Maze III | Solution | Note | Hard | O(mnmax(m,n)) | O(mn) | bfs |
No.489 | Robot Room Cleaner | Solution | Note | Hard | O(n) | O(n) | dfs |
No.1490 | Clone N-ary Tree | Solution | Note | Medium | O(n) | O(n) | clone bfs/dfs |
No.133 | Clone Graph | Solution | Note | Medium | O(n) | O(n) | clone bfs |
No.1485 | Clone Binary Tree With Random Pointer | Solution | Note | Medium | O(n) | O(n) | clone bfs/dfs |
No.138 | Copy List with Random Pointer | Solution | Note | Medium | O(n) | O(n) | clone bfs |
No.351 | Android Unlock Patterns | Solution | Note | Medium | O(n) | O(n) | dfs top-down bottom-up |
No.695 | Max Area of Island | Solution | Note | Medium | O(n) | O(n) | dfs bfs |
No.733 | Flood Fill | Solution | Note | Easy | O(n) | O(n) | dfs bfs |
No.1162 | As Far from Land as Possible | Solution | Note | Medium | O(n) | O(n) | bfs |
No.827 | Making A Large Island | Solution | Note | Easy | O(n^2) | O(n^2) | dfs |
No.1291 | Sequential Digits | Solution | Note | Medium | O(nlogn) | O(n) | dfs |
No.425 | Word Squares | Solution | Note | Hard | O(n) | O(n) | trie bfs |
No.847 | Shortest Path Visiting All Nodes | Solution | Note | Hard | O(nx2^n) | O(nx2^n) | bfs |
No.433 | Minimum Genetic Mutation | Solution | Note | Medium | O(n) | O(n) | bfs |
No.934 | Shortest Bridge | Solution | Note | Medium | O(n) | O(n) | dfs+bfs |
No.529 | Minesweeper | Solution | Note | Medium | O(n) | O(1) | dfs |
No.996 | Number of Squareful Arrays | Solution | Note | Hard | O(n) | O(1) | permutation dfs |
No.818 | Race Car | Solution | Note | Hard | O(2^n) | O(n) | bfs |
NO. | Title | Solution | Note | Difficulty | Time | Space | Tag |
---|---|---|---|---|---|---|---|
No.359 | Logger Rate Limiter | Solution | Note | Easy | O(n) | O(n) | --- |
No.706 | Design HashMap | Solution | Note | Easy | O(n) | O(n) | --- |
No.36 | Valid Sudoku | Solution | Note | Medium | O(n^2) | O(n) | --- |
No.939 | Minimum Area Rectangle | Solution | Note | Medium | O(n^2) | O(n) | --- |
No.187 | Repeated DNA Sequences | Solution | Note | Medium | O(n) | O(n) | --- |
No.676 | Implement Magic Dictionary | Solution | Note | Medium | O(n*26) | O(n) | --- |
No.525 | Contiguous Array | Solution | Note | Medium | O(n) | O(n) | --- |
No.249 | Group Shifted Strings | Solution | Note | Medium | O(n) | O(n) | --- |
No.128 | Longest Consecutive Sequence | Solution | Note | Hard | O(n) | O(n) | --- |
No.170 | Two Sum III - Data structure design | Solution | Note | Easy | O(n) | O(n) | --- |
No.454 | 4Sum II | Solution | Note | Medium | O(n^2) | O(n) | --- |
No.1169 | Invalid Transactions | cpp | Note/python | Note | Medium | O(n^2) | O(n) |
No.451 | Sort Characters By Frequency | Python/Cpp | Note | Medium | O(n) | O(n) | --- |
NO. | Title | Solution | Note | Difficulty | Time | Space | Tag |
---|---|---|---|---|---|---|---|
No.973 | K Closest Points to Origin | Solution | Note | Medium | O(n) | O(n) | --- |
No.295 | Find Median from Data Stream | Solution | Note | Hard | O(n) | O(n) | --- |
No.692 | Top K Frequent Words | Solution | Note | Medium | O(nlogn) | O(n) | --- |
No.1057 | Campus Bikes | Solution | Note | Medium | O(n^2) | O(n) | --- |
No.912 | Sort an Array | Solution | Note | Medium | --- | --- | sortings method summary |
No.280 | Wiggle Sort | Solution | Note | Medium | O(nlogn) | O(1) | --- |
No.324 | Wiggle Sort II | Solution | Note | Medium | O(nlogn) | O(1) | --- |
No.179 | Largest Number | Solution | Note | Medium | O(nlogn) | O(n) | merge sort |
No.147 | Insertion Sort List | Solution | Note | Medium | O(n) | O(1) | insertion sort |
No.452 | Minimum Number of Arrows to Burst Balloons | Solution | Note | Medium | O(nlogn) | O(1) | --- |
NO. | Title | Solution | Note | Difficulty | Time | Space | Tag |
---|---|---|---|---|---|---|---|
No.253 | Meeting Rooms II | Solution | Note | Medium | O(nlogn) | O(n) | heapq |
No.1167 | Minimum Cost to Connect Sticks | Solution | Note | Medium | O(nlogn) | O(n) | heapq |
No.743 | Network Delay Time | Solution | Note | Medium | O(n) | O(n) | graph+heap/queue |
No.373 | Find K Pairs with Smallest Sums | Solution | Note | Medium | O(nlogn) | O(n) | heapq |
No.378 | Kth Smallest Element in a Sorted Matrix | Solution | Note | Medium | O(nlogn) | O(n) | heapq |
No.295 | Find Median from Data Stream | Solution | Note | Hard | O(nlogn) | O(n) | heapq |
No.703 | Kth Largest Element in a Stream | Solution | Note | Easy | O(nlogn) | O(n) | heapq |
No.786 | K-th Smallest Prime Fraction | Solution | Note | Hard | O(nlogn) | O(n) | heapq |
No.767 | Reorganize String | Solution | Note | Medium | O(nlogn) | O(n) | heapq |
No.1642 | Furthest Building You Can Reach | Solution | Note | Medium | O(nlogn) | O(n) | priority queue |
NO. | Title | Solution | Note | Difficulty | Time | Space | Tag |
---|---|---|---|---|---|---|---|
No.776 | Split BST | Solution | Note | Medium | O(log(n)) | O(1) | --- |
No.230 | Kth Smallest Element in a BST | Solution | Note | Medium | O(n) | O(1) | --- |
No.285 | Inorder Successor in BST | Solution | Note | Medium | O(n) | O(1) | --- |
No.333 | Largest BST Subtree | Solution | Note | Medium | O(nlogn) | O(1) | --- |
No.270 | Closest Binary Search Tree Value | Solution | Note | Easy | O(nlogn) | O(1) | --- |
No.1382 | Balance a Binary Search Tree | Python/Java | Note | Medium | O(n) | O(n) | AVL |
No.1305 | All Elements in Two Binary Search Trees | Solution | Note | Medium | O(n) | O(n) | inorder + merge sort |
No.501 | Find Mode in Binary Search Tree | Solution | Note | Easy | O(n) | O(1) | inorder |
NO. | Title | Solution | Note | Difficulty | Time | Space | Tag |
---|---|---|---|---|---|---|---|
No.200 | Number of Islands | Solution | Note | Medium | O(mn) | O(n) | dfs bfs |
No.332 | Reconstruct Itinerary | Solution | Note | Medium | O(nlogn) | O(n) | dfs |
No.399 | Evaluate Division | Solution | Note | Medium | O(n) | O(n) | dfs |
No.1192 | Critical Connections in a Network | Solution | Note | Hard | O(n) | O(n) | dfs/Tarjan |
No.694 | Number of Distinct Islands | Solution | Note | Medium | O(nlogn) | O(n) | dfs |
No.1102 | Path With Maximum Minimum Value | Solution | Note | Medium | O(nlogn) | O(n) | heap |
No.207 | Course Schedule | Solution | Note | Medium | O(n) | O(n) | topological sorting |
No.743 | Network Delay Time | Solution | Note | Medium | O(n) | O(n) | graph+heap/queue |
No.130 | Surrounded Regions | Solution | Note | Medium | O(n^2) | O(n) | dfs |
No.210 | Course Schedule II | Solution | Note | Medium | O(n) | O(n) | topological sorting |
No.269 | Alien Dictionary | Solution | Note | Hard | O(n) | O(n) | bfs |
No.684 | Redundant Connection | Python/Cpp | Note | Medium | O(n^2)/O(n^2)/O(n) | O(n) | bfs/dfs/Union find |
No.787 | Cheapest Flights Within K Stops | Solution | Note | Medium | O(m+nlogn) | O(n) | Dijkstra+heap |
No.417 | Pacific Atlantic Water Flow | Solution | Note | Medium | O(logn) | O(n) | dfs/bfs |
No.547 | Friend Circles | Solution | Note | Medium | O(n) | O(n) | dfs |
No.1319 | Number of Operations to Make Network Connected | Solution | Note | Medium | O(n) | O(n) | Union find |
No.547 | Sentence Similarity II | Solution | Note | Medium | O(nlogn) | O(n) | dfs |
No.909 | Snakes and Ladders | Solution | Note | Medium | O(n^2) | O(n^2) | bfs |
No.841 | Keys and Rooms | Solution | Note | Medium | O(n^2) | O(n^2) | bfs/dfs |
No.542 | 01 Matrix | Solution | Note | Medium | O(n^2) | O(n^2) | bfs |
No.721 | Accounts Merge | Solution | Note | Medium | O(n) | O(n^2) | dfs |
No.261 | Graph Valid Tree | Solution | Note | Medium | O(n^2) | O(n) | union find |
No.323 | Number of Connected Components in an Undirected Graph | Solution | Note | Medium | O(n^2) | O(n) | union find |
No.959 | Regions Cut By Slashes | Solution | Note | Medium | O(n^2) | O(n^2) | union find |
No.1135 | Connecting Cities With Minimum Cost | Solution | Note | Medium | O(nlogn) | O(n) | union find |
No.990 | Satisfiability of Equality Equations | Solution | Note | Medium | O(nlogn) | O(n) | union find |
No.1101 | The Earliest Moment When Everyone Become Friends | Solution | Note | Medium | O(nlogn) | O(n) | union find |
No.1061 | Lexicographically Smallest Equivalent String | Solution | Note | Medium | O(nlogn) | O(n) | union find |
No.310 | Minimum Height Trees | Solution | Note | Medium | O(n^2) | O(n) | --- |
No.1245 | Minimum Height Trees | Solution | Note | Medium | O(n) | O(n) | dfs/bfs |
No.1162 | As Far from Land as Possible | Solution | Note | Medium | O(n) | O(n) | bfs |
No.802 | Find Eventual Safe States | Solution | Note | Medium | O(n) | O(n) | topological sorting |
No.1091 | Shortest Path in Binary Matrix | Solution | Note | Medium | O(n) | O(n) | bfs |
No.797 | All Paths From Source to Target | Solution | Note | Medium | O(n+v) | O(n) | --- |
No.952 | Largest Component Size by Common Factor | Solution | Note | Hard | O(n) | O(n) | union find |
No.133 | Clone Graph | Solution | Note | Medium | O(n) | O(n) | bfs deque (queue + hashtable) |
No.138 | Copy List with Random Pointer | Solution | Note | Medium | O(n) | O(n) | clone bfs (queue + hashtable) |
No.841 | Keys and Rooms | Solution | Note | Medium | O(V+E) | O(V) | dfs bfs |
No.1202 | Smallest String With Swaps | Solution | Note | Medium | O(nlogn) | O(n) | union find |
No.785 | Is Graph Bipartite? | Cpp | Note | Medium | O(V+E) | O(V) | bfs,bipartition,graph coloring |
No.1129 | Shortest Path with Alternating Colors | Solution | Note | Medium | O(n) | O(n) | bfs |
No.1334 | Find the City With the Smallest Number of Neighbors at a Threshold Distance | Solution | Note | Medium | O(n^3) | O(n^2) | Floyd–Warshall algorithm |
NO. | Title | Solution | Note | Difficulty | Time | Space | Tag |
---|---|---|---|---|---|---|---|
No.46 | Permutations | Solution | Note | Medium | O(n!) | O(n!) | --- |
No.47 | Permutations II | Solution | Note | Medium | O(n!) | O(n!) | --- |
No.1088 | Confusing Number II | Solution | Note | Hard | O(nlogn) | O(1) | --- |
No.212 | Word Search II | Solution | Note | Hard | O(sum(l)+4^max(l)) | O(n) | TrieNode |
No.980 | Unique Paths III | Solution | Note | Hard | O(4^mn) | O(m*n) | dfs |
No.267 | Palindrome Permutation II | Solution | Note | Medium | O(n^2) | O(n) | --- |
No.1219 | Path with Maximum Gold | Solution | Note | Medium | O(n^2) | O(n) | dfs |
No.131 | Palindrome Partitioning | Solution | Note | Medium | O(n!) | O(n) | --- |
No.37 | Sudoku Solver | Python/Cpp | Note | Hard | O(nlogn) | O(n) | --- |
No.51 | N-Queens | Solution | Note | Hard | O(n!) | O(n) | --- |
No.294 | Flip Game II | Solution | Note | Medium | O(n) | O(n) | memo/min-max |
No.464 | Can I Win | Solution | Note | Medium | O(2^n) | O(2^n) | memo |
No.698 | Partition to K Equal Sum Subsets | Solution | Note | Medium | O(n!) | O(n) | --- |
No.676 | Implement Magic Dictionary | Solution | Note | Medium | O(n) | O(n) | TrieNode |
No.1233 | Remove Sub-Folders from the Filesystem | Solution | Note | Medium | O(nlogn) | O(n) | TrieNode |
No.93 | Restore IP Addresses | Solution | Note | Medium | O(nlogn) | O(n) | --- |
No.473 | Matchsticks to Square | Solution | Note | Medium | O(nlogn) | O(n) | --- |
No.95 | Unique Binary Search Trees II | Solution | Note | Medium | O(3^n) | O(3^n) | --- |
No.77 | Combinations | Solution | Note | Medium | O(nlogn) | O(n) | --- |
No.425 | Word Squares | Solution | Note | Hard | O(n) | O(n) | trie bfs |
NO. | Title | Solution | Note | Difficulty | Time | Space | Tag |
---|---|---|---|---|---|---|---|
No.53 | Maximum Subarray | Solution | Note | Medium | O(n) | O(n) | --- |
No.121 | Best Time to Buy and Sell Stock | Solution | Note | Easy | O(n) | O(1) | --- |
No.10 | Regular Expression Matching | Solution | Note | Hard | O(n*m) | O(n*m) | --- |
No.96 | Unique Binary Search Trees | Solution | Note | Medium | O(n^2) | O(n) | tree |
No.91 | Decode Ways | Solution | Note | Medium | O(n)) | O(n) | dp |
No.1048 | Longest String Chain | Solution | Note | Medium | O(nlogn)) | O(n) | dp |
No.139 | Word Break | Solution | Note | Medium | O(n^3)) | O(n) | --- |
No.472 | Concatenated Words | Solution | Note | Hard | O(n^3)) | O(n) | --- |
No.727 | Minimum Window Subsequence | Solution | Note | Hard | O(n^2)) | O(n) | --- |
No.552 | Student Attendance Record II | Solution | Note | Hard | O(n)) | O(n) | --- |
No.239 | Sliding Window Maximum | Solution | Note | Hard | O(n)) | O(1) | --- |
No.140 | Word Break II | Solution | Note | Hard | O(nlogn)) | O(n) | dfs |
No.62 | Unique Paths | Solution | Note | Hard | O(n^2)) | O(n) | --- |
No.63 | Unique Paths II | Solution | Note | Hard | O(n^2)) | O(n) | --- |
No.1000 | Minimum Cost to Merge Stones | Solution | Note | Hard | O(N^3/K)) | O(KN^2) | functools.lru_cache |
No.279 | Perfect Squares | Solution | Note | Medium | O(n^2)) | O(n) | partition dp |
No.221 | Maximal Square | Solution | Note | Medium | O(n^2)) | O(n) | --- |
No.801 | Minimum Swaps To Make Sequences Increasing | Solution | Note | Medium | O(n)) | O(n) | --- |
No.877 | Stone Game | Solution | Note | Medium | O(n^2)) | O(n^2) | --- |
No.486 | Predict the Winner | Solution | Note | Medium | O(n^2)) | O(n^2) | --- |
No.5 | Longest Palindromic Substring | Solution | Note | Medium | O(n^2) | O(n^2) | --- |
No.312 | Burst Balloons | Solution | Note | Hard | O(n^3) | O(n^2) | --- |
No.338 | Counting Bits | Solution | Note | Hard | O(n) | O(n) | --- |
No.494 | Target Sum | Solution | Note | Medium | O(n*m) | O(n) | --- |
No.64 | Minimum Path Sum | Solution | Note | Medium | O(n^2) | O(n^2) | --- |
No.1143 | Longest Common Subsequence | Solution | Note | Medium | O(n^2) | O(n^2) | --- |
No.300 | Longest Increasing Subsequence | Solution | Note | Easy | O(n^2) | O(n) | --- |
No.673 | Number of Longest Increasing Subsequence | Solution | Note | Medium | O(n^2) | O(n^2) | --- |
No.72 | Edit Distance | Solution | Note | Hard | O(n^2)) | O(n^2) | --- |
No.416 | Partition Equal Subset Sum | Solution | Note | Medium | O(n^2) | O(n^2) | --- |
No.689 | Maximum Sum of 3 Non-Overlapping Subarrays | Solution | Note | Hard | O(n) | O(n) | --- |
No.152 | Maximum Product Subarray | Solution | Note | Medium | O(n) | O(n) | --- |
No.516 | Longest Palindromic Subsequence | Solution | Note | Medium | O(n^2) | O(n^2) | --- |
No.730 | Count Different Palindromic Subsequences | Solution | Note | Hard | O(n^2) | O(n^2) | --- |
No.1027 | Longest Arithmetic Sequence | Solution | Note | Hard | O(n**2)) | O(n) | --- |
No.1223 | Dice Roll Simulation | Solution | Note | Medium | O(n)) | O(n) | --- |
No.375 | Guess Number Higher or Lower II | Solution | Note | Medium | O(n^2) | O(n^2) | min-max |
No.740 | Delete and Earn | Solution | Note | Medium | O(n) | O(n) | min-max |
No.741 | Cherry Pickup | Solution | Note | Hard | O(n^3) | O(n) | memo |
No.647 | Palindromic Substrings | Solution | Note | Medium | O(n^2) | O(n^2) | --- |
No.518 | Coin Change 2 | Solution | Note | Medium | O(n*m) | O(n) | combination-377 |
No.377 | Combination Sum IV | Solution | Note | Medium | O(n*m) | O(n) | permutation-518 |
No.983 | Minimum Cost For Tickets | Solution | Note | Medium | O(n) | O(n) | similar-322 |
No.1155 | Number of Dice Rolls With Target Sum | Solution | Note | Medium | O(n^3) | O(n^2) | --- |
No.978 | Longest Turbulent Subarray | Solution | Note | Medium | O(n) | O(n) | --- |
No.256 | Paint House | Solution | Note | Easy | O(n) | O(1) | --- |
No.120 | Triangle | Solution | Note | Medium | O(n) | O(1) | --- |
No.1139 | Largest 1-Bordered Square | Solution | Note | Medium | O(n^3) | O(n^2) | --- |
No.688 | Knight Probability in Chessboard | Solution | Note | Medium | O(n^3) | O(n^2) | --- |
No.174 | Dungeon Game | Solution | Note | Hard | O(n^2) | O(n^2) | --- |
No.304 | Range Sum Query 2D - Immutable | Solution | Note | Medium | O(n^2) | O(n^2) | --- |
No.361 | Bomb Enemy | Solution | Note | Medium | O(n^2) | O(n^2) | --- |
No.265 | Paint House II | Solution | Note | Hard | O(nk**2) and O(nk) | O(1) | --- |
No.276 | Paint Fence | Solution | Note | Easy | O(n) | O(1) | --- |
No.887 | Super Egg Drop | Solution | Note | Hard | O(knm) | O(nm) | --- |
No.198 | House Robber | Solution | Note | Easy | O(n) | O(n) and O(1) | --- |
No.213 | House Robber II | Solution | Note | Medium | O(n) | O(n) and O(1) | --- |
No.123 | Best Time to Buy and Sell Stock III | Solution | Note | Hard | O(n*5) | O(n) | --- |
No.188 | Best Time to Buy and Sell Stock IV | Solution | Note | Hard | O(nk) | O(nk) | --- |
No.132 | Palindrome Partitioning II | Solution | Note | Hard | O(n^2) | O(n) | dp partition |
No.1289 | Minimum Falling Path Sum II | Solution | Note | Hard | O(n^2) | O(1) | --- |
No.1235 | Maximum Profit in Job Scheduling | Solution | Note | Hard | O(nlogn) | O(n) | binary search + dynamic programming |
No.1510 | Stone Game IV | Solution | Note | Hard | O(n) | O(n) | --- |
No.1478 | Allocate Mailboxes | Solution | Note | Hard | O(n^3) | O(n) | --- |
No.97 | Interleaving String | Solution | Note | Hard | O(n^2) | O(n^2) | --- |
NO. | Title | Solution | Note | Difficulty | Time | Space | Tag |
---|---|---|---|---|---|---|---|
No.932 | Beautiful Array | Solution | Note | Medium | O(nlogn) | O(n) | --- |
No.241 | Different Ways to Add Parentheses | Solution | Note | Medium | O(n^3) | O(n) | memo |
No.395 | Longest Substring with At Least K Repeating Characters | Solution | Note | Medium | O(n^2) | O(n) | --- |
No.1274 | Number of Ships in a Rectangle | Solution | Note | Medium | O(logn) | O(logn) | --- |
NO. | Title | Solution | Note | Difficulty | Time | Space | Tag |
---|---|---|---|---|---|---|---|
No.348 | Design Tic-Tac-Toe | Solution | Note | Medium | O(n) | O(n) | --- |
No.642 | Design Search Autocomplete System | Solution | Note | Hard | O(n) | O(n) | TrieNode |
No.355 | Design Twitter | Solution | Note | Medium | O(n) | O(n) | --- |
No.341 | Flatten Nested List Iterator | Solution | Note | Medium | O(n) | O(n) | stack |
No.353 | Design Snake Game | Solution | Note | Medium | O(n) | O(n) | queue |
No.379 | Design Phone Directory | Solution | Note | Medium | O(n) | O(1) | --- |
No.362 | Design Hit Counter | Solution | Note | Medium | O(1) | O(n) | --- |
No.1032 | Stream of Characters | Solution | Note | Hard | O(n) | O(n) | TrieNode |
No.745 | Prefix and Suffix Search | Solution | Note | Hard | O(n) | O(n) | TrieNode |
No.1206 | Design Skiplist | Solution | Note | Hard | O(nlog) | O(n) | skiplist |
No.1429 | First Unique Number | Solution | Note | Medium | O(n) | O(n) | --- |
No.1117 | Building H2O | Solution | Note | Medium | O(n) | O(n) | --- |
No.307 | Range Sum Query - Mutable | Solution | Note | Medium | init:O(nlogn)/query:O(logn)/update:O(logn) | O(n) | FenwickTree/Prefix Sum |
No.315 | Count of Smaller Numbers After Self | Solution | Note | Hard | O(nlogn) | O(n) | FenwickTree/Prefix Sum |
No.895 | Maximum Frequency Stack | Solution | Note | Hard | O(1) | O(n) | --- |
No.1286 | Iterator for Combination | Solution | Note | Medium | O(C(n,k)) | O(k) | --- |
No.635 | Design Log Storage System | Solution | Note | Medium | O(n) | O(n) | --- |
No.1472 | Design Browser History | Solution | Note | Medium | O(1) | O(n) | --- |
No.1244 | Design A Leaderboard | Solution | Note | Medium | O(n) | O(logn) | hash table+set |
NO. | Title | Solution | Note | Difficulty | Time | Space | Tag |
---|---|---|---|---|---|---|---|
No.183 | Customers Who Never Order | Solution | Note | Easy | --- | --- | join |
No.1050 | Actors and Directors Who Cooperated At Least Three Times | Solution | Note | Easy | --- | --- | groupby+count |
No.595 | Big Countries | Solution | Note | Easy | --- | --- | or/union |
No.1075 | Project Employees I | Solution | Note | Easy | --- | --- | round+avg+groupby |
No.1082 | Sales Analysis I | Solution | Note | Easy | --- | --- | groupby+sum+having+orderby |
No.1068 | Product Sales Analysis I | Solution | Note | Easy | --- | --- | INNER JOIN |
No.1148 | Article Views I | Solution | Note | Easy | --- | --- | distinct+orderby |
No.1303 | Find the Team Size | Solution | Note | Easy | --- | --- | inner join+count |
No.1251 | Average Selling Price | Solution | Note | Easy | --- | --- | right join+round+sum |
No.1327 | List the Products Ordered in a Period | Solution | Note | Easy | --- | --- | join+having+sum |
No.184 | Department Highest Salary | Solution | Note | Medium | --- | --- | group by |
No.176 | Second Highest Salary | Solution | Note | Easy | --- | --- | order by+offset |
No.175 | Combine Two Tables | Solution | Note | Easy | --- | --- | left join |
No.177 | Nth Highest Salary | Solution | Note | Medium | --- | --- | function+offset |
No.1341 | Movie Rating | Solution | Note | Medium | --- | --- | union+groupby+orderby+like |