Skip to content

Latest commit

 

History

History
1173 lines (1112 loc) · 112 KB

README_old.md

File metadata and controls

1173 lines (1112 loc) · 112 KB

LeetCode by Go

[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!

数据结构

数据结构 变种 相关题目
顺序线性表:向量
单链表 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树

Data Structures

标识了 (已全部做完) 的专题是全部完成了的,没有标识的是还没有做完的

Companies

算法

一. 目录

题号 题目 通过率 难度 收藏
1 Two Sum 38% Easy
2 Add Two Numbers 28% Medium
3 Longest Substring Without Repeating Characters 24% Medium
4 Median of Two Sorted Arrays 23% Hard
5 Longest Palindromic Substring 25% Medium
6 ZigZag Conversion 27% Medium
7 Reverse Integer 24% Easy
8 String to Integer (atoi) 14% Medium
9 Palindrome Number 35% Easy
10 Regular Expression Matching 24% Hard ❤️
11 Container With Most Water 37% Medium
12 Integer to Roman 46% Medium
13 Roman to Integer 48% Easy
14 Longest Common Prefix 31% Easy
15 3Sum 21% Medium
16 3Sum Closest 31% Medium
17 Letter Combinations of a Phone Number 36% Medium
18 4Sum 27% Medium
19 Remove Nth Node From End of List 33% Medium
20 Valid Parentheses 33% Easy
21 Merge Two Sorted Lists 41% Easy
22 Generate Parentheses 48% Medium ❤️
23 Merge k Sorted Lists 28% Hard
24 Swap Nodes in Pairs 39% Medium ❤️
25 Reverse Nodes in k-Group 31% Hard ❤️
26 Remove Duplicates from Sorted Array 36% Easy ❤️
27 Remove Element 40% Easy
28 Implement strStr() 28% Easy
29 Divide Two Integers 15% Medium
30 Substring with Concatenation of All Words 22% Hard ❤️
31 Next Permutation 29% Medium ❤️
32 Longest Valid Parentheses 23% Hard
33 Search in Rotated Sorted Array 31% Medium ❤️
34 Search for a Range 31% Medium
35 Search Insert Position 40% Easy
36 Valid Sudoku 37% Medium ❤️
37 Sudoku Solver 32% Hard ❤️
38 Count and Say 36% Easy
39 Combination Sum 41% Medium
40 Combination Sum II 35% Medium
41 First Missing Positive 25% Hard
42 Trapping Rain Water 37% Hard
43 Multiply Strings 28% Medium
44 Wildcard Matching 21% Hard ❤️
45 Jump Game II 26% Hard
46 Permutations 47% Medium
47 Permutations II 35% Medium
48 Rotate Image 41% Medium
49 Group Anagrams 38% Medium ❤️
50 Pow(x, n) 26% Medium
51 N-Queens 33% Hard
52 N-Queens II 46% Hard
53 Maximum Subarray 40% Easy ❤️
54 Spiral Matrix 27% Medium ❤️
55 Jump Game 29% Medium
56 Merge Intervals 31% Medium ❤️
57 Insert Interval 28% Hard
58 Length of Last Word 32% Easy
59 Spiral Matrix II 41% Medium ❤️
60 Permutation Sequence 29% Medium
61 Rotate List 24% Medium ❤️
62 Unique Paths 42% Medium ❤️
63 Unique Paths II 32% Medium
64 Minimum Path Sum 40% Medium
65 Valid Number 12% Hard
66 Plus One 39% Easy
67 Add Binary 34% Easy
68 Text Justification 20% Hard
69 Sqrt(x) 28% Easy
70 Climbing Stairs 41% Easy
71 Simplify Path 26% Medium
72 Edit Distance 32% Hard ❤️
73 Set Matrix Zeroes 36% Medium ❤️
74 Search a 2D Matrix 34% Medium
75 Sort Colors 38% Medium ❤️
76 Minimum Window Substring 26% Hard ❤️
77 Combinations 41% Medium
78 Subsets 44% Medium ❤️
79 Word Search 28% Medium
80 Remove Duplicates from Sorted Array II 36% Medium ❤️
81 Search in Rotated Sorted Array II 32% Medium
82 Remove Duplicates from Sorted List II 29% Medium ❤️
83 Remove Duplicates from Sorted List 40% Easy
84 Largest Rectangle in Histogram 27% Hard ❤️
85 Maximal Rectangle 29% Hard ❤️
86 Partition List 33% Medium
87 Scramble String 29% Hard ❤️
88 Merge Sorted Array 32% Easy
89 Gray Code 42% Medium
90 Subsets II 38% Medium ❤️
91 Decode Ways 20% Medium ❤️
92 Reverse Linked List II 31% Medium
93 Restore IP Addresses 28% Medium ❤️
94 Binary Tree Inorder Traversal 49% Medium
95 Unique Binary Search Trees II 32% Medium ❤️
96 Unique Binary Search Trees 41% Medium
97 Interleaving String 25% Hard ❤️
98 Validate Binary Search Tree 24% Medium ❤️
99 Recover Binary Search Tree 31% Hard ❤️
100 Same Tree 47% Easy
101 Symmetric Tree 40% Easy ❤️
102 Binary Tree Level Order Traversal 42% Medium
103 Binary Tree Zigzag Level Order Traversal 36% Medium
104 Maximum Depth of Binary Tree 54% Easy
105 Construct Binary Tree from Preorder and Inorder Traversal 34% Medium ❤️
106 Construct Binary Tree from Inorder and Postorder Traversal 33% Medium ❤️
107 Binary Tree Level Order Traversal II 42% Easy
108 Convert Sorted Array to Binary Search Tree 44% Easy
109 Convert Sorted List to Binary Search Tree 35% Medium
110 Balanced Binary Tree 38% Easy
111 Minimum Depth of Binary Tree 33% Easy
112 Path Sum 34% Easy
113 Path Sum II 35% Medium
114 Flatten Binary Tree to Linked List 36% Medium ❤️
115 Distinct Subsequences 32% Hard ❤️
118 Pascal's Triangle 40% Easy
119 Pascal's Triangle II 38% Easy
120 Triangle 34% Medium ❤️
121 Best Time to Buy and Sell Stock 42% Easy
122 Best Time to Buy and Sell Stock II 47% Easy
123 Best Time to Buy and Sell Stock III 30% Hard
124 Binary Tree Maximum Path Sum 27% Hard ❤️
125 Valid Palindrome 27.0% Easy
126 Word Ladder II 14% Hard ❤️
127 Word Ladder 20% Medium ❤️
128 Longest Consecutive Sequence 38% Hard
129 Sum Root to Leaf Numbers 37% Medium
130 Surrounded Regions 19% Medium ❤️
131 Palindrome Partitioning 35% Medium ❤️
132 Palindrome Partitioning II 24% Hard ❤️
134 Gas Station 29% Medium ❤️
135 Candy 25% Hard
136 Single Number 55% Easy
137 Single Number II 42% Medium ❤️
139 Word Break 31% Medium ❤️
140 Word Break II 24% Hard ❤️
141 Linked List Cycle 24% Hard ❤️
142 Linked List Cycle II 24% Hard ❤️
143 Reorder List 26% Medium ❤️
144 Binary Tree Preorder Traversal 46% Medium ❤️
145 Binary Tree Postorder Traversal 42% Hard
146 LRU Cache 19% Hard ❤️
147 Insertion Sort List 33% Medium ❤️
148 Sort List 29% Medium ❤️
149 Max Points on a Line 15% Hard ❤️
150 Evaluate Reverse Polish Notation 28% Medium
152 Maximum Product Subarray 26% Medium ❤️
153 Find Minimum in Rotated Sorted Array 40% Medium
154 Find Minimum in Rotated Sorted Array II 37% Hard
155 Min Stack 31% Easy
162 Find Peak Element 38% Medium
164 Maximum Gap 30% Hard
165 Compare Version Numbers 20% Medium
166 Fraction to Recurring Decimal 18% Medium ❤️
167 Two Sum II - Input array is sorted 47% Easy
168 Excel Sheet Column Title 27% Easy ❤️
169 Majority Element 48% Easy ❤️
171 Excel Sheet Column Number 48% Easy
172 Factorial Trailing Zeroes 36% Easy
174 Dungeon Game 24% Hard ❤️
179 Largest Number 23% Medium ❤️
187 Repeated DNA Sequences 33% Medium
188 Best Time to Buy and Sell Stock IV 24% Hard ❤️
189 Rotate Array 25% Easy
198 House Robber 39% Easy ❤️
199 Binary Tree Right Side View 42% Medium
200 Number of Islands 36% Medium
201 Bitwise AND of Numbers Range 34% Medium ❤️
202 Happy Number 41% Easy
203 Remove Linked List Elements 33% Easy
204 Count Primes 26% Easy ❤️
205 Isomorphic Strings 34% Easy ❤️
206 Reverse Linked List 46% Easy
207 Course Schedule 33% Medium ❤️
208 Implement Trie (Prefix Tree) 30% Medium ❤️
209 Minimum Size Subarray Sum 32% Medium
210 Course Schedule II 30% Medium
211 Add and Search Word - Data structure design 25% Medium ❤️
212 Word Search II 24% Hard ❤️
213 House Robber II 34% Medium
214 Shortest Palindrome 25% Hard ❤️
215 Kth Largest Element in an Array 40% Medium ❤️
216 Combination Sum III 47% Medium
217 Contains Duplicate 47% Easy
218 The Skyline Problem 29% Hard ❤️
219 Contains Duplicate II 32% Easy
220 Contains Duplicate III 18% Medium ❤️
221 Maximal Square 30% Medium ❤️
223 Rectangle Area 33% Medium
224 Basic Calculator 28% Hard
225 Implement Stack using Queues 34% Easy
226 Invert Binary Tree 53% Easy
227 Basic Calculator II 30% Medium
228 Summary Ranges 32% Medium
229 Majority Element II 29% Medium ❤️
230 Kth Smallest Element in a BST 45% Medium
231 Power of Two 40% Easy
232 Implement Queue using Stacks 38% Easy
233 Number of Digit One 29% Hard ❤️
234 Palindrome Linked List 33% Easy
238 Product of Array Except Self 50% Medium
239 Sliding Window Maximum 34% Hard ❤️
240 Search a 2D Matrix II 39% Medium ❤️
241 Different Ways to Add Parentheses 46% Medium
242 Valid Anagram 47% Easy
257 Binary Tree Paths 41% Easy
258 Add Digits 51% Easy
260 Single Number III 53% Medium ❤️
263 Ugly Number 39% Easy
264 Ugly Number II 33% Medium ❤️
268 Missing Number 45% Easy
273 Integer to English Words 22% Hard ❤️
274 H-Index 33% Medium
275 H-Index II 34% Medium ❤️
279 Perfect Squares 37% Medium ❤️
282 Expression Add Operators 30% Hard ❤️
283 Move Zeroes 51% Easy
287 Find the Duplicate Number 44% Medium ❤️
289 Game of Life 37% Medium ❤️
290 Word Pattern 33% Easy
292 Nim Game 55% Easy ❤️
295 Find Median from Data Stream 29% Hard ❤️
299 Bulls and Cows 35% Medium
300 Longest Increasing Subsequence 38% Medium ❤️
301 Remove Invalid Parentheses 35% Hard ❤️
303 Range Sum Query - Immutable 32% Easy
304 Range Sum Query 2D - Immutable 27% Medium
306 Additive Number 27% Medium
307 Range Sum Query - Mutable 22% Medium
309 Best Time to Buy and Sell Stock with Cooldown 41% Medium ❤️
310 Minimum Height Trees 28% Medium
312 Burst Balloons 43% Hard ❤️
313 Super Ugly Number 38% Medium ❤️
315 Count of Smaller Numbers After Self 34% Hard ❤️
316 Remove Duplicate Letters 30% Hard ❤️
318 Maximum Product of Word Lengths 45% Medium ❤️
319 Bulb Switcher 42% Medium ❤️
321 Create Maximum Number 24% Hard ❤️
322 Coin Change 26% Medium ❤️
324 Wiggle Sort II 26% Medium
326 Power of Three 40% Easy ❤️
327 Count of Range Sum 30% Hard ❤️
328 Odd Even Linked List 44% Medium ❤️
329 Longest Increasing Path in a Matrix 37% Hard ❤️
330 Patching Array 32% Hard
331 Verify Preorder Serialization of a Binary Tree 37% Medium ❤️
332 Reconstruct Itinerary 29% Medium ❤️
334 Increasing Triplet Subsequence 39% Medium ❤️
335 Self Crossing 26% Hard
336 Palindrome Pairs 27% Hard ❤️
337 House Robber III 44% Medium ❤️
338 Counting Bits 62% Medium
342 Power of Four 39% Easy
343 Integer Break 46% Medium
344 Reverse String 60% Easy
345 Reverse Vowels of a String 39% Easy
347 Top K Frequent Elements 49% Medium
349 Intersection of Two Arrays 48% Easy
350 Intersection of Two Arrays II 44% Easy ❤️
352 Data Stream as Disjoint Intervals 41% Hard
354 Russian Doll Envelopes 32% Hard ❤️
355 Design Twitter 25% Medium ❤️
357 Count Numbers with Unique Digits 46% Medium ❤️
363 Max Sum of Rectangle No Larger Than K 33% Hard ❤️
365 Water and Jug Problem 28% Medium ❤️
367 Valid Perfect Square 38% Easy
368 Largest Divisible Subset 33% Medium ❤️
371 Sum of Two Integers 50% Easy ❤️
372 Super Pow 34% Medium
373 Find K Pairs with Smallest Sums 31% Medium ❤️
375 Guess Number Higher or Lower II 36% Medium
376 Wiggle Subsequence 36% Medium ❤️
377 Combination Sum IV 42% Medium
378 Kth Smallest Element in a Sorted Matrix 45% Medium ❤️
380 Insert Delete GetRandom O(1) 39% Medium ❤️
381 Insert Delete GetRandom O(1) - Duplicates allowed 29% Hard ❤️
382 Linked List Random Node 47% Medium
383 Ransom Note 47% Easy
384 Shuffle an Array 47% Medium ❤️
385 Mini Parser 30% Medium ❤️
387 First Unique Character in a String 47% Easy
388 Longest Absolute File Path 37% Medium
389 Find the Difference 51% Easy
390 Elimination Game 42% Medium ❤️
391 Perfect Rectangle 27% Hard
392 Is Subsequence 44% Medium ❤️
393 UTF-8 Validation 34% Medium ❤️
394 Decode String 42% Medium
395 Longest Substring with At Least K Repeating Characters 35% Medium
396 Rotate Function 33% Medium ❤️
397 Integer Replacement 30% Medium ❤️
398 Random Pick Index 44% Medium
399 Evaluate Division 42% Medium ❤️
400 Nth Digit 30% Easy ❤️
401 Binary Watch 44% Easy
402 Remove K Digits 25% Medium ❤️
403 Frog Jump 32% Hard ❤️
404 Sum of Left Leaves 47% Easy
405 Convert a Number to Hexadecimal 41% Easy
406 Queue Reconstruction by Height 56% Medium ❤️
407 Trapping Rain Water II 37% Hard
409 Longest Palindrome 45% Easy
410 Split Array Largest Sum 39% Hard
412 Fizz Buzz 58% Easy
413 Arithmetic Slices 54% Medium
414 Third Maximum Number 28% Easy
415 Add Strings 41% Easy
416 Partition Equal Subset Sum 38% Medium ❤️
417 Pacific Atlantic Water Flow 34% Medium
419 Battleships in a Board 63% Medium
420 Strong Password Checker 19% Hard ❤️
421 Maximum XOR of Two Numbers in an Array 47% Medium ❤️
423 Reconstruct Original Digits from English 44% Medium
424 Longest Repeating Character Replacement 42% Medium ❤️
432 All O`one Data Structure 27% Hard ❤️
434 Number of Segments in a String 36% Easy
435 Non-overlapping Intervals 41% Medium ❤️
436 Find Right Interval 41% Medium
437 Path Sum III 40% Easy ❤️
438 Find All Anagrams in a String 33% Easy
440 K-th Smallest in Lexicographical Order 25% Hard ❤️
441 Arranging Coins 36% Easy
442 Find All Duplicates in an Array 56% Medium
443 String Compression 35% Easy ❤️
445 Add Two Numbers II 46% Medium ❤️
446 Arithmetic Slices II - Subsequence 28% Hard ❤️
447 Number of Boomerangs 46% Easy
448 Find All Numbers Disappeared in an Array 51% Easy
450 Delete Node in a BST 37% Medium ❤️
451 Sort Characters By Frequency 51% Medium
452 Minimum Number of Arrows to Burst Balloons 44% Medium
453 Minimum Moves to Equal Array Elements 48% Easy
454 4Sum II 47% Medium
455 Assign Cookies 47% Easy
456 132 Pattern 27% Medium ❤️
459 Repeated Substring Pattern 38% Easy ❤️
460 LFU Cache 25% Hard
461 Hamming Distance 69% Easy
462 Minimum Moves to Equal Array Elements II 51% Medium
463 Island Perimeter 57% Easy
464 Can I Win 25% Medium ❤️
466 Count The Repetitions 27% Hard ❤️
467 Unique Substrings in Wraparound String 33% Medium ❤️
468 Validate IP Address 20% Medium
472 Concatenated Words 30% Hard
473 Matchsticks to Square 35% Medium ❤️
474 Ones and Zeroes 38% Medium
475 Heaters 29% Easy
476 Number Complement 61% Easy
477 Total Hamming Distance 47% Medium ❤️
479 Largest Palindrome Product 25% Easy
480 Sliding Window Median 30% Hard ❤️
481 Magical String 45% Medium
482 License Key Formatting 39% Easy
483 Smallest Good Base 33% Hard ❤️
485 Max Consecutive Ones 53% Easy
486 Predict the Winner 45% Medium
488 Zuma Game 37% Hard ❤️
491 Increasing Subsequences 38% Medium ❤️
492 Construct the Rectangle 48% Easy ❤️
493 Reverse Pairs 20% Hard
494 Target Sum 43% Medium ❤️
495 Teemo Attacking 51% Medium
496 Next Greater Element I 56% Easy
498 Diagonal Traverse 46% Medium
500 Keyboard Row 59% Easy
501 Find Mode in Binary Search Tree 37% Easy ❤️
502 IPO 36% Hard
503 Next Greater Element II 48% Medium ❤️
504 Base 7 43% Easy
506 Relative Ranks 46% Easy
507 Perfect Number 32% Easy
508 Most Frequent Subtree Sum 52% Medium
513 Find Bottom Left Tree Value 56% Medium
514 Freedom Trail 39% Hard
515 Find Largest Value in Each Tree Row 55% Medium
516 Longest Palindromic Subsequence 42% Medium ❤️
517 Super Washing Machines 36% Hard ❤️
520 Detect Capital 51% Easy
521 Longest Uncommon Subsequence I 55% Easy
522 Longest Uncommon Subsequence II 31% Medium
523 Continuous Subarray Sum 23% Medium ❤️
524 Longest Word in Dictionary through Deleting 43% Medium
525 Contiguous Array 41% Medium ❤️
526 Beautiful Arrangement 53% Medium ❤️
529 Minesweeper 49% Medium
530 Minimum Absolute Difference in BST 47% Easy ❤️
532 K-diff Pairs in an Array 28% Easy
537 Complex Number Multiplication 63% Medium
538 Convert BST to Greater Tree 48% Easy
539 Minimum Time Difference 46% Medium
540 Single Element in a Sorted Array 55% Medium
541 Reverse String II 43% Easy
542 01 Matrix 33% Medium ❤️
543 Diameter of Binary Tree 44% Easy
546 Remove Boxes 35% Hard ❤️
547 Friend Circles 49% Medium ❤️
551 Student Attendance Record I 44% Easy
552 Student Attendance Record II 31% Hard ❤️
553 Optimal Division 55% Medium
554 Brick Wall 46% Medium
556 Next Greater Element III 28% Medium
557 Reverse Words in a String III 60% Easy
560 Subarray Sum Equals K 39% Medium ❤️
561 Array Partition I 66% Easy
563 Binary Tree Tilt 47% Easy
564 Find the Closest Palindrome 17% Hard
565 Array Nesting 49% Medium
566 Reshape the Matrix 57% Easy
567 Permutation in String 36% Medium
572 Subtree of Another Tree 40% Easy ❤️
575 Distribute Candies 57% Easy
576 Out of Boundary Paths 30% Medium ❤️
581 Shortest Unsorted Continuous Subarray 29% Easy ❤️
583 Delete Operation for Two Strings 44% Medium ❤️
587 Erect the Fence 33% Hard ❤️
591 Tag Validator 31% Hard ❤️
592 Fraction Addition and Subtraction 46% Medium
593 Valid Square 39% Medium
594 Longest Harmonious Subsequence 40% Easy
598 Range Addition II 48% Easy
599 Minimum Index Sum of Two Lists 46% Easy
600 Non-negative Integers without Consecutive Ones 31% Hard ❤️
605 Can Place Flowers 30% Easy ❤️
606 Construct String from Binary Tree 49% Easy
609 Find Duplicate File in System 52% Medium
611 Valid Triangle Number 42% Medium ❤️
617 Merge Two Binary Trees 67% Easy
621 Task Scheduler 42% Medium ❤️
623 Add One Row to Tree 46% Medium
628 Maximum Product of Three Numbers 44% Easy ❤️
629 K Inverse Pairs Array 27% Hard
630 Course Schedule III 29% Hard ❤️
632 Smallest Range 41% Hard
633 Sum of Square Numbers 32% Easy
636 Exclusive Time of Functions 44% Medium ❤️
637 Average of Levels in Binary Tree 55% Easy
638 Shopping Offers 45% Medium ❤️
639 Decode Ways II 24% Hard
640 Solve the Equation 38% Medium
643 Maximum Average Subarray I 37% Easy
645 Set Mismatch 39% Easy ❤️
646 Maximum Length of Pair Chain 47% Medium
647 Palindromic Substrings 54% Medium ❤️
648 Replace Words 47% Medium
649 Dota2 Senate 36% Medium ❤️
650 2 Keys Keyboard 44% Medium
652 Find Duplicate Subtrees 36% Medium
653 Two Sum IV - Input is a BST 49% Easy
654 Maximum Binary Tree 69% Medium ❤️
655 Print Binary Tree 49% Medium
657 Judge Route Circle 68% Easy
658 Find K Closest Elements 34% Medium ❤️
659 Split Array into Consecutive Subsequences 36% Medium ❤️
661 Image Smoother 46% Easy
662 Maximum Width of Binary Tree 37% Medium
664 Strange Printer 34% Hard ❤️
665 Non-decreasing Array 20% Easy
667 Beautiful Arrangement II 51% Medium
668 Kth Smallest Number in Multiplication Table 40% Hard
669 Trim a Binary Search Tree 58% Easy
670 Maximum Swap 38% Medium ❤️
671 Second Minimum Node In a Binary Tree 41% Easy
672 Bulb Switcher II 49% Medium
673 Number of Longest Increasing Subsequence 31% Medium ❤️
674 Longest Continuous Increasing Subsequence 42% Easy
675 Cut Off Trees for Golf Event 27% Hard ❤️
676 Implement Magic Dictionary 49% Medium
677 Map Sum Pairs 51% Medium ❤️
678 Valid Parenthesis String 29% Medium ❤️
679 24 Game 38% Hard ❤️
680 Valid Palindrome II 32% Easy
682 Baseball Game 58% Easy
684 Redundant Connection 43% Medium
685 Redundant Connection II 27% Hard ❤️
686 Repeated String Match 32% Easy ❤️
687 Longest Univalue Path 32% Easy
688 Knight Probability in Chessboard 39% Medium
689 Maximum Sum of 3 Non-Overlapping Subarrays 41% Hard
691 Stickers to Spell Word 34% Hard ❤️
692 Top K Frequent Words 41% Medium
693 Binary Number with Alternating Bits 55% Easy
695 Max Area of Island 51% Easy ❤️
696 Count Binary Substrings 50% Easy
697 Degree of an Array 46% Easy
698 Partition to K Equal Sum Subsets 37% Medium ❤️
699 Falling Squares 37% Hard
712 Minimum ASCII Delete Sum for Two Strings 51% Medium ❤️
713 Subarray Product Less Than K 33% Medium ❤️
714 Best Time to Buy and Sell Stock with Transaction Fee 45% Medium ❤️
715 Range Module 31% Hard
717 1-bit and 2-bit Characters 49% Easy
718 Maximum Length of Repeated Subarray 41% Medium ❤️
719 Find K-th Smallest Pair Distance 27% Hard ❤️
720 Longest Word in Dictionary 41% Easy
721 Accounts Merge 32% Medium ❤️
722 Remove Comments 27% Medium ❤️
724 Find Pivot Index 39% Easy
725 Split Linked List in Parts 47% Medium
726 Number of Atoms 43% Hard ❤️
728 Self Dividing Numbers 66% Easy
729 My Calendar I 42% Medium
730 Count Different Palindromic Subsequences 34% Hard ❤️
731 My Calendar II 37% Medium ❤️
732 My Calendar III 50% Hard
733 Flood Fill 47% Easy
735 Asteroid Collision 37% Medium
736 Parse Lisp Expression 42% Hard ❤️
738 Monotone Increasing Digits 40% Medium
739 Daily Temperatures 52% Medium ❤️
740 Delete and Earn 43% Medium ❤️
741 Cherry Pickup 23% Hard
743 Network Delay Time 34% Medium
744 Find Smallest Letter Greater Than Target 44% Easy
745 Prefix and Suffix Search 25% Hard
746 Min Cost Climbing Stairs 43% Easy
747 Largest Number At Least Twice of Others 41% Easy
748 Shortest Completing Word 51% Medium
749 Contain Virus 39% Hard
752 Open the Lock 38% Medium ❤️
753 Cracking the Safe 39% Hard ❤️
754 Reach a Number 26% Medium ❤️
756 Pyramid Transition Matrix 45% Medium ❤️
757 Set Intersection Size At Least Two 34% Hard
761 Special Binary String 41% Hard
762 Prime Number of Set Bits in Binary Representation 55% Easy
763 Partition Labels 64% Medium
764 Largest Plus Sign 37% Medium
765 Couples Holding Hands 48% Hard
766 Toeplitz Matrix 57% Easy
767 Reorganize String 35% Medium
768 Max Chunks To Make Sorted II 42% Hard
769 Max Chunks To Make Sorted 47% Medium
770 Basic Calculator IV 43% Hard ❤️
771 Jewels and Stones 82% Easy
773 Sliding Puzzle 47% Hard
775 Global and Local Inversions 31% Medium
777 Swap Adjacent in LR String 27% Medium
778 Swim in Rising Water 44% Hard
779 K-th Symbol in Grammar 35% Medium
780 Reaching Points 21% Hard
781 Rabbits in Forest 49% Medium
782 Transform to Chessboard 35% Hard
783 Minimum Distance Between BST Nodes 47% Easy
784 Letter Case Permutation 52% Easy ❤️
785 Is Graph Bipartite? 38% Medium ❤️
786 K-th Smallest Prime Fraction 29% Hard ❤️
787 Cheapest Flights Within K Stops 30% Medium ❤️
788 Rotated Digits 50% Easy
789 Escape The Ghosts 47% Medium
790 Domino and Tromino Tiling 32% Medium ❤️
791 Custom Sort String 60% Medium
792 Number of Matching Subsequences 35% Medium ❤️
793 * Preimage Size of Factorial Zeroes Function 45% Hard
794 * Valid Tic-Tac-Toe State 27% Medium
795 * Number of Subarrays with Bounded Maximum 40% Medium
796 * Rotate String 54% Easy
797 * All Paths From Source to Target 69% Medium
798 * Smallest Rotation with Highest Score 31% Hard
799 * Champagne Tower 28% Medium
801 * Minimum Swaps To Make Sequences Increasing 23% Medium
802 * Find Eventual Safe States 35% Medium
803 * Bricks Falling When Hit 20% Hard
804 * Unique Morse Code Words 76% Easy
805 * Split Array With Same Average 19% Hard
806 * Number of Lines To Write String 64% Easy
807 * Max Increase to Keep City Skyline 82% Medium
808 * Soup Servings 30% Medium
809 * Expressive Words 34% Medium
810 * Chalkboard XOR Game 35% Hard
811 * Subdomain Visit Count 65% Easy
812 * Largest Triangle Area 🆕 51% Easy
813 * Largest Sum of Averages 🆕 37% Medium
814 * Binary Tree Pruning 🆕 73% Medium
815 * Bus Routes 🆕 30% Hard

以下免费的算法题,暂时不能使用 Go 解答


二.分类

Array

Title Solution Difficulty Time Space 收藏
1. Two Sum Go Easy O(n) O(n)
11. Container With Most Water Go Medium O(n) O(1)
15. 3Sum Go Medium O(n^2) O(n)
16. 3Sum Closest Go Medium O(n^2) O(1)
18. 4Sum Go Medium O(n^3) O(n^2)
26. Remove Duplicates from Sorted Array Go Easy O(n) O(1)
27. Remove Element Go Easy O(n) O(1)
39. Combination Sum Go Medium O(n log n) O(n)
40. Combination Sum II Go Medium O(n log n) O(n)
41. First Missing Positive Go Hard O(n) O(n)
42. Trapping Rain Water Go Hard O(n) O(1)
48. Rotate Image Go Medium O(n) O(1)
53. Maximum Subarray Go Easy O(n) O(n)
54. Spiral Matrix Go Medium O(n) O(n^2)
56. Merge Intervals Go Medium O(n log n) O(1)
57. Insert Interval Go Hard O(n) O(1)
59. Spiral Matrix II Go Medium O(n) O(n^2)
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)
75. Sort Colors Go Medium O(n) O(1)
78. Subsets Go Medium O(n^2) O(n)
79. Word Search Go Medium O(n^2) O(n^2)
80. Remove Duplicates from Sorted Array II Go Medium O(n^2) O(n^2)
84. Largest Rectangle in Histogram Go Medium O(n) O(n)
88. Merge Sorted Array Go Easy O(n) O(1)
90. Subsets II Go Medium O(n^2) 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)
122. Best Time to Buy and Sell Stock II Go Easy O(n) O(1)
126. Word Ladder II Go Hard O(n) O(n^2)
152. Maximum Product Subarray Go Medium O(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)
216. Combination Sum III Go Medium O(n) O(1)
217. Contains Duplicate Go Easy O(n) O(n)
219. Contains Duplicate II Go Easy O(n) O(n)
283. Move Zeroes Go Easy O(n) O(1)
287. Find the Duplicate Number Go Easy O(n) O(1)
532. K-diff Pairs in an Array Go Easy O(n) O(n)
566. Reshape the Matrix Go Easy O(n^2) O(n^2)
628. Maximum Product of Three Numbers Go Easy O(n) O(1)
713. Subarray Product Less Than K Go Medium O(n) O(1)
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)
766. Toeplitz Matrix Go Easy O(n) O(1)
867. Transpose Matrix Go Easy O(n) O(1)
891. Sum of Subsequence Widths Go Hard O(n) O(1)
907. Sum of Subarray Minimums Go Medium O(n) O(1)
922. Sort Array By Parity II Go Medium O(n) O(1)
969. Pancake Sorting Go Medium O(n) O(1)
977. Squares of a Sorted Array Go Easy O(n) O(1)
Title Solution Difficulty Time Space
Max Consecutive Ones Go Easy O(n) O(1)
Heaters Go Easy O(nlogn) O(1)
Number of Boomerangs Go Easy O(n ^ 2) O(n)
Island Perimeter Go Easy O(nm) O(1)
Majority Element Go Easy O(n) O(1)
Majority Element II Go Medium O(n) O(1)
Intersection of Two Arrays Go Easy O(n) O(n)
Intersection of Two Arrays II Go Easy O(n) O(n)
Contains Duplicate Go Easy O(n) O(n)
Contains Duplicate II Go Easy O(n) O(n)
Remove Duplicates from Sorted Array Go Easy O(n) O(1)
Remove Duplicates from Sorted Array II Go Medium O(n) O(1)
Move Zeroes Go Easy O(n) O(1)
Remove Element Go Easy O(n) O(1)
Two Sum Go Easy O(n) O(n)
3Sum Go Medium O(n^2) O(nC3)
3Sum Closest Go Medium O(n^2) O(nC3)
4Sum Go Medium O(n^3) O(nC4)
Summary Ranges Go Medium O(n) O(n)
Shortest Word Distance Go Easy O(n) O(1)
Shortest Word Distance III Go Medium O(n) O(1)
Minimum Size Subarray Sum Go Medium O(n) O(1)
Maximum Size Subarray Sum Equals k Go Medium O(n) O(n)
Smallest Range Go Hard O(nm) O(nm)
Product of Array Except Self Go Medium O(n) O(n)
Rotate Array Go Easy O(n) O(1)
Rotate Image Go Medium O(n^2) O(1)
Spiral Matrix Go Medium O(n^2) O(1)
Spiral Matrix II Go Medium O(n^2) O(1)
Valid Sudoku Go Easy O(n^2) O(n)
Set Matrix Zero Go Medium O(n^2) O(1)
Next Permutation Go Medium O(n) O(1)
Gas Station Go Medium O(n) O(1)
Game of Life Go Medium O(n) O(1)
Task Scheduler Go Medium O(nlogn) O(n)
Sliding Window Maximum Go Hard O(n) O(n)
Longest Consecutive Sequence Go Hard O(n) O(n)

String

Title Solution Difficulty Time Space
Fizz Buzz Go Easy O(n) O(1)
First Unique Character in a String Go Easy O(n) O(1)
Keyboard Row Go Easy O(nm) O(n)
Valid Palindrome Go Easy O(n) O(n)
Valid Palindrome II Go Easy O(n) O(n)
Detect Capital Go Easy O(n) O(1)
Count and Say Go Easy O(n^2) O(n)
Flip Game Go Easy O(n) O(n)
Implement strStr() Go Easy O(nm) O(n)
Isomorphic Strings Go Easy O(n) O(n)
Reverse String Go Easy O(n) O(n)
Reverse String II Go Easy O(n) O(n)
Reverse Vowels of a String Go Easy O(n) O(n)
Length of Last Word Go Easy O(n) O(n)
Add Strings Go Easy O(n) O(1)
Multiply Strings Go Medium O(n) O(1)
Palindrome Permutation Go Easy O(n) O(n)
Valid Anagram Go Easy O(nlogn) O(1)
Ransom Note Go Easy O(n) O(n)
Group Anagrams Go Medium O(nmlogm + nlogn) O(n)
Longest Common Prefix Go Easy O(nm) O(m)
Longest Substring Without Repeating Characters Go Medium O(n) O(n)
One Edit Distance Go Medium O(n) O(n)
Word Pattern Go Easy O(n) O(n)
Minimum Window Substring Go Hard O(n^2) O(n)
Text Justification Go Hard O(n) O(n)

Linked List (已全部做完)

  • 巧妙的构造虚拟头结点。可以使遍历处理逻辑更加统一。
  • 灵活使用递归。构造递归条件,使用递归可以巧妙的解题。不过需要注意有些题目不能使用递归,因为递归深度太深会导致超时和栈溢出。
  • 链表区间逆序。第 92 题。
  • 链表寻找中间节点。第 876 题。链表寻找倒数第 n 个节点。第 19 题。只需要一次遍历就可以得到答案。
  • 合并 K 个有序链表。第 21 题,第 23 题。
  • 链表归类。第 86 题,第 328 题。
  • 链表排序,时间复杂度要求 O(n * log n),空间复杂度 O(1)。只有一种做法,归并排序,至顶向下归并。第 148 题。
  • 判断链表是否存在环,如果有环,输出环的交叉点的下标;判断 2 个链表是否有交叉点,如果有交叉点,输出交叉点。第 141 题,第 142 题,第 160 题。
Title Solution Difficulty Time Space 收藏
2. Add Two Numbers Go Medium O(n) O(1)
19. Remove Nth Node From End of List Go Medium O(n) O(1)
21. Merge Two Sorted Lists Go Easy O(log n) O(1)
23. Merge k Sorted Lists Go Hard O(log n) O(1) ❤️
24. Swap Nodes in Pairs Go Medium O(n) O(1)
25. Reverse Nodes in k-Group Go Hard O(log n) O(1) ❤️
61. Rotate List Go Medium O(n) O(1)
82. Remove Duplicates from Sorted List II Go Medium O(n) O(1)
83. Remove Duplicates from Sorted List Go Easy O(n) O(1)
86. Partition List Go Medium O(n) O(1) ❤️
92. Reverse Linked List II Go Medium O(n) O(1) ❤️
109. Convert Sorted List to Binary Search Tree Go Medium O(log n) O(n)
141. Linked List Cycle Go Easy O(n) O(1) ❤️
142. Linked List Cycle II Go Medium O(n) O(1) ❤️
143. Reorder List Go Medium O(n) O(1) ❤️
147. Insertion Sort List Go Medium O(n) O(1)
148. Sort List Go Medium O(log n) O(n) ❤️
160. Intersection of Two Linked Lists Go Easy O(n) O(1) ❤️
203. Remove Linked List Elements Go Easy O(n) O(1)
206. Reverse Linked List Go Easy O(n) O(1)
234. Palindrome Linked List Go Easy O(n) O(1)
237. Delete Node in a Linked List Go Easy O(n) O(1)
328. Odd Even Linked List Go Medium O(n) O(1)
445. Add Two Numbers II Go Medium O(n) O(n)
725. Split Linked List in Parts Go Medium O(n) O(1)
817. Linked List Components Go Medium O(n) O(1)
707. Design Linked List Go Easy O(n) O(1)
876. Middle of the Linked List Go Easy O(n) O(1) ❤️
1019. Next Greater Node In Linked List Go Medium O(n) O(1)
---------------------------------------------------------------------------- ------------- ------------- ------------- ------------- -------------

Stack (已全部做完)

Title Solution Difficulty Time Space
Valid Parentheses Go Easy O(n) O(n)
Longest Valid Parentheses Go Hard O(n) O(n)
Evaluate Reverse Polish Notation Go Medium O(n) O(n)
Simplify Path Go Medium O(n) O(n)
Remove K Digits Go Medium O(n) O(n)
Ternary Expression Parser Go Medium O(n) O(n)
Binary Tree Preorder Traversal Go Medium O(n) O(n)
Binary Tree Inorder Traversal Go Medium O(n) O(n)
Binary Tree Postorder Traversal Go Hard O(n) O(n)

Tree

Title Solution Difficulty Time Space
Same Tree Go Easy O(n) O(n)
Symmetric Tree Go Easy O(n) O(n)
Invert Binary Tree Go Easy O(n) O(n)
Binary Tree Upside Down Go Medium O(n) O(1)
Minimum Depth of Binary Tree Go Easy O(n) O(1)
Maximum Depth of Binary Tree Go Easy O(n) O(1)
Diameter of Binary Tree Go Easy O(n) O(1)
Balanced Binary Tree Go Easy O(n) O(n)
Sum of Left Leaves Go Easy O(n) O(1)
Flatten Binary Tree to Linked List Go Medium O(n) O(1)
Validate Binary Search Tree Go Medium O(n) O(n)
Binary Tree Level Order Traversal Go Easy O(n) O(n)
Binary Tree Level Order Traversal II Go Easy O(n) O(n)
Binary Tree Zigzag Level Order Traversal Go Medium O(n) O(n)
Binary Tree Vertical Order Traversal Go Medium O(n) O(n)
Binary Tree Right Side View Go Medium O(n) O(n)
Construct Binary Tree from Preorder and Inorder Traversal Go Medium O(n) O(n)
Construct Binary Tree from Inorder and Postorder Traversal Go Medium O(n) O(n)
Path Sum Go Easy O(n) O(n)
Path Sum II Go Medium O(n) O(n)
Path Sum III Go Easy O(n^2) O(1)
Bnary Tree Paths Go Easy O(n) O(n)
Unique Binary Search Trees Go Medium O(n^2) O(n)
Recover Binary Search Tree Go Hard O(n) O(1)
Merge Two Binary Trees Go Easy O(n) O(n)

Dynamic programming

Title Solution Difficulty Time Space
Nested List Weight Sum Go Easy O(n) O(1)
Climbing Stairs Go Easy O(n) O(1)
Min Cost Climbing Stairs Go Easy O(n) O(n)
Unique Paths Go Medium O(mn) O(mn)
Unique Paths II Go Medium O(mn) O(mn)
Decode Ways Go O(n) O(n)
Minimum Path Sum Go Medium O(mn) O(mn)
Generate Parentheses Go Medium O(2^n) O(n)
Different Ways to Add Parentheses Go Medium O(n^n) O(n)
Best Time to Buy and Sell Stock Go Easy O(n) O(1)
Best Time to Buy and Sell Stock II Go Medium O(n) O(1)
Best Time to Buy and Sell Stock III Go Hard O(n) O(n)
Best Time to Buy and Sell Stock IV Go Hard O(n^2) O(n)
Best Time to Buy and Sell Stock with Cooldown Go Medium O(n^2) O(n)
Coin Change Go Medium O(n^2) O(n)
Coin Change II Go Medium O(n^2) O(n)
Longest Increasing Subsequence Go Medium O(n^2) O(n)
Longest Palindromic Substring Go Medium O(n^2) O(n^2)
Perfect Squares Go Medium O(n^2) O(n)
House Robber Go Easy O(n) O(1)
House Robber II Go Medium O(n) O(1)
Paint Fence Go Easy O(n) O(n)
Maximum Subarray Go Medium O(n) O(1)
Maximum Product Subarray Go Medium O(n) O(1)
Maximal Square Go Medium O(mn) O(mn)
Edit Distance Go Hard O(mn) O(mn)
Combination Sum IV Go Medium O(2^n) O(n)
Triangle Go Medium O(2^n - 1) O(m)
Guess Number Higher or Lower II Go Medium O(nlogn) O(n^2)
Burst Ballons Go Hard O(n^3) O(n)
Frog Jump Go Hard O(n^2) O(n)

Depth-first search

Title Solution Difficulty Time Space
Permutations Go Medium O(n!) O(n)
Permutations II Go Medium O(n!) O(n)
Subsets Go Medium O(n!) O(n)
Subsets II Go Medium O(n!) O(n)
Combinations Go Medium O(n!) O(n)
Combination Sum Go Medium O(n^n) O(2^n - 1)
Combination Sum II Go Medium O(n!) O(2^n - 2)
Combination Sum III Go Medium O(n!) O(nCk)
Letter Combinations of a Phone Number Go Medium O(mn) O(n)
Factor Combinations Go Medium O(n^n)) O(2^n - 1)
Generalized Abbreviation Go Medium O(n!) O(2^n)
Palindrome Partitioning Go Medium O(n!) O(n)
Number of Islands Go Medium O((mn)^2) O(1)
Walls and Gates Go Medium O(n!) O(2^n)
Word Search Go Medium O((n^2)!) O(n^2)
Word Search II Go Hard O(((mn)^2)) O(n^2)
Add and Search Word - Data structure design Go Medium O(n) O(n)
N-Queens Go Hard O((n^4)) O(n^2)
N-Queens II Go Hard O((n^3)) O(n)
Sudoku Solver Go Hard O(n^4) O(1)
Remove Invalid Parentheses Go Hard O(n!) O(n)
Expression Add Operators Go Hard O(n!) O(n)

Math

Title Solution Difficulty Time Space
Add Binary Go Easy O(n) O(n)
Add Two Numbers Go Medium O(n) O(1)
Add Digits Go Easy O(1) O(1)
Plus One Go Easy O(n) O(1)
Divide Two Integers Go Medium O(logn) O(1)
Number Complement Go Easy O(n) O(1)
Hamming Distance Go Easy O(n) O(1)
Integer Break Go Medium O(logn) O(1)
Happy Number Go Easy O(n) O(n)
Single Number Go Medium O(n) O(1)
Ugly Number Go Easy O(logn) O(1)
Ugly Number II Go Medium O(n) O(n)
Super Ugly Number Go Medium O(n^2) O(n)
Count Primes Go Easy O(n) O(n)
String to Integer (atoi) Go Easy O(n) O(1)
Pow(x, n) Go Medium O(logn) O(1)
Power of Two Go Easy O(1) O(1)
Power of Three Go Easy O(1) O(1)
Super Power Go Medium O(n) O(1)
Sum of Two Integers Go Easy O(n) O(1)
Reverse Integer Go Easy O(n) O(1)
Excel Sheet Column Number Go Easy O(n) O(1)
Integer to Roman Go Medium O(n) O(1)
Roman to Integer Go Easy O(n) O(n)
Integer to English Words Go Hard O(n) O(1)
Rectangle Area Go Easy O(1) O(1)
Trapping Rain Water Go Hard O(n) O(n)
Container With Most Water Go Medium O(n) O(1)
Counting Bits Go Medium O(n) O(n)
K-th Smallest in Lexicographical Order Go Hard O(n) O(1)

Search

Title Solution Difficulty Time Space
Closest Binary Search Tree Value Go Easy O(logn) O(1)
Closest Binary Search Tree Value II Go Hard O(n) O(n)
Search in Rotated Sorted Array Go Hard O(logn) O(1)
Search in Rotated Sorted Array II Go Medium O(logn) O(1)
Find Minimum in Rotated Sorted Array Go Medium O(logn) O(1)
Find Minimum in Rotated Sorted Array II Go Hard O(logn) O(1)
Search a 2D Matrix Go Medium O(log(m + n)) O(1)
Search a 2D Matrix II Go Medium O(m + n) O(1)
Search for a Range Go Medium O(logn) O(1)
Search Insert Position Go Medium O(logn) O(1)
Find Peak Element Go Medium O(logn) O(1)
Sqrt(x) Go Medium O(logn) O(1)
Median of Two Sorted Arrays Go Hard O(log(m + n)) O(1)

Sort (已全部做完)

  • 深刻的理解多路快排。第 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^2) 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)
----------------------------------------------------------------- ------------- ------------- -------------------------- -------------------------- -------------

Union Find

Title Solution Difficulty Time Space
Number of Connected Components in an Undirected Graph Go Medium O(nlogn) O(n)
Graph Valid Tree Go Medium O(nlogn) O(n)

Google

Title Solution Difficulty Frequency
Plus One Go Easy ★★★★★★
Number of Islands Go Medium ★★★★
Summary Ranges Go Medium ★★★★
Perfect Squares Go Medium ★★★★
Merge Intervals Go Hard ★★★
Valid Parentheses Go Easy ★★★
Trapping Rain Water Go Hard ★★
Merge k Sorted Lists Go Hard ★★
Longest Consecutive Sequence Go Hard ★★
Find Peak Element Go Medium ★★
Power of Two Go Easy ★★
Spiral Matrix Go Medium ★★
Sliding Window Maximum Go Hard ★★
Pow(x, n) Go Medium ★★
Letter Combinations of a Phone Number Go Medium ★★
Heaters Go Easy

Facebook

Title Solution Difficulty Frequency
3Sum Go Medium ★★★★★★
Valid Palindrome Go Easy ★★★★★★
Valid Palindrome II Go Easy ★★★★★★
Move Zeroes Go Easy ★★★★★★
Remove Invalid Parentheses Go Hard ★★★★★★
Add Binary Go Easy ★★★★★
Two Sum Go Easy ★★★★★
Bnary Tree Paths Go Easy ★★★★
Letter Combinations of a Phone Number Go Medium ★★★★
Merge k Sorted Lists Go Hard ★★★★
Reverse Linked List Go Easy ★★★
Merge Intervals Go Hard ★★★
Number of Islands Go Medium ★★★
Reverse Linked List Go Easy ★★★
Expression Add Operators Go Hard ★★★
Subsets Go Medium ★★★
Sort Colors Go Medium ★★

Snapchat

Title Solution Difficulty Frequency
Game of Life Go Medium ★★★★★★
Meeting Rooms II Go Medium ★★★★★★
Valid Sudoku Go Easy ★★★★★
Binary Tree Vertical Order Traversal Go Medium ★★★★
Alien Dictionary Go Hard ★★★★
One Edit Distance Go Medium ★★★
Sudoku Solver Go Hard ★★★
Reverse Linked List Go Easy ★★
Unique Binary Search Trees Go Medium ★★
Minimum Window Substring Go Hard ★★
Remove K Digits Go Medium
Ternary Expression Parser Go Medium

Uber

Title Solution Difficulty Frequency
Valid Sudoku Go Easy ★★★★
Spiral Matrix Go Medium ★★★★
Letter Combinations of a Phone Number Go Medium ★★★★
Group Anagrams Go Medium ★★★★
Word Pattern Go Easy ★★★
Roman to Integer Go Easy ★★★
Combination Sum Go Medium ★★

Airbnb

Title Solution Difficulty Frequency
Two Sum Go Easy ★★★★★
Text Justification Go Hard ★★★★
House Robber Go Easy ★★
Single Number Go Medium ★★
Word Search II Go Hard ★★
Add Two Numbers Go Medium ★★

LinkedIn

Title Solution Difficulty Frequency
Maximum Subarray Go Medium ★★★★★★
Pow(x, n) Go Medium ★★★★★★
Merge Intervals Go Hard ★★★★★★
Isomorphic Strings Go Easy ★★★★★★
Search in Rotated Sorted Array Go Hard ★★★★★
Search for a Range Go Medium ★★★★★
Two Sum Go Easy ★★★★
Binary Tree Level Order Traversal Go Easy ★★★★
Evaluate Reverse Polish Notation Go Medium ★★★
Maximum Product Subarray Go Medium ★★★
Product of Array Except Self Go Medium ★★★
Symmetric Tree Go Easy ★★

Amazon

Title Solution Difficulty Frequency
Two Sum Go Easy ★★★★★★
Min Cost Climbing Stairs Go Easy ★★★★
Number of Islands Go Medium ★★
Add Two Numbers Go Medium ★★
Reverse Linked List Go Easy ★★
Valid Parentheses Go Easy ★★
Longest Palindromic Substring Go Medium ★★
Trapping Rain Water Go Hard ★★
Longest Substring Without Repeating Characters Go Medium ★★
Letter Combinations of a Phone Number Go Medium ★★
Valid Anagram Go Easy ★★
Rotate Image Go Medium ★★
Best Time to Buy and Sell Stock Go Easy ★★
3Sum Go Medium ★★
Sliding Window Maximum Go Hard ★★

Microsoft

Title Solution Difficulty Frequency
Reverse Linked List Go Easy ★★★★★★
Two Sum Go Easy ★★★★★
String to Integer (atoi) Go Easy ★★★★
Add Two Numbers Go Medium ★★★★
Excel Sheet Column Number Go Easy ★★★★
Validate Binary Search Tree Go Medium ★★★
Merge Two Sorted Lists Go Easy ★★★