[LeetCode Online Judge] (https://leetcode.com/) is a website containing many algorithm questions. Most of them are real interview questions of Google, Facebook, LinkedIn, Apple, etc. This repo shows my solutions by Go with the code style strictly follows the Google Golang Style Guide. Please feel free to reference and STAR to support this repo, thank you!
标识了 ✅ 的专题是完成所有题目了的,没有标识的是还没有做完所有题目的
- Array
- String
- Two Pointers ✅
- Linked List ✅
- Stack ✅
- Tree
- Dynamic programming
- Backtracking ✅
- Depth-first search
- Breadth-first Search
- Binary Search
- Math
- Hash Table
- Sort ✅
- Bit Manipulation ✅
数据结构 | 变种 | 相关题目 |
---|---|---|
顺序线性表:向量 | ||
单链表 | 1.双链表 2.静态链表 3.对称矩阵 4.稀疏矩阵 |
|
栈 | 广义栈 | |
队列 | 1.链表实现 2.循环数组实现 3.双端队列 |
|
字符串 | 1.KMP算法 2.有限状态自动机 3.模式匹配有限状态自动机 4.BM模式匹配算法 5.BM-KMP算法 |
|
树 | 1.二叉树 2.并查集 3.Huffman数 |
|
数组实现的堆 | 1.极大堆和极小堆 2.极大极小堆 3.双端堆 4.d叉堆 |
|
树实现的堆 | 1.左堆 2.扁堆 3.二项式堆 4.斐波那契堆 5.配对堆 |
|
查找 | 1.哈希表 2.跳跃表 3.排序二叉树 4.AVL树 5.B树 6.AA树 7.红黑树 8.排序二叉堆 9.Splay树 10.双链树 11.Trie树 |
# | Title | Solution | Acceptance | Difficulty | Frequency |
---|---|---|---|---|---|
0001 | Two Sum | Go | 44.30% | Easy | |
0002 | Add Two Numbers | Go | 31.30% | Medium | |
0003 | Longest Substring Without Repeating Characters | Go | 28.50% | Medium | |
0004 | Median of Two Sorted Arrays | 26.60% | Hard | ||
0005 | Longest Palindromic Substring | 27.50% | Medium | ||
0006 | ZigZag Conversion | 32.20% | Medium | ||
0007 | Reverse Integer | Go | 25.40% | Easy | |
0008 | String to Integer (atoi) | 14.70% | Medium | ||
0009 | Palindrome Number | 43.70% | Easy | ||
0010 | Regular Expression Matching | 25.40% | Hard | ||
0011 | Container With Most Water | Go | 45.10% | Medium | |
0012 | Integer to Roman | 51.30% | Medium | ||
0013 | Roman to Integer | 52.60% | Easy | ||
0014 | Longest Common Prefix | 33.70% | Easy | ||
0015 | 3Sum | Go | 24.20% | Medium | |
0016 | 3Sum Closest | Go | 45.80% | Medium | |
0017 | Letter Combinations of a Phone Number | Go | 41.90% | Medium | |
0018 | 4Sum | Go | 30.80% | Medium | |
0019 | Remove Nth Node From End of List | Go | 34.30% | Medium | |
0020 | Valid Parentheses | Go | 36.70% | Easy | |
0021 | Merge Two Sorted Lists | Go | 47.70% | Easy | |
0022 | Generate Parentheses | Go | 55.50% | Medium | |
0023 | Merge k Sorted Lists | Go | 34.90% | Hard | |
0024 | Swap Nodes in Pairs | Go | 45.10% | Medium | |
0025 | Reverse Nodes in k-Group | Go | 36.80% | Hard | |
0026 | Remove Duplicates from Sorted Array | Go | 41.00% | Easy | |
0027 | Remove Element | Go | 44.80% | Easy | |
0028 | Implement strStr() | Go | 32.20% | Easy | |
0029 | Divide Two Integers | 16.10% | Medium | ||
0030 | Substring with Concatenation of All Words | Go(是否还有更优解) | 23.70% | Hard | |
0031 | Next Permutation | 30.60% | Medium | ||
0032 | Longest Valid Parentheses | 25.70% | Hard | ||
0033 | Search in Rotated Sorted Array | 33.00% | Medium | ||
0034 | Find First and Last Position of Element in Sorted Array | Go | 33.70% | Medium | |
0035 | Search Insert Position | 40.90% | Easy | ||
0036 | Valid Sudoku | Go | 43.50% | Medium | |
0037 | Sudoku Solver | Go | 37.40% | Hard | |
0038 | Count and Say | 40.80% | Easy | ||
0039 | Combination Sum | Go | 49.10% | Medium | |
0040 | Combination Sum II | Go | 42.10% | Medium | |
0041 | First Missing Positive | Go | 29.10% | Hard | |
0042 | Trapping Rain Water | Go | 43.50% | Hard | |
0043 | Multiply Strings | 30.90% | Medium | ||
0044 | Wildcard Matching | 23.00% | Hard | ||
0045 | Jump Game II | 28.20% | Hard | ||
0046 | Permutations | Go | 55.70% | Medium | |
0047 | Permutations II | Go | 40.90% | Medium | |
0048 | Rotate Image | Go | 49.00% | Medium | |
0049 | Group Anagrams | Go | 47.40% | Medium | |
0050 | Pow(x, n) | Go | 28.10% | Medium | |
0051 | N-Queens | Go | 39.80% | Hard | |
0052 | N-Queens II | Go | 52.40% | Hard | |
0053 | Maximum Subarray | Go | 43.80% | Easy | |
0054 | Spiral Matrix | Go | 30.70% | Medium | |
0055 | Jump Game | 32.10% | Medium | ||
0056 | Merge Intervals | Go | 35.90% | Medium | |
0057 | Insert Interval | Go | 31.40% | Hard | |
0058 | Length of Last Word | 32.30% | Easy | ||
0059 | Spiral Matrix II | Go | 47.00% | Medium | |
0060 | Permutation Sequence | Go | 33.40% | Medium | |
0061 | Rotate List | Go | 27.30% | Medium | |
0062 | Unique Paths | Go | 48.00% | Medium | |
0063 | Unique Paths II | Go | 33.50% | Medium | |
0064 | Minimum Path Sum | Go | 47.30% | Medium | |
0065 | Valid Number | 14.10% | Hard | ||
0066 | Plus One | 41.40% | Easy | ||
0067 | Add Binary | 39.50% | Easy | ||
0068 | Text Justification | 23.50% | Hard | ||
0069 | Sqrt(x) | Go | 31.50% | Easy | |
0070 | Climbing Stairs | Go | 44.40% | Easy | |
0071 | Simplify Path | Go | 29.00% | Medium | |
0072 | Edit Distance | 38.20% | Hard | ||
0073 | Set Matrix Zeroes | 40.10% | Medium | ||
0074 | Search a 2D Matrix | 35.00% | Medium | ||
0075 | Sort Colors | Go | 42.40% | Medium | |
0076 | Minimum Window Substring | Go | 31.10% | Hard | |
0077 | Combinations | Go | 48.20% | Medium | |
0078 | Subsets | Go | 53.40% | Medium | |
0079 | Word Search | Go | 31.50% | Medium | |
0080 | Remove Duplicates from Sorted Array II | Go | 40.60% | Medium | |
0081 | Search in Rotated Sorted Array II | 32.70% | Medium | ||
0082 | Remove Duplicates from Sorted List II | Go | 33.30% | Medium | |
0083 | Remove Duplicates from Sorted List | Go | 42.80% | Easy | |
0084 | Largest Rectangle in Histogram | Go | 31.40% | Hard | |
0085 | Maximal Rectangle | 33.60% | Hard | ||
0086 | Partition List | Go | 37.60% | Medium | |
0087 | Scramble String | 31.70% | Hard | ||
0088 | Merge Sorted Array | Go | 36.00% | Easy | |
0089 | Gray Code | Go | 46.00% | Medium | |
0090 | Subsets II | Go | 42.70% | Medium | |
0091 | Decode Ways | Go | 22.50% | Medium | |
0092 | Reverse Linked List II | Go | 35.20% | Medium | |
0093 | Restore IP Addresses | Go | 31.70% | Medium | |
0094 | Binary Tree Inorder Traversal | Go | 57.10% | Medium | |
0095 | Unique Binary Search Trees II | Go | 36.00% | Medium | |
0096 | Unique Binary Search Trees | Go | 46.60% | Medium | |
0097 | Interleaving String | 28.20% | Hard | ||
0098 | Validate Binary Search Tree | Go | 25.90% | Medium | |
0099 | Recover Binary Search Tree | Go | 34.90% | Hard | |
0100 | Same Tree | Go | 50.20% | Easy | |
0101 | Symmetric Tree | Go | 43.70% | Easy | |
0102 | Binary Tree Level Order Traversal | Go | 48.90% | Medium | |
0103 | Binary Tree Zigzag Level Order Traversal | Go | 42.10% | Medium | |
0104 | Maximum Depth of Binary Tree | Go | 60.90% | Easy | |
0105 | Construct Binary Tree from Preorder and Inorder Traversal | 41.60% | Medium | ||
0106 | Construct Binary Tree from Inorder and Postorder Traversal | 39.70% | Medium | ||
0107 | Binary Tree Level Order Traversal II | Go | 47.20% | Easy | |
0108 | Convert Sorted Array to Binary Search Tree | Go | 51.20% | Easy | |
0109 | Convert Sorted List to Binary Search Tree | Go | 41.20% | Medium | |
0110 | Balanced Binary Tree | Go | 41.20% | Easy | |
0111 | Minimum Depth of Binary Tree | Go | 35.40% | Easy | |
0112 | Path Sum | Go | 38.00% | Easy | |
0113 | Path Sum II | Go | 41.00% | Medium | |
0114 | Flatten Binary Tree to Linked List | Go | 42.80% | Medium | |
0115 | Distinct Subsequences | 35.20% | Hard | ||
0116 | Populating Next Right Pointers in Each Node | 38.20% | Medium | ||
0117 | Populating Next Right Pointers in Each Node II | 34.70% | Medium | ||
0118 | Pascal's Triangle | 46.50% | Easy | ||
0119 | Pascal's Triangle II | 44.00% | Easy | ||
0120 | Triangle | Go | 39.70% | Medium | |
0121 | Best Time to Buy and Sell Stock | Go | 47.50% | Easy | |
0122 | Best Time to Buy and Sell Stock II | Go | 52.20% | Easy | |
0123 | Best Time to Buy and Sell Stock III | 33.90% | Hard | ||
0124 | Binary Tree Maximum Path Sum | Go | 30.20% | Hard | |
0125 | Valid Palindrome | Go | 31.40% | Easy | |
0126 | Word Ladder II | Go | 18.00% | Hard | |
0127 | Word Ladder | Go | 24.40% | Medium | |
0128 | Longest Consecutive Sequence | Go | 41.90% | Hard | |
0129 | Sum Root to Leaf Numbers | Go | 42.80% | Medium | |
0130 | Surrounded Regions | Go | 23.10% | Medium | |
0131 | Palindrome Partitioning | Go | 41.30% | Medium | |
0132 | Palindrome Partitioning II | 27.60% | Hard | ||
0133 | Clone Graph | 27.00% | Medium | ||
0134 | Gas Station | 34.10% | Medium | ||
0135 | Candy | 28.60% | Hard | ||
0136 | Single Number | Go | 60.50% | Easy | |
0137 | Single Number II | Go | 46.20% | Medium | |
0138 | Copy List with Random Pointer | 27.50% | Medium | ||
0139 | Word Break | 35.60% | Medium | ||
0140 | Word Break II | 27.50% | Hard | ||
0141 | Linked List Cycle | Go | 37.20% | Easy | |
0142 | Linked List Cycle II | Go | 32.40% | Medium | |
0143 | Reorder List | Go | 31.20% | Medium | |
0144 | Binary Tree Preorder Traversal | Go | 51.70% | Medium | |
0145 | Binary Tree Postorder Traversal | Go | 48.90% | Hard | |
0146 | LRU Cache | 25.90% | Medium | ||
0147 | Insertion Sort List | Go | 37.60% | Medium | |
0148 | Sort List | Go | 35.80% | Medium | |
0149 | Max Points on a Line | 15.80% | Hard | ||
0150 | Evaluate Reverse Polish Notation | Go | 32.50% | Medium | |
0151 | Reverse Words in a String | 17.00% | Medium | ||
0152 | Maximum Product Subarray | Go | 29.40% | Medium | |
0153 | Find Minimum in Rotated Sorted Array | 43.10% | Medium | ||
0154 | Find Minimum in Rotated Sorted Array II | 39.40% | Hard | ||
0155 | Min Stack | Go | 37.50% | Easy | |
0156 | Binary Tree Upside Down | 51.10% | Medium | ||
0157 | Read N Characters Given Read4 | 29.70% | Easy | ||
0158 | Read N Characters Given Read4 II - Call multiple times | 26.60% | Hard | ||
0159 | Longest Substring with At Most Two Distinct Characters | 47.20% | Hard | ||
0160 | Intersection of Two Linked Lists | Go | 34.30% | Easy | |
0161 | One Edit Distance | 31.70% | Medium | ||
0162 | Find Peak Element | 41.40% | Medium | ||
0163 | Missing Ranges | 23.30% | Medium | ||
0164 | Maximum Gap | Go | 32.70% | Hard | |
0165 | Compare Version Numbers | 23.80% | Medium | ||
0166 | Fraction to Recurring Decimal | 19.60% | Medium | ||
0167 | Two Sum II - Input array is sorted | Go | 50.60% | Easy | |
0168 | Excel Sheet Column Title | 29.10% | Easy | ||
0169 | Majority Element | Go | 53.00% | Easy | |
0170 | Two Sum III - Data structure design | 30.60% | Easy | ||
0171 | Excel Sheet Column Number | 51.70% | Easy | ||
0172 | Factorial Trailing Zeroes | 37.40% | Easy | ||
0173 | Binary Search Tree Iterator | Go | 49.00% | Medium | |
0174 | Dungeon Game | 27.30% | Hard | ||
0175 | Combine Two Tables | 52.40% | Easy | ||
0176 | Second Highest Salary | 27.50% | Easy | ||
0177 | Nth Highest Salary | 26.60% | Medium | ||
0178 | Rank Scores | 37.10% | Medium | ||
0179 | Largest Number | Go | 26.00% | Medium | |
0180 | Consecutive Numbers | 34.00% | Medium | ||
0181 | Employees Earning More Than Their Managers | 48.90% | Easy | ||
0182 | Duplicate Emails | 55.20% | Easy | ||
0183 | Customers Who Never Order | 45.40% | Easy | ||
0184 | Department Highest Salary | 29.40% | Medium | ||
0185 | Department Top Three Salaries | 26.50% | Hard | ||
0186 | Reverse Words in a String II | 38.10% | Medium | ||
0187 | Repeated DNA Sequences | Go | 36.30% | Medium | |
0188 | Best Time to Buy and Sell Stock IV | 26.40% | Hard | ||
0189 | Rotate Array | 30.50% | Easy | ||
0190 | Reverse Bits | Go | 31.70% | Easy | |
0191 | Number of 1 Bits | Go | 43.60% | Easy | |
0192 | Word Frequency | 26.80% | Medium | ||
0193 | Valid Phone Numbers | 25.20% | Easy | ||
0194 | Transpose File | 22.90% | Medium | ||
0195 | Tenth Line | 33.90% | Easy | ||
0196 | Delete Duplicate Emails | 33.40% | Easy | ||
0197 | Rising Temperature | 35.10% | Easy | ||
0198 | House Robber | Go | 41.10% | Easy | |
0199 | Binary Tree Right Side View | Go | 48.30% | Medium | |
0200 | Number of Islands | Go | 41.90% | Medium | |
0201 | Bitwise AND of Numbers Range | Go | 36.10% | Medium | |
0202 | Happy Number | Go | 45.60% | Easy | |
0203 | Remove Linked List Elements | Go | 35.90% | Easy | |
0204 | Count Primes | Go | 29.20% | Easy | |
0205 | Isomorphic Strings | Go | 37.60% | Easy | |
0206 | Reverse Linked List | Go | 55.30% | Easy | |
0207 | Course Schedule | Go | 38.20% | Medium | |
0208 | Implement Trie (Prefix Tree) | Go | 39.00% | Medium | |
0209 | Minimum Size Subarray Sum | Go | 35.10% | Medium | |
0210 | Course Schedule II | Go | 35.20% | Medium | |
0211 | Add and Search Word - Data structure design | Go | 30.70% | Medium | |
0212 | Word Search II | Go | 29.00% | Hard | |
0213 | House Robber II | Go | 35.40% | Medium | |
0214 | Shortest Palindrome | 27.70% | Hard | ||
0215 | Kth Largest Element in an Array | Go | 48.30% | Medium | |
0216 | Combination Sum III | Go | 51.90% | Medium | |
0217 | Contains Duplicate | Go | 52.30% | Easy | |
0218 | The Skyline Problem | 31.80% | Hard | ||
0219 | Contains Duplicate II | Go | 35.50% | Easy | |
0220 | Contains Duplicate III | Go | 19.80% | Medium | |
0221 | Maximal Square | 33.30% | Medium | ||
0222 | Count Complete Tree Nodes | Go | 34.40% | Medium | |
0223 | Rectangle Area | 36.00% | Medium | ||
0224 | Basic Calculator | Go | 33.00% | Hard | |
0225 | Implement Stack using Queues | Go | 39.60% | Easy | |
0226 | Invert Binary Tree | Go | 58.50% | Easy | |
0227 | Basic Calculator II | 33.70% | Medium | ||
0228 | Summary Ranges | 36.20% | Medium | ||
0229 | Majority Element II | Go | 32.30% | Medium | |
0230 | Kth Smallest Element in a BST | Go | 51.90% | Medium | |
0231 | Power of Two | Go | 42.10% | Easy | |
0232 | Implement Queue using Stacks | Go | 43.70% | Easy | |
0233 | Number of Digit One | 30.30% | Hard | ||
0234 | Palindrome Linked List | Go | 36.30% | Easy | |
0235 | Lowest Common Ancestor of a Binary Search Tree | Go | 45.10% | Easy | |
0236 | Lowest Common Ancestor of a Binary Tree | Go | 37.90% | Medium | |
0237 | Delete Node in a Linked List | Go | 54.00% | Easy | |
0238 | Product of Array Except Self | 55.40% | Medium | ||
0239 | Sliding Window Maximum | Go | 38.40% | Hard | |
0240 | Search a 2D Matrix II | 41.00% | Medium | ||
0241 | Different Ways to Add Parentheses | 50.30% | Medium | ||
0242 | Valid Anagram | Go | 52.50% | Easy | |
0243 | Shortest Word Distance | 57.60% | Easy | ||
0244 | Shortest Word Distance II | 47.60% | Medium | ||
0245 | Shortest Word Distance III | 53.60% | Medium | ||
0246 | Strobogrammatic Number | 42.40% | Easy | ||
0247 | Strobogrammatic Number II | 44.60% | Medium | ||
0248 | Strobogrammatic Number III | 36.70% | Hard | ||
0249 | Group Shifted Strings | 49.10% | Medium | ||
0250 | Count Univalue Subtrees | 49.10% | Medium | ||
0251 | Flatten 2D Vector | 43.90% | Medium | ||
0252 | Meeting Rooms | 52.30% | Easy | ||
0253 | Meeting Rooms II | 43.10% | Medium | ||
0254 | Factor Combinations | 44.50% | Medium | ||
0255 | Verify Preorder Sequence in Binary Search Tree | 43.70% | Medium | ||
0256 | Paint House | 49.10% | Easy | ||
0257 | Binary Tree Paths | Go | 46.30% | Easy | |
0258 | Add Digits | 54.30% | Easy | ||
0259 | 3Sum Smaller | 45.10% | Medium | ||
0260 | Single Number III | Go | 57.30% | Medium | |
0261 | Graph Valid Tree | 40.00% | Medium | ||
0262 | Trips and Users | 25.40% | Hard | ||
0263 | Ugly Number | Go | 40.70% | Easy | |
0264 | Ugly Number II | 36.60% | Medium | ||
0265 | Paint House II | 41.70% | Hard | ||
0266 | Palindrome Permutation | 60.20% | Easy | ||
0267 | Palindrome Permutation II | 33.90% | Medium | ||
0268 | Missing Number | Go | 48.60% | Easy | |
0269 | Alien Dictionary | 31.30% | Hard | ||
0270 | Closest Binary Search Tree Value | 44.00% | Easy | ||
0271 | Encode and Decode Strings | 27.00% | Medium | ||
0272 | Closest Binary Search Tree Value II | 45.40% | Hard | ||
0273 | Integer to English Words | 24.50% | Hard | ||
0274 | H-Index | Go | 34.70% | Medium | |
0275 | H-Index II | 35.50% | Medium | ||
0276 | Paint Fence | 36.60% | Easy | ||
0277 | Find the Celebrity | 37.10% | Medium | ||
0278 | First Bad Version | 30.30% | Easy | ||
0279 | Perfect Squares | 42.30% | Medium | ||
0280 | Wiggle Sort | 61.20% | Medium | ||
0281 | Zigzag Iterator | 56.10% | Medium | ||
0282 | Expression Add Operators | 32.90% | Hard | ||
0283 | Move Zeroes | Go | 54.50% | Easy | |
0284 | Peeking Iterator | 40.90% | Medium | ||
0285 | Inorder Successor in BST | 35.10% | Medium | ||
0286 | Walls and Gates | 49.80% | Medium | ||
0287 | Find the Duplicate Number | Go | 50.00% | Medium | |
0288 | Unique Word Abbreviation | 20.10% | Medium | ||
0289 | Game of Life | 45.90% | Medium | ||
0290 | Word Pattern | Go | 35.20% | Easy | |
0291 | Word Pattern II | 41.10% | Hard | ||
0292 | Nim Game | 55.70% | Easy | ||
0293 | Flip Game | 59.00% | Easy | ||
0294 | Flip Game II | 48.40% | Medium | ||
0295 | Find Median from Data Stream | 37.10% | Hard | ||
0296 | Best Meeting Point | 55.00% | Hard | ||
0297 | Serialize and Deserialize Binary Tree | 41.30% | Hard | ||
0298 | Binary Tree Longest Consecutive Sequence | 44.20% | Medium | ||
0299 | Bulls and Cows | 39.70% | Medium | ||
0300 | Longest Increasing Subsequence | Go | 41.00% | Medium | |
0301 | Remove Invalid Parentheses | 39.50% | Hard | ||
0302 | Smallest Rectangle Enclosing Black Pixels | 49.40% | Hard | ||
0303 | Range Sum Query - Immutable | 38.40% | Easy | ||
0304 | Range Sum Query 2D - Immutable | 32.70% | Medium | ||
0305 | Number of Islands II | 41.70% | Hard | ||
0306 | Additive Number | Go | 28.40% | Medium | |
0307 | Range Sum Query - Mutable | 29.00% | Medium | ||
0308 | Range Sum Query 2D - Mutable | 32.20% | Hard | ||
0309 | Best Time to Buy and Sell Stock with Cooldown | Go | 44.20% | Medium | |
0310 | Minimum Height Trees | 30.30% | Medium | ||
0311 | Sparse Matrix Multiplication | 56.70% | Medium | ||
0312 | Burst Balloons | 47.50% | Hard | ||
0313 | Super Ugly Number | 41.70% | Medium | ||
0314 | Binary Tree Vertical Order Traversal | 41.20% | Medium | ||
0315 | Count of Smaller Numbers After Self | 38.40% | Hard | ||
0316 | Remove Duplicate Letters | 32.80% | Hard | ||
0317 | Shortest Distance from All Buildings | 38.10% | Hard | ||
0318 | Maximum Product of Word Lengths | Go | 48.70% | Medium | |
0319 | Bulb Switcher | 44.00% | Medium | ||
0320 | Generalized Abbreviation | 48.90% | Medium | ||
0321 | Create Maximum Number | 25.50% | Hard | ||
0322 | Coin Change | Go | 30.80% | Medium | |
0323 | Number of Connected Components in an Undirected Graph | 52.30% | Medium | ||
0324 | Wiggle Sort II | Go | 28.10% | Medium | |
0325 | Maximum Size Subarray Sum Equals k | 44.80% | Medium | ||
0326 | Power of Three | Go | 41.70% | Easy | |
0327 | Count of Range Sum | 32.90% | Hard | ||
0328 | Odd Even Linked List | Go | 49.50% | Medium | |
0329 | Longest Increasing Path in a Matrix | 40.30% | Hard | ||
0330 | Patching Array | 33.40% | Hard | ||
0331 | Verify Preorder Serialization of a Binary Tree | Go | 38.80% | Medium | |
0332 | Reconstruct Itinerary | 31.70% | Medium | ||
0333 | Largest BST Subtree | 33.20% | Medium | ||
0334 | Increasing Triplet Subsequence | 39.60% | Medium | ||
0335 | Self Crossing | 27.00% | Hard | ||
0336 | Palindrome Pairs | 31.10% | Hard | ||
0337 | House Robber III | 48.30% | Medium | ||
0338 | Counting Bits | Go | 64.90% | Medium | |
0339 | Nested List Weight Sum | 68.50% | Easy | ||
0340 | Longest Substring with At Most K Distinct Characters | 40.00% | Hard | ||
0341 | Flatten Nested List Iterator | 48.20% | Medium | ||
0342 | Power of Four | Go | 40.40% | Easy | |
0343 | Integer Break | Go | 48.00% | Medium | |
0344 | Reverse String | Go | 63.50% | Easy | |
0345 | Reverse Vowels of a String | Go | 41.70% | Easy | |
0346 | Moving Average from Data Stream | 66.50% | Easy | ||
0347 | Top K Frequent Elements | Go | 55.30% | Medium | |
0348 | Design Tic-Tac-Toe | 50.00% | Medium | ||
0349 | Intersection of Two Arrays | Go | 55.10% | Easy | |
0350 | Intersection of Two Arrays II | Go | 48.10% | Easy | |
0351 | Android Unlock Patterns | 46.00% | Medium | ||
0352 | Data Stream as Disjoint Intervals | 43.70% | Hard | ||
0353 | Design Snake Game | 30.80% | Medium | ||
0354 | Russian Doll Envelopes | 34.10% | Hard | ||
0355 | Design Twitter | 27.50% | Medium | ||
0356 | Line Reflection | 30.90% | Medium | ||
0357 | Count Numbers with Unique Digits | Go | 47.10% | Medium | |
0358 | Rearrange String k Distance Apart | 32.90% | Hard | ||
0359 | Logger Rate Limiter | 65.40% | Easy | ||
0360 | Sort Transformed Array | 46.90% | Medium | ||
0361 | Bomb Enemy | 43.60% | Medium | ||
0362 | Design Hit Counter | 59.20% | Medium | ||
0363 | Max Sum of Rectangle No Larger Than K | 35.30% | Hard | ||
0364 | Nested List Weight Sum II | 58.00% | Medium | ||
0365 | Water and Jug Problem | 29.00% | Medium | ||
0366 | Find Leaves of Binary Tree | 66.00% | Medium | ||
0367 | Valid Perfect Square | 40.00% | Easy | ||
0368 | Largest Divisible Subset | 34.90% | Medium | ||
0369 | Plus One Linked List | 56.40% | Medium | ||
0370 | Range Addition | 60.60% | Medium | ||
0371 | Sum of Two Integers | Go | 50.90% | Easy | |
0372 | Super Pow | 35.70% | Medium | ||
0373 | Find K Pairs with Smallest Sums | 34.00% | Medium | ||
0374 | Guess Number Higher or Lower | 39.60% | Easy | ||
0375 | Guess Number Higher or Lower II | 37.80% | Medium | ||
0376 | Wiggle Subsequence | 37.60% | Medium | ||
0377 | Combination Sum IV | 43.70% | Medium | ||
0378 | Kth Smallest Element in a Sorted Matrix | 49.70% | Medium | ||
0379 | Design Phone Directory | 41.70% | Medium | ||
0380 | Insert Delete GetRandom O(1) | 43.00% | Medium | ||
0381 | Insert Delete GetRandom O(1) - Duplicates allowed | 32.10% | Hard | ||
0382 | Linked List Random Node | 49.40% | Medium | ||
0383 | Ransom Note | 50.10% | Easy | ||
0384 | Shuffle an Array | 50.30% | Medium | ||
0385 | Mini Parser | 31.90% | Medium | ||
0386 | Lexicographical Numbers | 46.50% | Medium | ||
0387 | First Unique Character in a String | Go | 50.20% | Easy | |
0388 | Longest Absolute File Path | 39.30% | Medium | ||
0389 | Find the Difference | Go | 53.20% | Easy | |
0390 | Elimination Game | 43.40% | Medium | ||
0391 | Perfect Rectangle | 28.30% | Hard | ||
0392 | Is Subsequence | Go | 46.90% | Medium | |
0393 | UTF-8 Validation | Go | 36.00% | Medium | |
0394 | Decode String | Go | 45.20% | Medium | |
0395 | Longest Substring with At Least K Repeating Characters | 38.80% | Medium | ||
0396 | Rotate Function | 35.20% | Medium | ||
0397 | Integer Replacement | Go | 31.50% | Medium | |
0398 | Random Pick Index | 50.20% | Medium | ||
0399 | Evaluate Division | 47.80% | Medium | ||
0400 | Nth Digit | 30.40% | Easy | ||
0401 | Binary Watch | Go | 45.40% | Easy | |
0402 | Remove K Digits | Go | 26.70% | Medium | |
0403 | Frog Jump | 36.40% | Hard | ||
0404 | Sum of Left Leaves | Go | 49.20% | Easy | |
0405 | Convert a Number to Hexadecimal | Go | 42.00% | Easy | |
0406 | Queue Reconstruction by Height | 60.10% | Medium | ||
0407 | Trapping Rain Water II | 39.40% | Hard | ||
0408 | Valid Word Abbreviation | 29.60% | Easy | ||
0409 | Longest Palindrome | Go | 48.20% | Easy | |
0410 | Split Array Largest Sum | 42.60% | Hard | ||
0411 | Minimum Unique Word Abbreviation | 35.10% | Hard | ||
0412 | Fizz Buzz | Go | 59.70% | Easy | |
0413 | Arithmetic Slices | 56.00% | Medium | ||
0414 | Third Maximum Number | ||||
Go | 29.10% | Easy | |||
0415 | Add Strings | 43.90% | Easy | ||
0416 | Partition Equal Subset Sum | Go | 40.90% | Medium | |
0417 | Pacific Atlantic Water Flow | 37.60% | Medium | ||
0418 | Sentence Screen Fitting | 31.20% | Medium | ||
0419 | Battleships in a Board | 65.90% | Medium | ||
0420 | Strong Password Checker | 17.20% | Hard | ||
0421 | Maximum XOR of Two Numbers in an Array | Go | 51.20% | Medium | |
0422 | Valid Word Square | 36.60% | Easy | ||
0423 | Reconstruct Original Digits from English | 45.70% | Medium | ||
0424 | Longest Repeating Character Replacement | Go | 44.30% | Medium | |
0425 | Word Squares | 44.50% | Hard | ||
0426 | Convert Binary Search Tree to Sorted Doubly Linked List | 52.50% | Medium | ||
0427 | Construct Quad Tree | 57.20% | Medium | ||
0428 | Serialize and Deserialize N-ary Tree | 54.20% | Hard | ||
0429 | N-ary Tree Level Order Traversal | 59.80% | Easy | ||
0430 | Flatten a Multilevel Doubly Linked List | 42.60% | Medium | ||
0431 | Encode N-ary Tree to Binary Tree | 64.20% | Hard | ||
0432 | All O`one Data Structure | 29.70% | Hard | ||
0433 | Minimum Genetic Mutation | Go | 38.40% | Medium | |
0434 | Number of Segments in a String | 37.00% | Easy | ||
0435 | Non-overlapping Intervals | Go | 41.60% | Medium | |
0436 | Find Right Interval | 42.90% | Medium | ||
0437 | Path Sum III | Go | 43.00% | Easy | |
0438 | Find All Anagrams in a String | Go | 37.50% | Easy | |
0439 | Ternary Expression Parser | 53.70% | Medium | ||
0440 | K-th Smallest in Lexicographical Order | 26.60% | Hard | ||
0441 | Arranging Coins | Go | 38.10% | Easy | |
0442 | Find All Duplicates in an Array | 61.30% | Medium | ||
0443 | String Compression | 37.90% | Easy | ||
0444 | Sequence Reconstruction | 20.50% | Medium | ||
0445 | Add Two Numbers II | Go | 50.40% | Medium | |
0446 | Arithmetic Slices II - Subsequence | 30.30% | Hard | ||
0447 | Number of Boomerangs | Go | 50.00% | Easy | |
0448 | Find All Numbers Disappeared in an Array | 53.60% | Easy | ||
0449 | Serialize and Deserialize BST | 47.50% | Medium | ||
0450 | Delete Node in a BST | 40.20% | Medium | ||
0451 | Sort Characters By Frequency | Go | 56.40% | Medium | |
0452 | Minimum Number of Arrows to Burst Balloons | 46.60% | Medium | ||
0453 | Minimum Moves to Equal Array Elements | 49.30% | Easy | ||
0454 | 4Sum II | Go | 50.80% | Medium | |
0455 | Assign Cookies | Go | 48.50% | Easy | |
0456 | 132 Pattern | Go | 27.40% | Medium | |
0457 | Circular Array Loop | Go | 27.70% | Medium | |
0458 | Poor Pigs | 45.50% | Hard | ||
0459 | Repeated Substring Pattern | 40.00% | Easy | ||
0460 | LFU Cache | 29.00% | Hard | ||
0461 | Hamming Distance | Go | 70.40% | Easy | |
0462 | Minimum Moves to Equal Array Elements II | 52.50% | Medium | ||
0463 | Island Perimeter | Go | 61.20% | Easy | |
0464 | Can I Win | 27.30% | Medium | ||
0465 | Optimal Account Balancing | 42.90% | Hard | ||
0466 | Count The Repetitions | 27.30% | Hard | ||
0467 | Unique Substrings in Wraparound String | 34.10% | Medium | ||
0468 | Validate IP Address | 21.40% | Medium | ||
0469 | Convex Polygon | 35.50% | Medium | ||
0470 | Implement Rand10() Using Rand7() | Go | 45.10% | Medium | |
0471 | Encode String with Shortest Length | 45.20% | Hard | ||
0472 | Concatenated Words | 35.10% | Hard | ||
0473 | Matchsticks to Square | 36.00% | Medium | ||
0474 | Ones and Zeroes | 39.80% | Medium | ||
0475 | Heaters | 31.90% | Easy | ||
0476 | Number Complement | Go | 62.50% | Easy | |
0477 | Total Hamming Distance | Go | 49.00% | Medium | |
0478 | Generate Random Point in a Circle | 36.90% | Medium | ||
0479 | Largest Palindrome Product | 27.50% | Hard | ||
0480 | Sliding Window Median | Go | 32.80% | Hard | |
0481 | Magical String | 46.30% | Medium | ||
0482 | License Key Formatting | 41.10% | Easy | ||
0483 | Smallest Good Base | 34.20% | Hard | ||
0484 | Find Permutation | 57.80% | Medium | ||
0485 | Max Consecutive Ones | 55.10% | Easy | ||
0486 | Predict the Winner | 46.80% | Medium | ||
0487 | Max Consecutive Ones II | 46.70% | Medium | ||
0488 | Zuma Game | 39.10% | Hard | ||
0489 | Robot Room Cleaner | 64.70% | Hard | ||
0490 | The Maze | 47.60% | Medium | ||
0491 | Increasing Subsequences | 42.20% | Medium | ||
0492 | Construct the Rectangle | 48.80% | Easy | ||
0493 | Reverse Pairs | 23.30% | Hard | ||
0494 | Target Sum | 45.40% | Medium | ||
0495 | Teemo Attacking | 52.30% | Medium | ||
0496 | Next Greater Element I | Go | 59.80% | Easy | |
0497 | Random Point in Non-overlapping Rectangles | 35.90% | Medium | ||
0498 | Diagonal Traverse | 45.40% | Medium | ||
0499 | The Maze III | 37.40% | Hard | ||
0500 | Keyboard Row | Go | 62.40% | Easy | |
0501 | Find Mode in Binary Search Tree | 39.60% | Easy | ||
0502 | IPO | 38.00% | Hard | ||
0503 | Next Greater Element II | Go | 51.30% | Medium | |
0504 | Base 7 | 45.00% | Easy | ||
0505 | The Maze II | 44.10% | Medium | ||
0506 | Relative Ranks | 48.40% | Easy | ||
0507 | Perfect Number | 34.40% | Easy | ||
0508 | Most Frequent Subtree Sum | 54.80% | Medium | ||
0509 | Fibonacci Number | 66.70% | Easy | ||
0510 | Inorder Successor in BST II | 53.30% | Medium | ||
0511 | Game Play Analysis I | 74.40% | Easy | ||
0512 | Game Play Analysis II | 56.80% | Easy | ||
0513 | Find Bottom Left Tree Value | 58.60% | Medium | ||
0514 | Freedom Trail | 40.70% | Hard | ||
0515 | Find Largest Value in Each Tree Row | Go | 58.00% | Medium | |
0516 | Longest Palindromic Subsequence | 47.10% | Medium | ||
0517 | Super Washing Machines | 37.00% | Hard | ||
0518 | Coin Change 2 | 43.10% | Medium | ||
0519 | Random Flip Matrix | 33.00% | Medium | ||
0520 | Detect Capital | 52.60% | Easy | ||
0521 | Longest Uncommon Subsequence I | 56.50% | Easy | ||
0522 | Longest Uncommon Subsequence II | 32.90% | Medium | ||
0523 | Continuous Subarray Sum | 24.20% | Medium | ||
0524 | Longest Word in Dictionary through Deleting | Go | 46.00% | Medium | |
0525 | Contiguous Array | 42.80% | Medium | ||
0526 | Beautiful Arrangement | Go | 54.80% | Medium | |
0527 | Word Abbreviation | 50.20% | Hard | ||
0528 | Random Pick with Weight | 42.80% | Medium | ||
0529 | Minesweeper | 53.10% | Medium | ||
0530 | Minimum Absolute Difference in BST | 50.70% | Easy | ||
0531 | Lonely Pixel I | 57.60% | Medium | ||
0532 | K-diff Pairs in an Array | Go | 30.00% | Easy | |
0533 | Lonely Pixel II | 46.20% | Medium | ||
0534 | Game Play Analysis III | 64.60% | Medium | ||
0535 | Encode and Decode TinyURL | 76.90% | Medium | ||
0536 | Construct Binary Tree from String | 45.20% | Medium | ||
0537 | Complex Number Multiplication | 65.70% | Medium | ||
0538 | Convert BST to Greater Tree | 51.30% | Easy | ||
0539 | Minimum Time Difference | 48.10% | Medium | ||
0540 | Single Element in a Sorted Array | 57.40% | Medium | ||
0541 | Reverse String II | Go | 45.70% | Easy | |
0542 | 01 Matrix | Go | 36.00% | Medium | |
0543 | Diameter of Binary Tree | 46.90% | Easy | ||
0544 | Output Contest Matches | 73.50% | Medium | ||
0545 | Boundary of Binary Tree | 35.30% | Medium | ||
0546 | Remove Boxes | 38.50% | Hard | ||
0547 | Friend Circles | Go | 53.90% | Medium | |
0548 | Split Array with Equal Sum | 43.50% | Medium | ||
0549 | Binary Tree Longest Consecutive Sequence II | 44.50% | Medium | ||
0550 | Game Play Analysis IV | 42.20% | Medium | ||
0551 | Student Attendance Record I | 45.30% | Easy | ||
0552 | Student Attendance Record II | 33.30% | Hard | ||
0553 | Optimal Division | 55.50% | Medium | ||
0554 | Brick Wall | 47.80% | Medium | ||
0555 | Split Concatenated Strings | 40.00% | Medium | ||
0556 | Next Greater Element III | 30.00% | Medium | ||
0557 | Reverse Words in a String III | Go | 64.40% | Easy | |
0558 | Quad Tree Intersection | 41.10% | Easy | ||
0559 | Maximum Depth of N-ary Tree | 65.60% | Easy | ||
0560 | Subarray Sum Equals K | 42.30% | Medium | ||
0561 | Array Partition I | 69.30% | Easy | ||
0562 | Longest Line of Consecutive One in Matrix | 43.80% | Medium | ||
0563 | Binary Tree Tilt | 47.10% | Easy | ||
0564 | Find the Closest Palindrome | 18.90% | Hard | ||
0565 | Array Nesting | 52.80% | Medium | ||
0566 | Reshape the Matrix | Go | 59.00% | Easy | |
0567 | Permutation in String | Go | 38.60% | Medium | |
0568 | Maximum Vacation Days | 38.30% | Hard | ||
0569 | Median Employee Salary | 47.60% | Hard | ||
0570 | Managers with at Least 5 Direct Reports | 62.90% | Medium | ||
0571 | Find Median Given Frequency of Numbers | 46.80% | Hard | ||
0572 | Subtree of Another Tree | Go | 41.80% | Easy | |
0573 | Squirrel Simulation | 53.80% | Medium | ||
0574 | Winning Candidate | 36.80% | Medium | ||
0575 | Distribute Candies | Go | 59.80% | Easy | |
0576 | Out of Boundary Paths | 32.30% | Medium | ||
0577 | Employee Bonus | 59.90% | Easy | ||
0578 | Get Highest Answer Rate Question | 35.70% | Medium | ||
0579 | Find Cumulative Salary of an Employee | 34.30% | Hard | ||
0580 | Count Student Number in Departments | 42.90% | Medium | ||
0581 | Shortest Unsorted Continuous Subarray | 30.20% | Easy | ||
0582 | Kill Process | 56.50% | Medium | ||
0583 | Delete Operation for Two Strings | 45.10% | Medium | ||
0584 | Find Customer Referee | 67.90% | Easy | ||
0585 | Investments in 2016 | 47.70% | Medium | ||
0586 | Customer Placing the Largest Number of Orders | 66.90% | Easy | ||
0587 | Erect the Fence | 34.40% | Hard | ||
0588 | Design In-Memory File System | 40.00% | Hard | ||
0589 | N-ary Tree Preorder Traversal | 67.80% | Easy | ||
0590 | N-ary Tree Postorder Traversal | 67.90% | Easy | ||
0591 | Tag Validator | 32.90% | Hard | ||
0592 | Fraction Addition and Subtraction | 47.20% | Medium | ||
0593 | Valid Square | 40.60% | Medium | ||
0594 | Longest Harmonious Subsequence | Go | 44.00% | Easy | |
0595 | Big Countries | 74.00% | Easy | ||
0596 | Classes More Than 5 Students | 35.80% | Easy | ||
0597 | Friend Requests I: Overall Acceptance Rate | 39.80% | Easy | ||
0598 | Range Addition II | 48.70% | Easy | ||
0599 | Minimum Index Sum of Two Lists | Go | 48.20% | Easy | |
0600 | Non-negative Integers without Consecutive Ones | 32.80% | Hard | ||
0601 | Human Traffic of Stadium | 36.80% | Hard | ||
0602 | Friend Requests II: Who Has the Most Friends | 45.40% | Medium | ||
0603 | Consecutive Available Seats | 58.60% | Easy | ||
0604 | Design Compressed String Iterator | 34.90% | Easy | ||
0605 | Can Place Flowers | 31.00% | Easy | ||
0606 | Construct String from Binary Tree | 51.70% | Easy | ||
0607 | Sales Person | 57.30% | Easy | ||
0608 | Tree Node | 59.10% | Medium | ||
0609 | Find Duplicate File in System | 55.50% | Medium | ||
0610 | Triangle Judgement | 61.60% | Easy | ||
0611 | Valid Triangle Number | 45.40% | Medium | ||
0612 | Shortest Distance in a Plane | 54.00% | Medium | ||
0613 | Shortest Distance in a Line | 73.20% | Easy | ||
0614 | Second Degree Follower | 22.60% | Medium | ||
0615 | Average Salary: Departments VS Company | 38.00% | Hard | ||
0616 | Add Bold Tag in String | 39.40% | Medium | ||
0617 | Merge Two Binary Trees | 70.40% | Easy | ||
0618 | Students Report By Geography | 43.10% | Hard | ||
0619 | Biggest Single Number | 39.10% | Easy | ||
0620 | Not Boring Movies | 62.50% | Easy | ||
0621 | Task Scheduler | 45.70% | Medium | ||
0622 | Design Circular Queue | 39.70% | Medium | ||
0623 | Add One Row to Tree | 47.40% | Medium | ||
0624 | Maximum Distance in Arrays | 37.40% | Easy | ||
0625 | Minimum Factorization | 32.00% | Medium | ||
0626 | Exchange Seats | 54.80% | Medium | ||
0627 | Swap Salary | 69.20% | Easy | ||
0628 | Maximum Product of Three Numbers | Go | 46.20% | Easy | |
0629 | K Inverse Pairs Array | 29.30% | Hard | ||
0630 | Course Schedule III | 31.90% | Hard | ||
0631 | Design Excel Sum Formula | 29.30% | Hard | ||
0632 | Smallest Range | 47.90% | Hard | ||
0633 | Sum of Square Numbers | 32.70% | Easy | ||
0634 | Find the Derangement of An Array | 37.80% | Medium | ||
0635 | Design Log Storage System | 54.40% | Medium | ||
0636 | Exclusive Time of Functions | Go | 48.80% | Medium | |
0637 | Average of Levels in Binary Tree | Go | 59.00% | Easy | |
0638 | Shopping Offers | 48.90% | Medium | ||
0639 | Decode Ways II | 25.30% | Hard | ||
0640 | Solve the Equation | 40.40% | Medium | ||
0641 | Design Circular Deque | 49.80% | Medium | ||
0642 | Design Search Autocomplete System | 38.20% | Hard | ||
0643 | Maximum Average Subarray I | 39.70% | Easy | ||
0644 | Maximum Average Subarray II | 28.70% | Hard | ||
0645 | Set Mismatch | Go | 40.80% | Easy | |
0646 | Maximum Length of Pair Chain | 49.00% | Medium | ||
0647 | Palindromic Substrings | 57.20% | Medium | ||
0648 | Replace Words | Go | 52.20% | Medium | |
0649 | Dota2 Senate | 37.80% | Medium | ||
0650 | 2 Keys Keyboard | 46.80% | Medium | ||
0651 | 4 Keys Keyboard | 50.80% | Medium | ||
0652 | Find Duplicate Subtrees | 45.90% | Medium | ||
0653 | Two Sum IV - Input is a BST | 52.60% | Easy | ||
0654 | Maximum Binary Tree | 76.40% | Medium | ||
0655 | Print Binary Tree | 52.10% | Medium | ||
0656 | Coin Path | 27.00% | Hard | ||
0657 | Robot Return to Origin | 71.70% | Easy | ||
0658 | Find K Closest Elements | 38.20% | Medium | ||
0659 | Split Array into Consecutive Subsequences | 40.80% | Medium | ||
0660 | Remove 9 | 51.60% | Hard | ||
0661 | Image Smoother | 49.00% | Easy | ||
0662 | Maximum Width of Binary Tree | 39.60% | Medium | ||
0663 | Equal Tree Partition | 38.10% | Medium | ||
0664 | Strange Printer | 36.90% | Hard | ||
0665 | Non-decreasing Array | 19.50% | Easy | ||
0666 | Path Sum IV | 52.50% | Medium | ||
0667 | Beautiful Arrangement II | 52.10% | Medium | ||
0668 | Kth Smallest Number in Multiplication Table | 42.20% | Hard | ||
0669 | Trim a Binary Search Tree | 60.50% | Easy | ||
0670 | Maximum Swap | 39.80% | Medium | ||
0671 | Second Minimum Node In a Binary Tree | 43.30% | Easy | ||
0672 | Bulb Switcher II | 50.10% | Medium | ||
0673 | Number of Longest Increasing Subsequence | 33.70% | Medium | ||
0674 | Longest Continuous Increasing Subsequence | 44.40% | Easy | ||
0675 | Cut Off Trees for Golf Event | 30.80% | Hard | ||
0676 | Implement Magic Dictionary | Go | 51.70% | Medium | |
0677 | Map Sum Pairs | 51.80% | Medium | ||
0678 | Valid Parenthesis String | 32.90% | Medium | ||
0679 | 24 Game | 43.00% | Hard | ||
0680 | Valid Palindrome II | 34.30% | Easy | ||
0681 | Next Closest Time | 42.70% | Medium | ||
0682 | Baseball Game | Go | 61.20% | Easy | |
0683 | K Empty Slots | 34.20% | Hard | ||
0684 | Redundant Connection | Go | 52.10% | Medium | |
0685 | Redundant Connection II | Go | 30.80% | Hard | |
0686 | Repeated String Match | 31.50% | Easy | ||
0687 | Longest Univalue Path | 33.90% | Easy | ||
0688 | Knight Probability in Chessboard | 44.60% | Medium | ||
0689 | Maximum Sum of 3 Non-Overlapping Subarrays | 44.20% | Hard | ||
0690 | Employee Importance | 54.40% | Easy | ||
0691 | Stickers to Spell Word | 38.50% | Hard | ||
0692 | Top K Frequent Words | 46.00% | Medium | ||
0693 | Binary Number with Alternating Bits | Go | 58.00% | Easy | |
0694 | Number of Distinct Islands | 51.40% | Medium | ||
0695 | Max Area of Island | 57.60% | Medium | ||
0696 | Count Binary Substrings | 53.60% | Easy | ||
0697 | Degree of an Array | 50.60% | Easy | ||
0698 | Partition to K Equal Sum Subsets | 42.50% | Medium | ||
0699 | Falling Squares | 40.10% | Hard | ||
0700 | Search in a Binary Search Tree | 68.60% | Easy | ||
0701 | Insert into a Binary Search Tree | 76.10% | Medium | ||
0702 | Search in a Sorted Array of Unknown Size | 59.30% | Medium | ||
0703 | Kth Largest Element in a Stream | 46.60% | Easy | ||
0704 | Binary Search | 48.00% | Easy | ||
0705 | Design HashSet | Go | 53.90% | Easy | |
0706 | Design HashMap | Go | 56.30% | Easy | |
0707 | Design Linked List | Go | 21.60% | Easy | |
0708 | Insert into a Cyclic Sorted List | 29.20% | Medium | ||
0709 | To Lower Case | 77.00% | Easy | ||
0710 | Random Pick with Blacklist | Go | 31.30% | Hard | |
0711 | Number of Distinct Islands II | 46.20% | Hard | ||
0712 | Minimum ASCII Delete Sum for Two Strings | 54.80% | Medium | ||
0713 | Subarray Product Less Than K | Go | 36.80% | Medium | |
0714 | Best Time to Buy and Sell Stock with Transaction Fee | Go | 50.60% | Medium | |
0715 | Range Module | 35.70% | Hard | ||
0716 | Max Stack | 40.20% | Easy | ||
0717 | 1-bit and 2-bit Characters | Go | 49.20% | Easy | |
0718 | Maximum Length of Repeated Subarray | 46.30% | Medium | ||
0719 | Find K-th Smallest Pair Distance | 29.30% | Hard | ||
0720 | Longest Word in Dictionary | Go | 45.00% | Easy | |
0721 | Accounts Merge | Go | 40.80% | Medium | |
0722 | Remove Comments | 31.40% | Medium | ||
0723 | Candy Crush | 63.40% | Medium | ||
0724 | Find Pivot Index | 41.30% | Easy | ||
0725 | Split Linked List in Parts | Go | 49.10% | Medium | |
0726 | Number of Atoms | Go | 44.90% | Hard | |
0727 | Minimum Window Subsequence | 37.50% | Hard | ||
0728 | Self Dividing Numbers | 70.50% | Easy | ||
0729 | My Calendar I | 47.60% | Medium | ||
0730 | Count Different Palindromic Subsequences | 39.20% | Hard | ||
0731 | My Calendar II | 44.80% | Medium | ||
0732 | My Calendar III | 55.20% | Hard | ||
0733 | Flood Fill | Go | 51.10% | Easy | |
0734 | Sentence Similarity | 40.80% | Easy | ||
0735 | Asteroid Collision | Go | 38.60% | Medium | |
0736 | Parse Lisp Expression | 44.30% | Hard | ||
0737 | Sentence Similarity II | 43.60% | Medium | ||
0738 | Monotone Increasing Digits | 42.00% | Medium | ||
0739 | Daily Temperatures | Go | 60.10% | Medium | |
0740 | Delete and Earn | 46.10% | Medium | ||
0741 | Cherry Pickup | 30.10% | Hard | ||
0742 | Closest Leaf in a Binary Tree | 39.40% | Medium | ||
0743 | Network Delay Time | 42.40% | Medium | ||
0744 | Find Smallest Letter Greater Than Target | 44.10% | Easy | ||
0745 | Prefix and Suffix Search | Go | 30.90% | Hard | |
0746 | Min Cost Climbing Stairs | Go | 47.50% | Easy | |
0747 | Largest Number At Least Twice of Others | 40.70% | Easy | ||
0748 | Shortest Completing Word | Go | 54.50% | Easy | |
0749 | Contain Virus | 41.40% | Hard | ||
0750 | Number Of Corner Rectangles | 64.80% | Medium | ||
0751 | IP to CIDR | 59.70% | Easy | ||
0752 | Open the Lock | 46.30% | Medium | ||
0753 | Cracking the Safe | 46.60% | Hard | ||
0754 | Reach a Number | 32.80% | Easy | ||
0755 | Pour Water | 40.80% | Medium | ||
0756 | Pyramid Transition Matrix | Go | 51.80% | Medium | |
0757 | Set Intersection Size At Least Two | 37.00% | Hard | ||
0758 | Bold Words in String | 42.70% | Easy | ||
0759 | Employee Free Time | 61.50% | Hard | ||
0760 | Find Anagram Mappings | 79.40% | Easy | ||
0761 | Special Binary String | 52.00% | Hard | ||
0762 | Prime Number of Set Bits in Binary Representation | Go | 59.60% | Easy | |
0763 | Partition Labels | Go | 70.80% | Medium | |
0764 | Largest Plus Sign | 43.50% | Medium | ||
0765 | Couples Holding Hands | 51.70% | Hard | ||
0766 | Toeplitz Matrix | Go | 61.90% | Easy | |
0767 | Reorganize String | Go | 42.70% | Medium | |
0768 | Max Chunks To Make Sorted II | 46.10% | Hard | ||
0769 | Max Chunks To Make Sorted | 51.90% | Medium | ||
0770 | Basic Calculator IV | 45.70% | Hard | ||
0771 | Jewels and Stones | Go | 83.20% | Easy | |
0772 | Basic Calculator III | 43.40% | Hard | ||
0773 | Sliding Puzzle | 52.90% | Hard | ||
0774 | Minimize Max Distance to Gas Station | 42.00% | Hard | ||
0775 | Global and Local Inversions | 39.10% | Medium | ||
0776 | Split BST | 52.70% | Medium | ||
0777 | Swap Adjacent in LR String | 33.40% | Medium | ||
0778 | Swim in Rising Water | Go | 47.80% | Hard | |
0779 | K-th Symbol in Grammar | 37.50% | Medium | ||
0780 | Reaching Points | 27.60% | Hard | ||
0781 | Rabbits in Forest | Go | 51.80% | Medium | |
0782 | Transform to Chessboard | 39.80% | Hard | ||
0783 | Minimum Distance Between BST Nodes | 50.60% | Easy | ||
0784 | Letter Case Permutation | Go | 57.40% | Easy | |
0785 | Is Graph Bipartite? | 43.50% | Medium | ||
0786 | K-th Smallest Prime Fraction | 39.90% | Hard | ||
0787 | Cheapest Flights Within K Stops | 35.20% | Medium | ||
0788 | Rotated Digits | 54.40% | Easy | ||
0789 | Escape The Ghosts | 55.40% | Medium | ||
0790 | Domino and Tromino Tiling | 36.00% | Medium | ||
0791 | Custom Sort String | 62.30% | Medium | ||
0792 | Number of Matching Subsequences | 43.40% | Medium | ||
0793 | Preimage Size of Factorial Zeroes Function | 39.10% | Hard | ||
0794 | Valid Tic-Tac-Toe State | 29.80% | Medium | ||
0795 | Number of Subarrays with Bounded Maximum | 43.40% | Medium | ||
0796 | Rotate String | 49.10% | Easy | ||
0797 | All Paths From Source to Target | 70.70% | Medium | ||
0798 | Smallest Rotation with Highest Score | 40.40% | Hard | ||
0799 | Champagne Tower | 34.20% | Medium | ||
0800 | Similar RGB Color | 59.80% | Easy | ||
0801 | Minimum Swaps To Make Sequences Increasing | 34.90% | Medium | ||
0802 | Find Eventual Safe States | 44.10% | Medium | ||
0803 | Bricks Falling When Hit | 28.80% | Hard | ||
0804 | Unique Morse Code Words | 74.90% | Easy | ||
0805 | Split Array With Same Average | 24.50% | Hard | ||
0806 | Number of Lines To Write String | 63.20% | Easy | ||
0807 | Max Increase to Keep City Skyline | 81.60% | Medium | ||
0808 | Soup Servings | 37.50% | Medium | ||
0809 | Expressive Words | 43.70% | Medium | ||
0810 | Chalkboard XOR Game | 45.10% | Hard | ||
0811 | Subdomain Visit Count | Go | 65.60% | Easy | |
0812 | Largest Triangle Area | 56.30% | Easy | ||
0813 | Largest Sum of Averages | 45.50% | Medium | ||
0814 | Binary Tree Pruning | 71.20% | Medium | ||
0815 | Bus Routes | 40.30% | Hard | ||
0816 | Ambiguous Coordinates | 44.20% | Medium | ||
0817 | Linked List Components | Go | 54.80% | Medium | |
0818 | Race Car | 35.20% | Hard | ||
0819 | Most Common Word | Go | 42.20% | Easy | |
0820 | Short Encoding of Words | 47.40% | Medium | ||
0821 | Shortest Distance to a Character | 63.60% | Easy | ||
0822 | Card Flipping Game | 40.50% | Medium | ||
0823 | Binary Trees With Factors | 32.60% | Medium | ||
0824 | Goat Latin | 57.90% | Easy | ||
0825 | Friends Of Appropriate Ages | 36.50% | Medium | ||
0826 | Most Profit Assigning Work | Go | 35.90% | Medium | |
0827 | Making A Large Island | 43.40% | Hard | ||
0828 | Unique Letter String | Go | 39.80% | Hard | |
0829 | Consecutive Numbers Sum | 33.50% | Hard | ||
0830 | Positions of Large Groups | 47.90% | Easy | ||
0831 | Masking Personal Information | 42.20% | Medium | ||
0832 | Flipping an Image | 72.90% | Easy | ||
0833 | Find And Replace in String | 46.50% | Medium | ||
0834 | Sum of Distances in Tree | 39.70% | Hard | ||
0835 | Image Overlap | 52.90% | Medium | ||
0836 | Rectangle Overlap | 46.60% | Easy | ||
0837 | New 21 Game | 31.80% | Medium | ||
0838 | Push Dominoes | Go | 44.00% | Medium | |
0839 | Similar String Groups | Go | 34.70% | Hard | |
0840 | Magic Squares In Grid | 35.60% | Easy | ||
0841 | Keys and Rooms | 60.50% | Medium | ||
0842 | Split Array into Fibonacci Sequence | Go | 34.90% | Medium | |
0843 | Guess the Word | 43.60% | Hard | ||
0844 | Backspace String Compare | Go | 46.10% | Easy | |
0845 | Longest Mountain in Array | Go | 34.40% | Medium | |
0846 | Hand of Straights | 49.50% | Medium | ||
0847 | Shortest Path Visiting All Nodes | 47.10% | Hard | ||
0848 | Shifting Letters | 41.00% | Medium | ||
0849 | Maximize Distance to Closest Person | 41.00% | Easy | ||
0850 | Rectangle Area II | 45.00% | Hard | ||
0851 | Loud and Rich | 47.80% | Medium | ||
0852 | Peak Index in a Mountain Array | 69.70% | Easy | ||
0853 | Car Fleet | Go | 40.00% | Medium | |
0854 | K-Similar Strings | 33.80% | Hard | ||
0855 | Exam Room | 38.60% | Medium | ||
0856 | Score of Parentheses | Go | 56.50% | Medium | |
0857 | Minimum Cost to Hire K Workers | 47.60% | Hard | ||
0858 | Mirror Reflection | 52.00% | Medium | ||
0859 | Buddy Strings | 27.60% | Easy | ||
0860 | Lemonade Change | 50.60% | Easy | ||
0861 | Score After Flipping Matrix | 69.80% | Medium | ||
0862 | Shortest Subarray with Sum at Least K | 22.20% | Hard | ||
0863 | All Nodes Distance K in Binary Tree | 48.00% | Medium | ||
0864 | Shortest Path to Get All Keys | 36.20% | Hard | ||
0865 | Smallest Subtree with all the Deepest Nodes | 56.00% | Medium | ||
0866 | Prime Palindrome | 20.30% | Medium | ||
0867 | Transpose Matrix | Go | 63.90% | Easy | |
0868 | Binary Gap | 59.50% | Easy | ||
0869 | Reordered Power of 2 | 51.10% | Medium | ||
0870 | Advantage Shuffle | 42.60% | Medium | ||
0871 | Minimum Number of Refueling Stops | 29.10% | Hard | ||
0872 | Leaf-Similar Trees | 63.50% | Easy | ||
0873 | Length of Longest Fibonacci Subsequence | 46.40% | Medium | ||
0874 | Walking Robot Simulation | 32.30% | Easy | ||
0875 | Koko Eating Bananas | 46.20% | Medium | ||
0876 | Middle of the Linked List | Go | 64.40% | Easy | |
0877 | Stone Game | 61.50% | Medium | ||
0878 | Nth Magical Number | 25.60% | Hard | ||
0879 | Profitable Schemes | 36.80% | Hard | ||
0880 | Decoded String at Index | Go | 23.00% | Medium | |
0881 | Boats to Save People | Go | 44.00% | Medium | |
0882 | Reachable Nodes In Subdivided Graph | 38.30% | Hard | ||
0883 | Projection Area of 3D Shapes | 65.80% | Easy | ||
0884 | Uncommon Words from Two Sentences | Go | 60.90% | Easy | |
0885 | Spiral Matrix III | Go | 64.40% | Medium | |
0886 | Possible Bipartition | 40.90% | Medium | ||
0887 | Super Egg Drop | 24.80% | Hard | ||
0888 | Fair Candy Swap | 56.80% | Easy | ||
0889 | Construct Binary Tree from Preorder and Postorder Traversal | 60.30% | Medium | ||
0890 | Find and Replace Pattern | 71.30% | Medium | ||
0891 | Sum of Subsequence Widths | Go | 29.10% | Hard | |
0892 | Surface Area of 3D Shapes | 56.10% | Easy | ||
0893 | Groups of Special-Equivalent Strings | 62.80% | Easy | ||
0894 | All Possible Full Binary Trees | 71.00% | Medium | ||
0895 | Maximum Frequency Stack | Go | 56.40% | Hard | |
0896 | Monotonic Array | 55.40% | Easy | ||
0897 | Increasing Order Search Tree | 64.90% | Easy | ||
0898 | Bitwise ORs of Subarrays | Go | 34.40% | Medium | |
0899 | Orderly Queue | 47.50% | Hard | ||
0900 | RLE Iterator | 50.30% | Medium | ||
0901 | Online Stock Span | Go | 49.40% | Medium | |
0902 | Numbers At Most N Given Digit Set | 28.70% | Hard | ||
0903 | Valid Permutations for DI Sequence | 44.70% | Hard | ||
0904 | Fruit Into Baskets | Go | 41.60% | Medium | |
0905 | Sort Array By Parity | 72.60% | Easy | ||
0906 | Super Palindromes | 30.40% | Hard | ||
0907 | Sum of Subarray Minimums | Go | 27.60% | Medium | |
0908 | Smallest Range I | 64.60% | Easy | ||
0909 | Snakes and Ladders | 33.80% | Medium | ||
0910 | Smallest Range II | 23.70% | Medium | ||
0911 | Online Election | 47.10% | Medium | ||
0912 | Sort an Array | 63.60% | Medium | ||
0913 | Cat and Mouse | 28.80% | Hard | ||
0914 | X of a Kind in a Deck of Cards | 34.10% | Easy | ||
0915 | Partition Array into Disjoint Intervals | 43.50% | Medium | ||
0916 | Word Subsets | 45.40% | Medium | ||
0917 | Reverse Only Letters | 55.90% | Easy | ||
0918 | Maximum Sum Circular Subarray | Go | 32.00% | Medium | |
0919 | Complete Binary Tree Inserter | 55.20% | Medium | ||
0920 | Number of Music Playlists | Go | 43.90% | Hard | |
0921 | Minimum Add to Make Parentheses Valid | Go | 70.30% | Medium | |
0922 | Sort Array By Parity II | Go | 67.10% | Easy | |
0923 | 3Sum With Multiplicity | Go | 33.90% | Medium | |
0924 | Minimize Malware Spread | 40.10% | Hard | ||
0925 | Long Pressed Name | Go | 44.50% | Easy | |
0926 | Flip String to Monotone Increasing | 49.80% | Medium | ||
0927 | Three Equal Parts | 30.40% | Hard | ||
0928 | Minimize Malware Spread II | 39.50% | Hard | ||
0929 | Unique Email Addresses | 70.50% | Easy | ||
0930 | Binary Subarrays With Sum | Go | 38.20% | Medium | |
0931 | Minimum Falling Path Sum | 59.00% | Medium | ||
0932 | Beautiful Array | 53.60% | Medium | ||
0933 | Number of Recent Calls | 69.40% | Easy | ||
0934 | Shortest Bridge | 44.20% | Medium | ||
0935 | Knight Dialer | 41.10% | Medium | ||
0936 | Stamping The Sequence | 36.20% | Hard | ||
0937 | Reorder Log Files | 56.90% | Easy | ||
0938 | Range Sum of BST | 78.80% | Easy | ||
0939 | Minimum Area Rectangle | 50.50% | Medium | ||
0940 | Distinct Subsequences II | 39.80% | Hard | ||
0941 | Valid Mountain Array | 35.50% | Easy | ||
0942 | DI String Match | Go | 70.00% | Easy | |
0943 | Find the Shortest Superstring | 38.30% | Hard | ||
0944 | Delete Columns to Make Sorted | 69.40% | Easy | ||
0945 | Minimum Increment to Make Array Unique | 42.90% | Medium | ||
0946 | Validate Stack Sequences | Go | 57.60% | Medium | |
0947 | Most Stones Removed with Same Row or Column | Go | 54.20% | Medium | |
0948 | Bag of Tokens | 39.30% | Medium | ||
0949 | Largest Time for Given Digits | 34.20% | Easy | ||
0950 | Reveal Cards In Increasing Order | 72.20% | Medium | ||
0951 | Flip Equivalent Binary Trees | 65.20% | Medium | ||
0952 | Largest Component Size by Common Factor | 26.60% | Hard | ||
0953 | Verifying an Alien Dictionary | Go | 55.60% | Easy | |
0954 | Array of Doubled Pairs | 34.40% | Medium | ||
0955 | Delete Columns to Make Sorted II | 31.60% | Medium | ||
0956 | Tallest Billboard | 38.40% | Hard | ||
0957 | Prison Cells After N Days | 38.20% | Medium | ||
0958 | Check Completeness of a Binary Tree | 47.60% | Medium | ||
0959 | Regions Cut By Slashes | Go | 62.50% | Medium | |
0960 | Delete Columns to Make Sorted III | 52.80% | Hard | ||
0961 | N-Repeated Element in Size 2N Array | Go | 72.40% | Easy | |
0962 | Maximum Width Ramp | 41.80% | Medium | ||
0963 | Minimum Area Rectangle II | 44.50% | Medium | ||
0964 | Least Operators to Express Number | 40.90% | Hard | ||
0965 | Univalued Binary Tree | 66.90% | Easy | ||
0966 | Vowel Spellchecker | 41.90% | Medium | ||
0967 | Numbers With Same Consecutive Differences | 37.10% | Medium | ||
0968 | Binary Tree Cameras | 35.40% | Hard | ||
0969 | Pancake Sorting | Go | 62.40% | Medium | |
0970 | Powerful Integers | Go | 39.30% | Easy | |
0971 | Flip Binary Tree To Match Preorder Traversal | 43.00% | Medium | ||
0972 | Equal Rational Numbers | 40.20% | Hard | ||
0973 | K Closest Points to Origin | Go | 62.20% | Medium | |
0974 | Subarray Sums Divisible by K | 45.20% | Medium | ||
0975 | Odd Even Jump | 47.20% | Hard | ||
0976 | Largest Perimeter Triangle | Go | 57.20% | Easy | |
0977 | Squares of a Sorted Array | Go | 72.00% | Easy | |
0978 | Longest Turbulent Subarray | 45.60% | Medium | ||
0979 | Distribute Coins in Binary Tree | 67.20% | Medium | ||
0980 | Unique Paths III | Go | 71.20% | Hard | |
0981 | Time Based Key-Value Store | 50.80% | Medium | ||
0982 | Triples with Bitwise AND Equal To Zero | 54.00% | Hard | ||
0983 | Minimum Cost For Tickets | 57.30% | Medium | ||
0984 | String Without AAA or BBB | Go | 33.90% | Medium | |
0985 | Sum of Even Numbers After Queries | 63.40% | Easy | ||
0986 | Interval List Intersections | Go | 63.30% | Medium | |
0987 | Vertical Order Traversal of a Binary Tree | 31.80% | Medium | ||
0988 | Smallest String Starting From Leaf | 46.00% | Medium | ||
0989 | Add to Array-Form of Integer | 44.70% | Easy | ||
0990 | Satisfiability of Equality Equations | Go | 40.10% | Medium | |
0991 | Broken Calculator | 40.40% | Medium | ||
0992 | Subarrays with K Different Integers | Go | 45.20% | Hard | |
0993 | Cousins in Binary Tree | Go | 52.40% | Easy | |
0994 | Rotting Oranges | 46.40% | Easy | ||
0995 | Minimum Number of K Consecutive Bit Flips | 48.40% | Hard | ||
0996 | Number of Squareful Arrays | Go | 47.80% | Hard | |
0997 | Find the Town Judge | 49.10% | Easy | ||
0998 | Maximum Binary Tree II | 61.60% | Medium | ||
0999 | Available Captures for Rook | 66.10% | Easy | ||
1000 | Minimum Cost to Merge Stones | 32.10% | Hard | ||
1001 | Grid Illumination | 34.40% | Hard | ||
1002 | Find Common Characters | Go | 65.80% | Easy | |
1003 | Check If Word Is Valid After Substitutions | Go | 51.80% | Medium | |
1004 | Max Consecutive Ones III | Go | 53.40% | Medium | |
1005 | Maximize Sum Of Array After K Negations | Go | 49.70% | Easy | |
1006 | Clumsy Factorial | 53.70% | Medium | ||
1007 | Minimum Domino Rotations For Equal Row | 47.90% | Medium | ||
1008 | Construct Binary Search Tree from Preorder Traversal | 73.10% | Medium | ||
1009 | Complement of Base 10 Integer | 58.90% | Easy | ||
1010 | Pairs of Songs With Total Durations Divisible by 60 | 45.60% | Easy | ||
1011 | Capacity To Ship Packages Within D Days | 53.30% | Medium | ||
1012 | Numbers With Repeated Digits | 34.80% | Hard | ||
1013 | Partition Array Into Three Parts With Equal Sum | 55.50% | Easy | ||
1014 | Best Sightseeing Pair | 49.30% | Medium | ||
1015 | Smallest Integer Divisible by K | 28.40% | Medium | ||
1016 | Binary String With Substrings Representing 1 To N | 60.70% | Medium | ||
1017 | Convert to Base -2 | Go | 56.70% | Medium | |
1018 | Binary Prefix Divisible By 5 | 46.60% | Easy | ||
1019 | Next Greater Node In Linked List | Go | 56.50% | Medium | |
1020 | Number of Enclaves | 54.70% | Medium | ||
1021 | Remove Outermost Parentheses | Go | 75.60% | Easy | |
1022 | Sum of Root To Leaf Binary Numbers | 55.90% | Easy | ||
1023 | Camelcase Matching | 56.50% | Medium | ||
1024 | Video Stitching | 47.20% | Medium | ||
1025 | Divisor Game | Go | 63.30% | Easy | |
1026 | Maximum Difference Between Node and Ancestor | 59.60% | Medium | ||
1027 | Longest Arithmetic Sequence | 47.90% | Medium | ||
1028 | Recover a Tree From Preorder Traversal | 70.20% | Hard | ||
1029 | Two City Scheduling | 53.90% | Easy | ||
1030 | Matrix Cells in Distance Order | Go | 65.20% | Easy | |
1031 | Maximum Sum of Two Non-Overlapping Subarrays | 55.30% | Medium | ||
1032 | Stream of Characters | 41.30% | Hard | ||
1033 | Moving Stones Until Consecutive | 35.50% | Easy | ||
1034 | Coloring A Border | 42.50% | Medium | ||
1035 | Uncrossed Lines | 51.80% | Medium | ||
1036 | Escape a Large Maze | 36.40% | Hard | ||
1037 | Valid Boomerang | 37.60% | Easy | ||
1038 | Binary Search Tree to Greater Sum Tree | 79.70% | Medium | ||
1039 | Minimum Score Triangulation of Polygon | 41.50% | Medium | ||
1040 | Moving Stones Until Consecutive II | 46.20% | Medium | ||
1041 | Robot Bounded In Circle | 43.40% | Easy | ||
1042 | Flower Planting With No Adjacent | 48.40% | Easy | ||
1043 | Partition Array for Maximum Sum | 62.40% | Medium | ||
1044 | Longest Duplicate Substring | 22.80% | Hard | ||
1045 | Customers Who Bought All Products | 64.10% | Medium | ||
1046 | Last Stone Weight | 62.40% | Easy | ||
1047 | Remove All Adjacent Duplicates In String | Go | 63.60% | Easy | |
1048 | Longest String Chain | 47.30% | Medium | ||
1049 | Last Stone Weight II | 39.90% | Medium | ||
1050 | Actors and Directors Who Cooperated At Least Three Times | 75.40% | Easy | ||
1051 | Height Checker | 69.40% | Easy | ||
1052 | Grumpy Bookstore Owner | 52.00% | Medium | ||
1053 | Previous Permutation With One Swap | 47.10% | Medium | ||
1054 | Distant Barcodes | Go | 38.60% | Medium | |
1055 | Shortest Way to Form String | 58.20% | Medium | ||
1056 | Confusing Number | 52.10% | Easy | ||
1057 | Campus Bikes | 58.90% | Medium | ||
1058 | Minimize Rounding Error to Meet Target | 41.30% | Medium | ||
1059 | All Paths from Source Lead to Destination | 45.60% | Medium | ||
1060 | Missing Element in Sorted Array | 54.20% | Medium | ||
1061 | Lexicographically Smallest Equivalent String | 59.30% | Medium | ||
1062 | Longest Repeating Substring | 50.80% | Medium | ||
1063 | Number of Valid Subarrays | 74.30% | Hard | ||
1064 | Fixed Point | 79.90% | Easy | ||
1065 | Index Pairs of a String | 59.30% | Easy | ||
1066 | Campus Bikes II | 43.30% | Medium | ||
1067 | Digit Count in Range | 34.40% | Hard | ||
1068 | Product Sales Analysis I | 77.50% | Easy | ||
1069 | Product Sales Analysis II | 79.90% | Easy | ||
1070 | Product Sales Analysis III | 42.70% | Medium | ||
1071 | Greatest Common Divisor of Strings | 53.60% | Easy | ||
1072 | Flip Columns For Maximum Number of Equal Rows | 56.20% | Medium | ||
1073 | Adding Two Negabinary Numbers | Go | 31.60% | Medium | |
1074 | Number of Submatrices That Sum to Target | 58.50% | Hard | ||
1075 | Project Employees I | 58.70% | Easy | ||
1076 | Project Employees II | 52.80% | Easy | ||
1077 | Project Employees III | 76.90% | Medium | ||
1078 | Occurrences After Bigram | Go | 67.40% | Easy | |
1079 | Letter Tile Possibilities | Go | 76.50% | Medium | |
1080 | Insufficient Nodes in Root to Leaf Paths | 41.10% | Medium | ||
1081 | Smallest Subsequence of Distinct Characters | 42.80% | Medium | ||
1082 | Sales Analysis I | 74.20% | Easy | ||
1083 | Sales Analysis II | 55.00% | Easy | ||
1084 | Sales Analysis III | 57.80% | Easy | ||
1085 | Sum of Digits in the Minimum Number | 75.30% | Easy | ||
1086 | High Five | 76.90% | Easy | ||
1087 | Brace Expansion | 57.50% | Medium | ||
1088 | Confusing Number II | 34.10% | Hard | ||
1089 | Duplicate Zeros | 58.80% | Easy | ||
1090 | Largest Values From Labels | 56.00% | Medium | ||
1091 | Shortest Path in Binary Matrix | 35.90% | Medium | ||
1092 | Shortest Common Supersequence | 47.20% | Hard | ||
1093 | Statistics from a Large Sample | Go | 41.10% | Medium | |
1094 | Car Pooling | 57.10% | Medium | ||
1095 | Find in Mountain Array | 32.50% | Hard | ||
1096 | Brace Expansion II | 52.00% | Hard | ||
1097 | Game Play Analysis V | 51.10% | Hard | ||
1098 | Unpopular Books | 43.20% | Medium | ||
1099 | Two Sum Less Than K | 62.80% | Easy | ||
1100 | Find K-Length Substrings With No Repeated Characters | 72.40% | Medium | ||
1101 | The Earliest Moment When Everyone Become Friends | 62.20% | Medium | ||
1102 | Path With Maximum Minimum Value | 42.50% | Medium | ||
1103 | Distribute Candies to People | 62.00% | Easy | ||
1104 | Path In Zigzag Labelled Binary Tree | 71.10% | Medium | ||
1105 | Filling Bookcase Shelves | Go | 53.80% | Medium | |
1106 | Parsing A Boolean Expression | 59.00% | Hard | ||
1107 | New Users Daily Count | 46.30% | Medium | ||
1108 | Defanging an IP Address | 87.50% | Easy | ||
1109 | Corporate Flight Bookings | 47.30% | Medium | ||
1110 | Delete Nodes And Return Forest | 61.90% | Medium | ||
1111 | Maximum Nesting Depth of Two Valid Parentheses Strings | 63.30% | Medium | ||
1112 | Highest Grade For Each Student | 60.80% | Medium | ||
1113 | Reported Posts | 68.20% | Easy | ||
1114 | Print in Order | 59.20% | Easy | ||
1115 | Print FooBar Alternately | 59.40% | Medium | ||
1116 | Print Zero Even Odd | 55.40% | Medium | ||
1117 | Building H2O | 50.40% | Hard | ||
1118 | Number of Days in a Month | 57.50% | Easy | ||
1119 | Remove Vowels from a String | 91.10% | Easy | ||
1120 | Maximum Average Subtree | 60.90% | Medium | ||
1121 | Divide Array Into Increasing Sequences | 51.20% | Hard | ||
1122 | Relative Sort Array | 68.50% | Easy | ||
1123 | Lowest Common Ancestor of Deepest Leaves | 64.60% | Medium | ||
1124 | Longest Well-Performing Interval | 27.40% | Medium | ||
1125 | Smallest Sufficient Team | 43.50% | Hard | ||
1126 | Active Businesses | 70.80% | Medium | ||
1127 | User Purchase Platform | 64.50% | Hard | ||
1128 | Number of Equivalent Domino Pairs | 40.30% | Easy | ||
1129 | Shortest Path with Alternating Colors | 34.20% | Medium | ||
1130 | Minimum Cost Tree From Leaf Values | 56.30% | Medium | ||
1131 | Maximum of Absolute Value Expression | 48.20% | Medium | ||
------------ | ------------------------------------------------------- | ------- | ---------------- | --------------- | ------------- |
下面这些是免费的算法题,但是暂时还不能使用 Go 解答的:
- 116.Populating Next Right Pointers in Each Node
- 117.Populating Next Right Pointers in Each Node II
- 133.Clone Graph
- 138.Copy List with Random Pointer
- 141.Linked List Cycle
- 142.Linked List Cycle II
- 151.Reverse Words in a String
- 160.Intersection of Two Linked Lists
- 173.Binary Search Tree Iterator
- 222.Count Complete Tree Nodes
- 235.Lowest Common Ancestor of a Binary Search Tree
- 236.Lowest Common Ancestor of a Binary Tree
- 237.Delete Node in a Linked List
- 278.First Bad Version
- 284.Peeking Iterator
- 297.Serialize and Deserialize Binary Tree
- 341.Flatten Nested List Iterator
- 374.Guess Number Higher or Lower
- 386.Lexicographical Numbers
- 449.Serialize and Deserialize BST
- 535.Encode and Decode TinyURL
- 690.Employee Importance
- 708.Insert into a Cyclic Sorted List
Title | Solution | Difficulty | Time | Space | 收藏 |
---|---|---|---|---|---|
3. Longest Substring Without Repeating Characters | Go | Medium | O(n) | O(1) | ❤️ |
17. Letter Combinations of a Phone Number | Go | Medium | O(log n) | O(1) | |
20. Valid Parentheses | Go | Easy | O(log n) | O(1) | |
22. Generate Parentheses | Go | Medium | O(log n) | O(1) | |
28. Implement strStr() | Go | Easy | O(n) | O(1) | |
30. Substring with Concatenation of All Words | Go | Hard | O(n) | O(n) | ❤️ |
49. Group Anagrams | Go | Medium | O(n log n) | O(n) | |
71. Simplify Path | Go | Medium | O(n) | O(n) | |
76. Minimum Window Substring | Go | Hard | O(n) | O(n) | ❤️ |
91. Decode Ways | Go | Medium | O(n) | O(n) | |
93. Restore IP Addresses | Go | Medium | O(n) | O(n) | ❤️ |
125. Valid Palindrome | Go | Easy | O(n) | O(1) | |
126. Word Ladder II | Go | Hard | O(n) | O(n^2) | ❤️ |
344. Reverse String | Go | Easy | O(n) | O(1) | |
345. Reverse Vowels of a String | Go | Easy | O(n) | O(1) | |
767. Reorganize String | Go | Medium | O(n log n) | O(log n) | ❤️ |
842. Split Array into Fibonacci Sequence | Go | Medium | O(n^2) | O(1) | ❤️ |
856. Score of Parentheses | Go | Medium | O(n) | O(n) | |
925. Long Pressed Name | Go | Easy | O(n) | O(1) | |
1003. Check If Word Is Valid After Substitutions | Go | Medium | O(n) | O(1) | |
----------------------------------------------------------------- | ------------- | ------------- | -------------------------- | -------------------------- | ------------- |
- 双指针滑动窗口的经典写法。右指针不断往右移,移动到不能往右移动为止(具体条件根据题目而定)。当右指针到最右边以后,开始挪动左指针,释放窗口左边界。第 3 题,第 76 题,第 209 题,第 438 题,第 567 题,第 713 题,第 763 题,第 845 题,第 881 题,第 904 题,第 992 题,第 1004 题。
left, right := 0, -1
for left < len(s) {
if right+1 < len(s) && freq[s[right+1]-'a'] == 0 {
freq[s[right+1]-'a']++
right++
} else {
freq[s[left]-'a']--
left++
}
result = max(result, right-left+1)
}
- 快慢指针可以查找重复数字,时间复杂度 O(n),第 287 题。
- 替换字母以后,相同字母能出现连续最长的长度。第 424 题。
- SUM 问题集。第 1 题,第 15 题,第 16 题,第 18 题,第 167 题,第 923 题。
- 巧妙的构造虚拟头结点。可以使遍历处理逻辑更加统一。
- 灵活使用递归。构造递归条件,使用递归可以巧妙的解题。不过需要注意有些题目不能使用递归,因为递归深度太深会导致超时和栈溢出。
- 链表区间逆序。第 92 题。
- 链表寻找中间节点。第 876 题。链表寻找倒数第 n 个节点。第 19 题。只需要一次遍历就可以得到答案。
- 合并 K 个有序链表。第 21 题,第 23 题。
- 链表归类。第 86 题,第 328 题。
- 链表排序,时间复杂度要求 O(n * log n),空间复杂度 O(1)。只有一种做法,归并排序,至顶向下归并。第 148 题。
- 判断链表是否存在环,如果有环,输出环的交叉点的下标;判断 2 个链表是否有交叉点,如果有交叉点,输出交叉点。第 141 题,第 142 题,第 160 题。
- 括号匹配问题及类似问题。第 20 题,第 921 题,第 1021 题。
- 栈的基本 pop 和 push 操作。第 71 题,第 150 题,第 155 题,第 224 题,第 225 题,第 232 题,第 946 题,第 1047 题。
- 利用栈进行编码问题。第 394 题,第 682 题,第 856 题,第 880 题。
- 单调栈。利用栈维护一个单调递增或者递减的下标数组。第 84 题,第 456 题,第 496 题,第 503 题,第 739 题,第 901 题,第 907 题,第 1019 题。
Title | Solution | Difficulty | Time | Space | 收藏 |
---|---|---|---|---|---|
53. Maximum Subarray | Go | Easy | O(n) | O(n) | |
62. Unique Paths | Go | Medium | O(n^2) | O(n^2) | |
63. Unique Paths II | Go | Medium | O(n^2) | O(n^2) | |
64. Minimum Path Sum | Go | Medium | O(n^2) | O(n^2) | |
70. Climbing Stairs | Go | Easy | O(n) | O(n) | |
91. Decode Ways | Go | Medium | O(n) | O(n) | |
96. Unique Binary Search Trees | Go | Medium | O(n) | O(n) | |
120. Triangle | Go | Medium | O(n^2) | O(n) | |
121. Best Time to Buy and Sell Stock | Go | Easy | O(n) | O(1) | |
152. Maximum Product Subarray | Go | Medium | O(n) | O(1) | |
198. House Robber | Go | Easy | O(n) | O(n) | |
213. House Robber II | Go | Medium | O(n) | O(n) | |
300. Longest Increasing Subsequence | Go | Medium | O(n log n) | O(n) | |
309. Best Time to Buy and Sell Stock with Cooldown | Go | Medium | O(n) | O(n) | |
322. Coin Change | Go | Medium | O(n) | O(n) | |
338. Counting Bits | Go | Medium | O(n) | O(n) | |
343. Integer Break | Go | Medium | O(n^2) | O(n) | |
357. Count Numbers with Unique Digits | Go | Medium | O(1) | O(1) | |
392. Is Subsequence | Go | Medium | O(n) | O(1) | |
416. Partition Equal Subset Sum | Go | Medium | O(n^2) | O(n) | |
714. Best Time to Buy and Sell Stock with Transaction Fee | Go | Medium | O(n) | O(1) | |
746. Min Cost Climbing Stairs | Go | Easy | O(n) | O(1) | |
838. Push Dominoes | Go | Medium | O(n) | O(n) | |
1025. Divisor Game | Go | Easy | O(1) | O(1) | |
891. Sum of Subsequence Widths | Go | Hard | O(n log n) | O(1) | |
942. DI String Match | Go | Easy | O(n) | O(1) | |
----------------------------------------------------------------- | ------------- | ------------- | -------------------------- | -------------------------- | ------------- |
- 排列问题 Permutations。第 46 题,第 47 题。第 60 题,第 526 题,第 996 题。
- 组合问题 Combination。第 39 题,第 40 题,第 77 题,第 216 题。
- 排列和组合杂交问题。第 1079 题。
- N 皇后终极解法(二进制解法)。第 51 题,第 52 题。
- 数独问题。第 37 题。
- 四个方向搜索。第 79 题,第 212 题,第 980 题。
- 子集合问题。第 78 题,第 90 题。
- Trie。第 208 题,第 211 题。
- BFS 优化。第 126 题,第 127 题。
- DFS 模板。(只是一个例子,不对应任何题)
func combinationSum2(candidates []int, target int) [][]int {
if len(candidates) == 0 {
return [][]int{}
}
c, res := []int{}, [][]int{}
sort.Ints(candidates)
findcombinationSum2(candidates, target, 0, c, &res)
return res
}
func findcombinationSum2(nums []int, target, index int, c []int, res *[][]int) {
if target == 0 {
b := make([]int, len(c))
copy(b, c)
*res = append(*res, b)
return
}
for i := index; i < len(nums); i++ {
if i > index && nums[i] == nums[i-1] { // 这里是去重的关键逻辑
continue
}
if target >= nums[i] {
c = append(c, nums[i])
findcombinationSum2(nums, target-nums[i], i+1, c, res)
c = c[:len(c)-1]
}
}
}
- BFS 模板。(只是一个例子,不对应任何题)
func updateMatrix_BFS(matrix [][]int) [][]int {
res := make([][]int, len(matrix))
if len(matrix) == 0 || len(matrix[0]) == 0 {
return res
}
queue := make([][]int, 0)
for i, _ := range matrix {
res[i] = make([]int, len(matrix[0]))
for j, _ := range res[i] {
if matrix[i][j] == 0 {
res[i][j] = -1
queue = append(queue, []int{i, j})
}
}
}
level := 1
for len(queue) > 0 {
size := len(queue)
for size > 0 {
size -= 1
node := queue[0]
queue = queue[1:]
i, j := node[0], node[1]
for _, direction := range [][]int{{-1, 0}, {1, 0}, {0, 1}, {0, -1}} {
x := i + direction[0]
y := j + direction[1]
if x < 0 || x >= len(matrix) || y < 0 || y >= len(matrix[0]) || res[x][y] < 0 || res[x][y] > 0 {
continue
}
res[x][y] = level
queue = append(queue, []int{x, y})
}
}
level++
}
for i, row := range res {
for j, cell := range row {
if cell == -1 {
res[i][j] = 0
}
}
}
return res
}
Title | Solution | Difficulty | Time | Space | 收藏 |
---|---|---|---|---|---|
17. Letter Combinations of a Phone Number | Go | Medium | O(log n) | O(1) | |
22. Generate Parentheses | Go | Medium | O(log n) | O(1) | |
37. Sudoku Solver | Go | Hard | O(n^2) | O(n^2) | ❤️ |
39. Combination Sum | Go | Medium | O(n log n) | O(n) | |
40. Combination Sum II | Go | Medium | O(n log n) | O(n) | |
46. Permutations | Go | Medium | O(n) | O(n) | ❤️ |
47. Permutations II | Go | Medium | O(n^2) | O(n) | ❤️ |
51. N-Queens | Go | Hard | O(n^2) | O(n) | ❤️ |
52. N-Queens II | Go | Hard | O(n^2) | O(n) | ❤️ |
60. Permutation Sequence | Go | Medium | O(n log n) | O(1) | |
77. Combinations | Go | Medium | O(n) | O(n) | ❤️ |
78. Subsets | Go | Medium | O(n^2) | O(n) | ❤️ |
79. Word Search | Go | Medium | O(n^2) | O(n^2) | ❤️ |
89. Gray Codes | Go | Medium | O(n) | O(1) | |
90. Subsets II | Go | Medium | O(n^2) | O(n) | ❤️ |
93. Restore IP Addresses | Go | Medium | O(n) | O(n) | ❤️ |
126. Word Ladder II | Go | Hard | O(n) | O(n^2) | ❤️ |
131. Palindrome Partitioning | Go | Medium | O(n) | O(n^2) | ❤️ |
211. Add and Search Word - Data structure design | Go | Medium | O(n) | O(n) | ❤️ |
212. Word Search II | Go | Hard | O(n^2) | O(n^2) | ❤️ |
216. Combination Sum III | Go | Medium | O(n) | O(1) | ❤️ |
306. Additive Number | Go | Medium | O(n^2) | O(1) | ❤️ |
357. Count Numbers with Unique Digits | Go | Medium | O(1) | O(1) | |
401. Binary Watch | Go | Easy | O(1) | O(1) | |
526. Beautiful Arrangement | Go | Medium | O(n^2) | O(1) | ❤️ |
784. Letter Case Permutation | Go | Easy | O(n) | O(n) | |
842. Split Array into Fibonacci Sequence | Go | Medium | O(n^2) | O(1) | ❤️ |
980. Unique Paths III | Go | Hard | O(n log n) | O(n) | |
996. Number of Squareful Arrays | Go | Hard | O(n log n) | O(n) | |
1079. Letter Tile Possibilities | Go | Medium | O(n^2) | O(1) | ❤️ |
----------------------------------------------------------------- | ------------- | ------------- | -------------------------- | -------------------------- | ------------- |
Title | Solution | Difficulty | Time | Space | 收藏 |
---|---|---|---|---|---|
101. Symmetric Tree | Go | Easy | O(n) | O(1) | |
102. Binary Tree Level Order Traversal | Go | Medium | O(n) | O(1) | |
103. Binary Tree Zigzag Level Order Traversal | Go | Medium | O(n) | O(n) | |
107. Binary Tree Level Order Traversal II | Go | Easy | O(n) | O(1) | |
111. Minimum Depth of Binary Tree | Go | Easy | O(n) | O(1) | |
126. Word Ladder II | Go | Hard | O(n) | O(n^2) | ❤️ |
127. Word Ladder | Go | Medium | O(n) | O(n) | |
199. Binary Tree Right Side View | Go | Medium | O(n) | O(1) | |
200. Number of Islands | Go | Medium | O(n^2) | O(n^2) | |
207. Course Schedule | Go | Medium | O(n^2) | O(n^2) | |
210. Course Schedule II | Go | Medium | O(n^2) | O(n^2) | |
515. Find Largest Value in Each Tree Row | Go | Medium | O(n) | O(n) | |
542. 01 Matrix | Go | Medium | O(n) | O(1) | |
993. Cousins in Binary Tree | Go | Easy | O(n) | O(1) | |
----------------------------------------------------------------- | ------------- | ------------- | -------------------------- | -------------------------- | ------------- |
Title | Solution | Difficulty | Time | Space | 收藏 |
---|---|---|---|---|---|
50. Pow(x, n) | Go | Medium | O(log n) | O(1) | |
69. Sqrt(x) | Go | Easy | O(log n) | O(1) | |
167. Two Sum II - Input array is sorted | Go | Easy | O(n) | O(1) | |
209. Minimum Size Subarray Sum | Go | Medium | O(n) | O(1) | |
222. Count Complete Tree Nodes | Go | Medium | O(n) | O(1) | |
230. Kth Smallest Element in a BST | Go | Medium | O(n) | O(1) | |
287. Find the Duplicate Number | Go | Easy | O(n) | O(1) | ❤️ |
300. Longest Increasing Subsequence | Go | Medium | O(n log n) | O(n) | |
349. Intersection of Two Arrays | Go | Easy | O(n) | O(n) | |
350. Intersection of Two Arrays II | Go | Easy | O(n) | O(n) | |
392. Is Subsequence | Go | Medium | O(n) | O(1) | |
454. 4Sum II | Go | Medium | O(n^2) | O(n) | |
710. Random Pick with Blacklist | Go | Hard | O(n) | O(n) | |
----------------------------------------------------------------- | ------------- | ------------- | -------------------------- | -------------------------- | ------------- |
Title | Solution | Difficulty | Time | Space | 收藏 |
---|---|---|---|---|---|
2. Add Two Numbers | Go | Medium | O(n) | O(1) | |
50. Pow(x, n) | Go | Medium | O(log n) | O(1) | |
60. Permutation Sequence | Go | Medium | O(n log n) | O(1) | |
69. Sqrt(x) | Go | Easy | O(log n) | O(1) | |
202. Happy Number | Go | Easy | O(log n) | O(1) | |
224. Basic Calculator | Go | Hard | O(n) | O(n) | |
231. Power of Two | Go | Easy | O(1) | O(1) | |
263. Ugly Number | Go | Easy | O(log n) | O(1) | |
326. Power of Three | Go | Easy | O(1) | O(1) | |
343. Integer Break | Go | Medium | O(n^2) | O(n) | |
357. Count Numbers with Unique Digits | Go | Medium | O(1) | O(1) | |
628. Maximum Product of Three Numbers | Go | Easy | O(n) | O(1) | |
885. Spiral Matrix III | Go | Medium | O(n^2) | O(1) | |
891. Sum of Subsequence Widths | Go | Hard | O(n log n) | O(1) | |
942. DI String Match | Go | Easy | O(n) | O(1) | |
976. Largest Perimeter Triangle | Go | Easy | O(n log n) | O(log n) | |
996. Number of Squareful Arrays | Go | Hard | O(n log n) | O(n) | |
1025. Divisor Game | Go | Easy | O(1) | O(1) | |
----------------------------------------------------------------- | ------------- | ------------- | -------------------------- | -------------------------- | ------------- |
- 深刻的理解多路快排。第 75 题。
- 链表的排序,插入排序(第 147 题)和归并排序(第 148 题)
- 桶排序和基数排序。第 164 题。
- "摆动排序"。第 324 题。
- 两两不相邻的排序。第 767 题,第 1054 题。
- "饼子排序"。第 969 题。
Title | Solution | Difficulty | Time | Space | 收藏 |
---|---|---|---|---|---|
56. Merge Intervals | Go | Medium | O(n log n) | O(log n) | |
57. Insert Interval | Go | Hard | O(n) | O(1) | |
75. Sort Colors | Go | Medium | O(n) | O(1) | ❤️ |
147. Insertion Sort List | Go | Medium | O(n) | O(1) | ❤️ |
148. Sort List | Go | Medium | O(n log n) | O(log n) | ❤️ |
164. Maximum Gap | Go | Hard | O(n log n) | O(log n) | ❤️ |
179. Largest Number | Go | Medium | O(n log n) | O(log n) | ❤️ |
220. Contains Duplicate III | Go | Medium | O(n log n) | O(1) | ❤️ |
242. Valid Anagram | Go | Easy | O(n) | O(n) | |
274. H-Index | Go | Medium | O(n) | O(n) | |
324. Wiggle Sort II | Go | Medium | O(n) | O(n) | ❤️ |
349. Intersection of Two Arrays | Go | Easy | O(n) | O(n) | |
350. Intersection of Two Arrays II | Go | Easy | O(n) | O(n) | |
524. Longest Word in Dictionary through Deleting | Go | Medium | O(n) | O(1) | |
767. Reorganize String | Go | Medium | O(n log n) | O(log n) | ❤️ |
853. Car Fleet | Go | Medium | O(n log n) | O(log n) | |
710. Random Pick with Blacklist | Go | Hard | O(n) | O(n) | |
922. Sort Array By Parity II | Go | Easy | O(n) | O(1) | |
969. Pancake Sorting | Go | Medium | O(n log n) | O(log n) | ❤️ |
973. K Closest Points to Origin | Go | Medium | O(n log n) | O(log n) | |
976. Largest Perimeter Triangle | Go | Easy | O(n log n) | O(log n) | |
1030. Matrix Cells in Distance Order | Go | Easy | O(n^2) | O(1) | |
1054. Distant Barcodes | Go | Medium | O(n log n) | O(log n) | ❤️ |
----------------------------------------------------------------- | ------------- | ------------- | -------------------------- | -------------------------- | ------------- |
- 异或的特性。第 136 题,第 268 题,第 389 题,第 421 题,
x ^ 0 = x
x ^ 11111……1111 = ~x
x ^ (~x) = 11111……1111
x ^ x = 0
a ^ b = c => a ^ c = b => b ^ c = a (交换律)
a ^ b ^ c = a ^ (b ^ c) = (a ^ b)^ c (结合律)
- 构造特殊 Mask,将特殊位置放 0 或 1。
将 x 最右边的 n 位清零, x & ( ~0 << n )
获取 x 的第 n 位值(0 或者 1),(x >> n) & 1
获取 x 的第 n 位的幂值,x & (1 << (n - 1))
仅将第 n 位置为 1,x | (1 << n)
仅将第 n 位置为 0,x & (~(1 << n))
将 x 最高位至第 n 位(含)清零,x & ((1 << n) - 1)
将第 n 位至第 0 位(含)清零,x & (~((1 << (n + 1)) - 1))
- 有特殊意义的 & 位操作运算。第 260 题,第 201 题,第 318 题,第 371 题,第 397 题,第 461 题,第 693 题,
X & 1 == 1 判断是否是奇数(偶数)
X & = (X - 1) 将最低位(LSB)的 1 清零
X & -X 得到最低位(LSB)的 1
X & ~X = 0