Skip to content

yangwenmai/learning-algorithms

Repository files navigation

算法学习(learning-algorithms) 及 LeetCode 的题解(Go 版本)

LeetCode badge LeetCode Ranking Build Status Go Report Card Documentation Coverage Status GitHub issues license codecov

如果你正在算法之门外彷徨,如果你正在发愁不知道该怎么进行算法学习,或许本项目能够适合你。

本项目是我准备的算法学习历程,包括我对算法书籍的整理,算法实践(Go 实现),以及各种算法的理解,也还会有一些有关方面的经验总结。

希望有更多的人参与进来,咱们一起前行,一起精进。

Inspire by aQuaYi/LeetCode-in-Go, WindomZ/leetcode-graphql

LeetCode 生成器

可以生成 LeetCode 模板,还可以更新 README ,还可以添加待办任务等部分琐碎的工作。

配置方法

  1. .gitignore 中,添加 *.toml(避免用户名密码暴露)
  2. learning-algorithms 目录下,添加文本文件config.toml
  3. 把以下内容复制到 config.toml 中。
Username="your leetcode username"
Password="your leetcode password"

使用方法

  1. 构建
go build

或者

go install
  1. 准备题目:
go run main.go prepare -number 146 -lang golang -dir practive/leetcode_golang
go run main.go prepare -number 146 -lang c++ -dir practive/leetcode_c++
go run main.go prepare -number 146 -lang java -dir practive/leetcode_java
  1. 更新 README
go run main.go readme

进度

统计范围:能提交 Go 解答的免费算法题。

Easy Medium Hard Total
Accepted 4 1 2 7
Total 245 412 177 834

开发环境

  • macOS 10.14.3
  • go version go1.12.3 darwin/amd64
  • GoLand

完成清单

题号 题目 通过率 难度 收藏
0001 Two Sum 44% Easy
0002 Add Two Numbers 31% Medium
0007 Reverse Integer 25% Easy
0009 Palindrome Number 43% Easy
0042 Trapping Rain Water 43% Hard
0125 Valid Palindrome 31% Easy
0146 LRU Cache 25% Hard

未完成清单

题号 题目 通过率 难度 收藏
0001 Two Sum 44% Easy
0002 Add Two Numbers 31% Medium
0003 * Longest Substring Without Repeating Characters 28% Medium
0004 * Median of Two Sorted Arrays 26% Hard
0005 * Longest Palindromic Substring 27% Medium
0006 * ZigZag Conversion 31% Medium
0007 Reverse Integer 25% Easy
0008 * String to Integer (atoi) 14% Medium
0009 Palindrome Number 43% Easy
0010 * Regular Expression Matching 25% Hard
0011 * Container With Most Water 44% Medium
0012 * Integer to Roman 50% Medium
0013 * Roman to Integer 52% Easy
0014 * Longest Common Prefix 33% Easy
0015 * 3Sum 23% Medium
0016 * 3Sum Closest 45% Medium
0017 * Letter Combinations of a Phone Number 41% Medium
0018 * 4Sum 30% Medium
0019 * Remove Nth Node From End of List 34% Medium
0020 * Valid Parentheses 36% Easy
0021 * Merge Two Sorted Lists 47% Easy
0022 * Generate Parentheses 54% Medium
0023 * Merge k Sorted Lists 34% Hard
0024 * Swap Nodes in Pairs 44% Medium
0025 * Reverse Nodes in k-Group 36% Hard
0026 * Remove Duplicates from Sorted Array 40% Easy
0027 * Remove Element 44% Easy
0028 * Implement strStr() 31% Easy
0029 * Divide Two Integers 16% Medium
0030 * Substring with Concatenation of All Words 23% Hard
0031 * Next Permutation 30% Medium
0032 * Longest Valid Parentheses 25% Hard
0033 * Search in Rotated Sorted Array 32% Medium
0034 * Find First and Last Position of Element in Sorted Array 33% Medium
0035 * Search Insert Position 40% Easy
0036 * Valid Sudoku 42% Medium
0037 * Sudoku Solver 36% Hard
0038 * Count and Say 40% Easy
0039 * Combination Sum 48% Medium
0040 * Combination Sum II 41% Medium
0041 * First Missing Positive 28% Hard
0042 Trapping Rain Water 43% Hard
0043 * Multiply Strings 30% Medium
0044 * Wildcard Matching 22% Hard
0045 * Jump Game II 27% Hard
0046 * Permutations 54% Medium
0047 * Permutations II 40% Medium
0048 * Rotate Image 48% Medium
0049 * Group Anagrams 46% Medium
0050 * Pow(x, n) 27% Medium
0051 * N-Queens 39% Hard
0052 * N-Queens II 51% Hard
0053 * Maximum Subarray 43% Easy
0054 * Spiral Matrix 30% Medium
0055 * Jump Game 31% Medium
0056 * Merge Intervals 35% Medium
0057 * Insert Interval 31% Hard
0058 * Length of Last Word 32% Easy
0059 * Spiral Matrix II 46% Medium
0060 * Permutation Sequence 32% Medium
0061 * Rotate List 27% Medium
0062 * Unique Paths 47% Medium
0063 * Unique Paths II 33% Medium
0064 * Minimum Path Sum 46% Medium
0065 * Valid Number 13% Hard
0066 * Plus One 41% Easy
0067 * Add Binary 38% Easy
0068 * Text Justification 23% Hard
0069 * Sqrt(x) 31% Easy
0070 * Climbing Stairs 44% Easy
0071 * Simplify Path 28% Medium
0072 * Edit Distance 37% Hard
0073 * Set Matrix Zeroes 39% Medium
0074 * Search a 2D Matrix 34% Medium
0075 * Sort Colors 42% Medium
0076 * Minimum Window Substring 30% Hard
0077 * Combinations 47% Medium
0078 * Subsets 52% Medium
0079 * Word Search 31% Medium
0080 * Remove Duplicates from Sorted Array II 40% Medium
0081 * Search in Rotated Sorted Array II 32% Medium
0082 * Remove Duplicates from Sorted List II 32% Medium
0083 * Remove Duplicates from Sorted List 42% Easy
0084 * Largest Rectangle in Histogram 31% Hard
0085 * Maximal Rectangle 33% Hard
0086 * Partition List 37% Medium
0087 * Scramble String 31% Hard
0088 * Merge Sorted Array 35% Easy
0089 * Gray Code 45% Medium
0090 * Subsets II 42% Medium
0091 * Decode Ways 22% Medium
0092 * Reverse Linked List II 34% Medium
0093 * Restore IP Addresses 31% Medium
0094 * Binary Tree Inorder Traversal 56% Medium
0095 * Unique Binary Search Trees II 35% Medium
0096 * Unique Binary Search Trees 46% Medium
0097 * Interleaving String 27% Hard
0098 * Validate Binary Search Tree 25% Medium
0099 * Recover Binary Search Tree 34% Hard
0100 * Same Tree 49% Easy
0101 * Symmetric Tree 43% Easy
0102 * Binary Tree Level Order Traversal 48% Medium
0103 * Binary Tree Zigzag Level Order Traversal 41% Medium
0104 * Maximum Depth of Binary Tree 60% Easy
0105 * Construct Binary Tree from Preorder and Inorder Traversal 40% Medium
0106 * Construct Binary Tree from Inorder and Postorder Traversal 39% Medium
0107 * Binary Tree Level Order Traversal II 46% Easy
0108 * Convert Sorted Array to Binary Search Tree 50% Easy
0109 * Convert Sorted List to Binary Search Tree 40% Medium
0110 * Balanced Binary Tree 40% Easy
0111 * Minimum Depth of Binary Tree 35% Easy
0112 * Path Sum 37% Easy
0113 * Path Sum II 40% Medium
0114 * Flatten Binary Tree to Linked List 42% Medium
0115 * Distinct Subsequences 34% Hard
0118 * Pascal's Triangle 45% Easy
0119 * Pascal's Triangle II 43% Easy
0120 * Triangle 39% Medium
0121 * Best Time to Buy and Sell Stock 47% Easy
0122 * Best Time to Buy and Sell Stock II 51% Easy
0123 * Best Time to Buy and Sell Stock III 33% Hard
0124 * Binary Tree Maximum Path Sum 29% Hard
0125 Valid Palindrome 31% Easy
0126 * Word Ladder II 17% Hard
0127 * Word Ladder 23% Medium
0128 * Longest Consecutive Sequence 41% Hard
0129 * Sum Root to Leaf Numbers 42% Medium
0130 * Surrounded Regions 22% Medium
0131 * Palindrome Partitioning 40% Medium
0132 * Palindrome Partitioning II 27% Hard
0134 * Gas Station 33% Medium
0135 * Candy 28% Hard
0136 * Single Number 59% Easy
0137 * Single Number II 45% Medium
0139 * Word Break 35% Medium
0140 * Word Break II 27% Hard
0141 * Linked List Cycle 36% Easy
0142 * Linked List Cycle II 31% Medium
0143 * Reorder List 30% Medium
0144 * Binary Tree Preorder Traversal 51% Medium
0145 * Binary Tree Postorder Traversal 48% Hard
0146 LRU Cache 25% Hard
0147 * Insertion Sort List 37% Medium
0148 * Sort List 35% Medium
0149 * Max Points on a Line 15% Hard
0150 * Evaluate Reverse Polish Notation 32% Medium
0152 * Maximum Product Subarray 29% Medium
0153 * Find Minimum in Rotated Sorted Array 42% Medium
0154 * Find Minimum in Rotated Sorted Array II 39% Hard
0155 * Min Stack 36% Easy
0160 * Intersection of Two Linked Lists 33% Easy
0162 * Find Peak Element 41% Medium
0164 * Maximum Gap 32% Hard
0165 * Compare Version Numbers 23% Medium
0166 * Fraction to Recurring Decimal 19% Medium
0167 * Two Sum II - Input array is sorted 50% Easy
0168 * Excel Sheet Column Title 28% Easy
0169 * Majority Element 52% Easy
0171 * Excel Sheet Column Number 51% Easy
0172 * Factorial Trailing Zeroes 37% Easy
0173 * Binary Search Tree Iterator 48% Medium
0174 * Dungeon Game 27% Hard
0179 * Largest Number 25% Medium
0187 * Repeated DNA Sequences 35% Medium
0188 * Best Time to Buy and Sell Stock IV 26% Hard
0189 * Rotate Array 29% Easy
0190 * Reverse Bits 31% Easy
0191 * Number of 1 Bits 43% Easy
0198 * House Robber 40% Easy
0199 * Binary Tree Right Side View 47% Medium
0200 * Number of Islands 41% Medium
0201 * Bitwise AND of Numbers Range 35% Medium
0202 * Happy Number 45% Easy
0203 * Remove Linked List Elements 35% Easy
0204 * Count Primes 28% Easy
0205 * Isomorphic Strings 37% Easy
0206 * Reverse Linked List 54% Easy
0207 * Course Schedule 37% Medium
0208 * Implement Trie (Prefix Tree) 38% Medium
0209 * Minimum Size Subarray Sum 34% Medium
0210 * Course Schedule II 34% Medium
0211 * Add and Search Word - Data structure design 30% Medium
0212 * Word Search II 28% Hard
0213 * House Robber II 35% Medium
0214 * Shortest Palindrome 27% Hard
0215 * Kth Largest Element in an Array 47% Medium
0216 * Combination Sum III 51% Medium
0217 * Contains Duplicate 51% Easy
0218 * The Skyline Problem 31% Hard
0219 * Contains Duplicate II 35% Easy
0220 * Contains Duplicate III 19% Medium
0221 * Maximal Square 32% Medium
0222 * Count Complete Tree Nodes 33% Medium
0223 * Rectangle Area 35% Medium
0224 * Basic Calculator 32% Hard
0225 * Implement Stack using Queues 39% Easy
0226 * Invert Binary Tree 58% Easy
0227 * Basic Calculator II 33% Medium
0228 * Summary Ranges 35% Medium
0229 * Majority Element II 31% Medium
0230 * Kth Smallest Element in a BST 51% Medium
0231 * Power of Two 41% Easy
0232 * Implement Queue using Stacks 43% Easy
0233 * Number of Digit One 30% Hard
0234 * Palindrome Linked List 35% Easy
0235 * Lowest Common Ancestor of a Binary Search Tree 44% Easy
0236 * Lowest Common Ancestor of a Binary Tree 37% Medium
0237 * Delete Node in a Linked List 53% Easy
0238 * Product of Array Except Self 54% Medium
0239 * Sliding Window Maximum 38% Hard
0240 * Search a 2D Matrix II 40% Medium
0241 * Different Ways to Add Parentheses 49% Medium
0242 * Valid Anagram 52% Easy
0257 * Binary Tree Paths 45% Easy
0258 * Add Digits 54% Easy
0260 * Single Number III 56% Medium
0263 * Ugly Number 40% Easy
0264 * Ugly Number II 36% Medium
0268 * Missing Number 48% Easy
0273 * Integer to English Words 24% Hard
0274 * H-Index 34% Medium
0275 * H-Index II 35% Medium
0279 * Perfect Squares 41% Medium
0282 * Expression Add Operators 32% Hard
0283 * Move Zeroes 54% Easy
0287 * Find the Duplicate Number 49% Medium
0289 * Game of Life 45% Medium
0290 * Word Pattern 34% Easy
0292 * Nim Game 55% Easy
0295 * Find Median from Data Stream 36% Hard
0299 * Bulls and Cows 39% Medium
0300 * Longest Increasing Subsequence 40% Medium
0301 * Remove Invalid Parentheses 39% Hard
0303 * Range Sum Query - Immutable 37% Easy
0304 * Range Sum Query 2D - Immutable 32% Medium
0306 * Additive Number 28% Medium
0307 * Range Sum Query - Mutable 28% Medium
0309 * Best Time to Buy and Sell Stock with Cooldown 43% Medium
0310 * Minimum Height Trees 30% Medium
0312 * Burst Balloons 47% Hard
0313 * Super Ugly Number 41% Medium
0315 * Count of Smaller Numbers After Self 38% Hard
0316 * Remove Duplicate Letters 32% Hard
0318 * Maximum Product of Word Lengths 48% Medium
0319 * Bulb Switcher 43% Medium
0321 * Create Maximum Number 25% Hard
0322 * Coin Change 30% Medium
0324 * Wiggle Sort II 27% Medium
0326 * Power of Three 41% Easy
0327 * Count of Range Sum 32% Hard
0328 * Odd Even Linked List 49% Medium
0329 * Longest Increasing Path in a Matrix 39% Hard
0330 * Patching Array 33% Hard
0331 * Verify Preorder Serialization of a Binary Tree 38% Medium
0332 * Reconstruct Itinerary 31% Medium
0334 * Increasing Triplet Subsequence 39% Medium
0335 * Self Crossing 26% Hard
0336 * Palindrome Pairs 30% Hard
0337 * House Robber III 47% Medium
0338 * Counting Bits 64% Medium
0342 * Power of Four 40% Easy
0343 * Integer Break 47% Medium
0344 * Reverse String 63% Easy
0345 * Reverse Vowels of a String 41% Easy
0347 * Top K Frequent Elements 54% Medium
0349 * Intersection of Two Arrays 54% Easy
0350 * Intersection of Two Arrays II 47% Easy
0352 * Data Stream as Disjoint Intervals 43% Hard
0354 * Russian Doll Envelopes 33% Hard
0355 * Design Twitter 27% Medium
0357 * Count Numbers with Unique Digits 46% Medium
0363 * Max Sum of Rectangle No Larger Than K 35% Hard
0365 * Water and Jug Problem 28% Medium
0367 * Valid Perfect Square 39% Easy
0368 * Largest Divisible Subset 34% Medium
0371 * Sum of Two Integers 50% Easy
0372 * Super Pow 35% Medium
0373 * Find K Pairs with Smallest Sums 33% Medium
0375 * Guess Number Higher or Lower II 37% Medium
0376 * Wiggle Subsequence 37% Medium
0377 * Combination Sum IV 43% Medium
0378 * Kth Smallest Element in a Sorted Matrix 49% Medium
0380 * Insert Delete GetRandom O(1) 42% Medium
0381 * Insert Delete GetRandom O(1) - Duplicates allowed 31% Hard
0382 * Linked List Random Node 49% Medium
0383 * Ransom Note 49% Easy
0384 * Shuffle an Array 49% Medium
0385 * Mini Parser 31% Medium
0386 * Lexicographical Numbers 45% Medium
0387 * First Unique Character in a String 49% Easy
0388 * Longest Absolute File Path 39% Medium
0389 * Find the Difference 52% Easy
0390 * Elimination Game 43% Medium
0391 * Perfect Rectangle 28% Hard
0392 * Is Subsequence 46% Medium
0393 * UTF-8 Validation 35% Medium
0394 * Decode String 44% Medium
0395 * Longest Substring with At Least K Repeating Characters 38% Medium
0396 * Rotate Function 35% Medium
0397 * Integer Replacement 31% Medium
0398 * Random Pick Index 49% Medium
0399 * Evaluate Division 47% Medium
0400 * Nth Digit 30% Easy
0401 * Binary Watch 45% Easy
0402 * Remove K Digits 26% Medium
0403 * Frog Jump 36% Hard
0404 * Sum of Left Leaves 49% Easy
0405 * Convert a Number to Hexadecimal 41% Easy
0406 * Queue Reconstruction by Height 59% Medium
0407 * Trapping Rain Water II 39% Hard
0409 * Longest Palindrome 47% Easy
0410 * Split Array Largest Sum 42% Hard
0412 * Fizz Buzz 59% Easy
0413 * Arithmetic Slices 55% Medium
0414 * Third Maximum Number 28% Easy
0415 * Add Strings 43% Easy
0416 * Partition Equal Subset Sum 40% Medium
0417 * Pacific Atlantic Water Flow 37% Medium
0419 * Battleships in a Board 65% Medium
0420 * Strong Password Checker 17% Hard
0421 * Maximum XOR of Two Numbers in an Array 50% Medium
0423 * Reconstruct Original Digits from English 45% Medium
0424 * Longest Repeating Character Replacement 44% Medium
0432 * All O`one Data Structure 29% Hard
0433 * Minimum Genetic Mutation 37% Medium
0434 * Number of Segments in a String 36% Easy
0435 * Non-overlapping Intervals 41% Medium
0436 * Find Right Interval 42% Medium
0437 * Path Sum III 42% Easy
0438 * Find All Anagrams in a String 37% Easy
0440 * K-th Smallest in Lexicographical Order 26% Hard
0441 * Arranging Coins 37% Easy
0442 * Find All Duplicates in an Array 60% Medium
0443 * String Compression 37% Easy
0445 * Add Two Numbers II 49% Medium
0446 * Arithmetic Slices II - Subsequence 30% Hard
0447 * Number of Boomerangs 49% Easy
0448 * Find All Numbers Disappeared in an Array 53% Easy
0450 * Delete Node in a BST 39% Medium
0451 * Sort Characters By Frequency 55% Medium
0452 * Minimum Number of Arrows to Burst Balloons 46% Medium
0453 * Minimum Moves to Equal Array Elements 49% Easy
0454 * 4Sum II 50% Medium
0455 * Assign Cookies 48% Easy
0456 * 132 Pattern 27% Medium
0457 * Circular Array Loop 27% Medium
0458 * Poor Pigs 45% Hard
0459 * Repeated Substring Pattern 39% Easy
0460 * LFU Cache 28% Hard
0461 * Hamming Distance 70% Easy
0462 * Minimum Moves to Equal Array Elements II 52% Medium
0463 * Island Perimeter 60% Easy
0464 * Can I Win 27% Medium
0466 * Count The Repetitions 27% Hard
0467 * Unique Substrings in Wraparound String 33% Medium
0468 * Validate IP Address 21% Medium
0470 * Implement Rand10() Using Rand7() 44% Medium
0472 * Concatenated Words 34% Hard
0473 * Matchsticks to Square 35% Medium
0474 * Ones and Zeroes 39% Medium
0475 * Heaters 31% Easy
0476 * Number Complement 62% Easy
0477 * Total Hamming Distance 48% Medium
0478 * Generate Random Point in a Circle 36% Medium
0479 * Largest Palindrome Product 27% Hard
0480 * Sliding Window Median 32% Hard
0481 * Magical String 46% Medium
0482 * License Key Formatting 40% Easy
0483 * Smallest Good Base 34% Hard
0485 * Max Consecutive Ones 54% Easy
0486 * Predict the Winner 46% Medium
0488 * Zuma Game 38% Hard
0491 * Increasing Subsequences 41% Medium
0492 * Construct the Rectangle 48% Easy
0493 * Reverse Pairs 23% Hard
0494 * Target Sum 45% Medium
0495 * Teemo Attacking 52% Medium
0496 * Next Greater Element I 59% Easy
0497 * Random Point in Non-overlapping Rectangles 35% Medium
0498 * Diagonal Traverse 45% Medium
0500 * Keyboard Row 62% Easy
0501 * Find Mode in Binary Search Tree 39% Easy
0502 * IPO 37% Hard
0503 * Next Greater Element II 50% Medium
0504 * Base 7 44% Easy
0506 * Relative Ranks 48% Easy
0507 * Perfect Number 34% Easy
0508 * Most Frequent Subtree Sum 54% Medium
0509 * Fibonacci Number 66% Easy
0513 * Find Bottom Left Tree Value 58% Medium
0514 * Freedom Trail 40% Hard
0515 * Find Largest Value in Each Tree Row 57% Medium
0516 * Longest Palindromic Subsequence 46% Medium
0517 * Super Washing Machines 36% Hard
0518 * Coin Change 2 42% Medium
0519 * Random Flip Matrix 33% Medium
0520 * Detect Capital 52% Easy
0521 * Longest Uncommon Subsequence I 56% Easy
0522 * Longest Uncommon Subsequence II 32% Medium
0523 * Continuous Subarray Sum 24% Medium
0524 * Longest Word in Dictionary through Deleting 45% Medium
0525 * Contiguous Array 42% Medium
0526 * Beautiful Arrangement 54% Medium
0528 * Random Pick with Weight 42% Medium
0529 * Minesweeper 52% Medium
0530 * Minimum Absolute Difference in BST 50% Easy
0532 * K-diff Pairs in an Array 29% Easy
0537 * Complex Number Multiplication 65% Medium
0538 * Convert BST to Greater Tree 50% Easy
0539 * Minimum Time Difference 47% Medium
0540 * Single Element in a Sorted Array 57% Medium
0541 * Reverse String II 45% Easy
0542 * 01 Matrix 35% Medium
0543 * Diameter of Binary Tree 46% Easy
0546 * Remove Boxes 38% Hard
0547 * Friend Circles 53% Medium
0551 * Student Attendance Record I 45% Easy
0552 * Student Attendance Record II 32% Hard
0553 * Optimal Division 55% Medium
0554 * Brick Wall 47% Medium
0556 * Next Greater Element III 29% Medium
0557 * Reverse Words in a String III 63% Easy
0560 * Subarray Sum Equals K 42% Medium
0561 * Array Partition I 68% Easy
0563 * Binary Tree Tilt 46% Easy
0564 * Find the Closest Palindrome 18% Hard
0565 * Array Nesting 52% Medium
0566 * Reshape the Matrix 58% Easy
0567 * Permutation in String 38% Medium
0572 * Subtree of Another Tree 41% Easy
0575 * Distribute Candies 59% Easy
0576 * Out of Boundary Paths 31% Medium
0581 * Shortest Unsorted Continuous Subarray 29% Easy
0583 * Delete Operation for Two Strings 44% Medium
0587 * Erect the Fence 34% Hard
0591 * Tag Validator 32% Hard
0592 * Fraction Addition and Subtraction 46% Medium
0593 * Valid Square 40% Medium
0594 * Longest Harmonious Subsequence 43% Easy
0598 * Range Addition II 48% Easy
0599 * Minimum Index Sum of Two Lists 47% Easy
0600 * Non-negative Integers without Consecutive Ones 32% Hard
0605 * Can Place Flowers 30% Easy
0606 * Construct String from Binary Tree 51% Easy
0609 * Find Duplicate File in System 54% Medium
0611 * Valid Triangle Number 45% Medium
0617 * Merge Two Binary Trees 70% Easy
0621 * Task Scheduler 45% Medium
0622 * Design Circular Queue 39% Medium
0623 * Add One Row to Tree 47% Medium
0628 * Maximum Product of Three Numbers 45% Easy
0629 * K Inverse Pairs Array 29% Hard
0630 * Course Schedule III 31% Hard
0632 * Smallest Range 47% Hard
0633 * Sum of Square Numbers 32% Easy
0636 * Exclusive Time of Functions 48% Medium
0637 * Average of Levels in Binary Tree 58% Easy
0638 * Shopping Offers 48% Medium
0639 * Decode Ways II 25% Hard
0640 * Solve the Equation 40% Medium
0641 * Design Circular Deque 49% Medium
0643 * Maximum Average Subarray I 39% Easy
0645 * Set Mismatch 40% Easy
0646 * Maximum Length of Pair Chain 48% Medium
0647 * Palindromic Substrings 56% Medium
0648 * Replace Words 51% Medium
0649 * Dota2 Senate 37% Medium
0650 * 2 Keys Keyboard 46% Medium
0652 * Find Duplicate Subtrees 45% Medium
0653 * Two Sum IV - Input is a BST 52% Easy
0654 * Maximum Binary Tree 75% Medium
0655 * Print Binary Tree 51% Medium
0657 * Robot Return to Origin 71% Easy
0658 * Find K Closest Elements 37% Medium
0659 * Split Array into Consecutive Subsequences 40% Medium
0661 * Image Smoother 48% Easy
0662 * Maximum Width of Binary Tree 39% Medium
0664 * Strange Printer 36% Hard
0665 * Non-decreasing Array 19% Easy
0667 * Beautiful Arrangement II 51% Medium
0668 * Kth Smallest Number in Multiplication Table 41% Hard
0669 * Trim a Binary Search Tree 60% Easy
0670 * Maximum Swap 39% Medium
0671 * Second Minimum Node In a Binary Tree 43% Easy
0672 * Bulb Switcher II 49% Medium
0673 * Number of Longest Increasing Subsequence 33% Medium
0674 * Longest Continuous Increasing Subsequence 44% Easy
0675 * Cut Off Trees for Golf Event 30% Hard
0676 * Implement Magic Dictionary 51% Medium
0677 * Map Sum Pairs 51% Medium
0678 * Valid Parenthesis String 32% Medium
0679 * 24 Game 42% Hard
0680 * Valid Palindrome II 34% Easy
0682 * Baseball Game 60% Easy
0684 * Redundant Connection 51% Medium
0685 * Redundant Connection II 30% Hard
0686 * Repeated String Match 31% Easy
0687 * Longest Univalue Path 33% Easy
0688 * Knight Probability in Chessboard 44% Medium
0689 * Maximum Sum of 3 Non-Overlapping Subarrays 44% Hard
0691 * Stickers to Spell Word 38% Hard
0692 * Top K Frequent Words 45% Medium
0693 * Binary Number with Alternating Bits 57% Easy
0695 * Max Area of Island 57% Medium
0696 * Count Binary Substrings 53% Easy
0697 * Degree of an Array 50% Easy
0698 * Partition to K Equal Sum Subsets 42% Medium
0699 * Falling Squares 39% Hard
0700 * Search in a Binary Search Tree 67% Easy
0701 * Insert into a Binary Search Tree 75% Medium
0703 * Kth Largest Element in a Stream 46% Easy
0704 * Binary Search 47% Easy
0705 * Design HashSet 53% Easy
0706 * Design HashMap 55% Easy
0707 * Design Linked List 22% Easy
0709 * To Lower Case 76% Easy
0710 * Random Pick with Blacklist 30% Hard
0712 * Minimum ASCII Delete Sum for Two Strings 54% Medium
0713 * Subarray Product Less Than K 36% Medium
0714 * Best Time to Buy and Sell Stock with Transaction Fee 50% Medium
0715 * Range Module 35% Hard
0717 * 1-bit and 2-bit Characters 49% Easy
0718 * Maximum Length of Repeated Subarray 45% Medium
0719 * Find K-th Smallest Pair Distance 29% Hard
0720 * Longest Word in Dictionary 44% Easy
0721 * Accounts Merge 40% Medium
0722 * Remove Comments 31% Medium
0724 * Find Pivot Index 41% Easy
0725 * Split Linked List in Parts 48% Medium
0726 * Number of Atoms 44% Hard
0728 * Self Dividing Numbers 69% Easy
0729 * My Calendar I 47% Medium
0730 * Count Different Palindromic Subsequences 38% Hard
0731 * My Calendar II 44% Medium
0732 * My Calendar III 54% Hard
0733 * Flood Fill 50% Easy
0735 * Asteroid Collision 38% Medium
0736 * Parse Lisp Expression 44% Hard
0738 * Monotone Increasing Digits 41% Medium
0739 * Daily Temperatures 59% Medium
0740 * Delete and Earn 45% Medium
0741 * Cherry Pickup 29% Hard
0743 * Network Delay Time 41% Medium
0744 * Find Smallest Letter Greater Than Target 43% Easy
0745 * Prefix and Suffix Search 30% Hard
0746 * Min Cost Climbing Stairs 47% Easy
0747 * Largest Number At Least Twice of Others 40% Easy
0748 * Shortest Completing Word 53% Easy
0749 * Contain Virus 41% Hard
0752 * Open the Lock 45% Medium
0753 * Cracking the Safe 46% Hard
0754 * Reach a Number 32% Easy
0756 * Pyramid Transition Matrix 51% Medium
0757 * Set Intersection Size At Least Two 36% Hard
0761 * Special Binary String 50% Hard
0762 * Prime Number of Set Bits in Binary Representation 58% Easy
0763 * Partition Labels 70% Medium
0764 * Largest Plus Sign 43% Medium
0765 * Couples Holding Hands 51% Hard
0766 * Toeplitz Matrix 61% Easy
0767 * Reorganize String 41% Medium
0768 * Max Chunks To Make Sorted II 45% Hard
0769 * Max Chunks To Make Sorted 51% Medium
0770 * Basic Calculator IV 45% Hard
0771 * Jewels and Stones 83% Easy
0773 * Sliding Puzzle 52% Hard
0775 * Global and Local Inversions 38% Medium
0777 * Swap Adjacent in LR String 33% Medium
0778 * Swim in Rising Water 47% Hard
0779 * K-th Symbol in Grammar 37% Medium
0780 * Reaching Points 27% Hard
0781 * Rabbits in Forest 51% Medium
0782 * Transform to Chessboard 39% Hard
0783 * Minimum Distance Between BST Nodes 50% Easy
0784 * Letter Case Permutation 56% Easy
0785 * Is Graph Bipartite? 43% Medium
0786 * K-th Smallest Prime Fraction 39% Hard
0787 * Cheapest Flights Within K Stops 34% Medium
0788 * Rotated Digits 54% Easy
0789 * Escape The Ghosts 55% Medium
0790 * Domino and Tromino Tiling 35% Medium
0791 * Custom Sort String 61% Medium
0792 * Number of Matching Subsequences 42% Medium
0793 * Preimage Size of Factorial Zeroes Function 38% Hard
0794 * Valid Tic-Tac-Toe State 29% Medium
0795 * Number of Subarrays with Bounded Maximum 43% Medium
0796 * Rotate String 48% Easy
0797 * All Paths From Source to Target 70% Medium
0798 * Smallest Rotation with Highest Score 39% Hard
0799 * Champagne Tower 33% Medium
0801 * Minimum Swaps To Make Sequences Increasing 34% Medium
0802 * Find Eventual Safe States 43% Medium
0803 * Bricks Falling When Hit 28% Hard
0804 * Unique Morse Code Words 74% Easy
0805 * Split Array With Same Average 24% Hard
0806 * Number of Lines To Write String 62% Easy
0807 * Max Increase to Keep City Skyline 81% Medium
0808 * Soup Servings 36% Medium
0809 * Expressive Words 43% Medium
0810 * Chalkboard XOR Game 44% Hard
0811 * Subdomain Visit Count 65% Easy
0812 * Largest Triangle Area 55% Easy
0813 * Largest Sum of Averages 44% Medium
0814 * Binary Tree Pruning 70% Medium
0815 * Bus Routes 39% Hard
0816 * Ambiguous Coordinates 43% Medium
0817 * Linked List Components 54% Medium
0818 * Race Car 34% Hard
0819 * Most Common Word 42% Easy
0820 * Short Encoding of Words 46% Medium
0821 * Shortest Distance to a Character 63% Easy
0822 * Card Flipping Game 40% Medium
0823 * Binary Trees With Factors 32% Medium
0824 * Goat Latin 57% Easy
0825 * Friends Of Appropriate Ages 36% Medium
0826 * Most Profit Assigning Work 35% Medium
0827 * Making A Large Island 43% Hard
0828 * Unique Letter String 39% Hard
0829 * Consecutive Numbers Sum 32% Hard
0830 * Positions of Large Groups 47% Easy
0831 * Masking Personal Information 42% Medium
0832 * Flipping an Image 72% Easy
0833 * Find And Replace in String 45% Medium
0834 * Sum of Distances in Tree 39% Hard
0835 * Image Overlap 52% Medium
0836 * Rectangle Overlap 46% Easy
0837 * New 21 Game 31% Medium
0838 * Push Dominoes 43% Medium
0839 * Similar String Groups 34% Hard
0840 * Magic Squares In Grid 35% Easy
0841 * Keys and Rooms 60% Medium
0842 * Split Array into Fibonacci Sequence 34% Medium
0843 * Guess the Word 43% Hard
0844 * Backspace String Compare 45% Easy
0845 * Longest Mountain in Array 34% Medium
0846 * Hand of Straights 48% Medium
0847 * Shortest Path Visiting All Nodes 46% Hard
0848 * Shifting Letters 40% Medium
0849 * Maximize Distance to Closest Person 40% Easy
0850 * Rectangle Area II 44% Hard
0851 * Loud and Rich 47% Medium
0852 * Peak Index in a Mountain Array 69% Easy
0853 * Car Fleet 39% Medium
0854 * K-Similar Strings 33% Hard
0855 * Exam Room 38% Medium
0856 * Score of Parentheses 55% Medium
0857 * Minimum Cost to Hire K Workers 47% Hard
0858 * Mirror Reflection 51% Medium
0859 * Buddy Strings 27% Easy
0860 * Lemonade Change 50% Easy
0861 * Score After Flipping Matrix 69% Medium
0862 * Shortest Subarray with Sum at Least K 22% Hard
0863 * All Nodes Distance K in Binary Tree 46% Medium
0864 * Shortest Path to Get All Keys 35% Hard
0865 * Smallest Subtree with all the Deepest Nodes 55% Medium
0866 * Prime Palindrome 20% Medium
0867 * Transpose Matrix 63% Easy
0868 * Binary Gap 59% Easy
0869 * Reordered Power of 2 50% Medium
0870 * Advantage Shuffle 42% Medium
0871 * Minimum Number of Refueling Stops 28% Hard
0872 * Leaf-Similar Trees 63% Easy
0873 * Length of Longest Fibonacci Subsequence 46% Medium
0874 * Walking Robot Simulation 31% Easy
0875 * Koko Eating Bananas 45% Medium
0876 * Middle of the Linked List 63% Easy
0877 * Stone Game 61% Medium
0878 * Nth Magical Number 25% Hard
0879 * Profitable Schemes 36% Hard
0880 * Decoded String at Index 23% Medium
0881 * Boats to Save People 43% Medium
0882 * Reachable Nodes In Subdivided Graph 37% Hard
0883 * Projection Area of 3D Shapes 65% Easy
0884 * Uncommon Words from Two Sentences 60% Easy
0885 * Spiral Matrix III 63% Medium
0886 * Possible Bipartition 40% Medium
0887 * Super Egg Drop 25% Hard
0888 * Fair Candy Swap 56% Easy
0889 * Construct Binary Tree from Preorder and Postorder Traversal 59% Medium
0890 * Find and Replace Pattern 71% Medium
0891 * Sum of Subsequence Widths 28% Hard
0892 * Surface Area of 3D Shapes 55% Easy
0893 * Groups of Special-Equivalent Strings 62% Easy
0894 * All Possible Full Binary Trees 70% Medium
0895 * Maximum Frequency Stack 55% Hard
0896 * Monotonic Array 55% Easy
0897 * Increasing Order Search Tree 64% Easy
0898 * Bitwise ORs of Subarrays 33% Medium
0899 * Orderly Queue 47% Hard
0900 * RLE Iterator 50% Medium
0901 * Online Stock Span 48% Medium
0902 * Numbers At Most N Given Digit Set 28% Hard
0903 * Valid Permutations for DI Sequence 43% Hard
0904 * Fruit Into Baskets 41% Medium
0905 * Sort Array By Parity 72% Easy
0906 * Super Palindromes 30% Hard
0907 * Sum of Subarray Minimums 26% Medium
0908 * Smallest Range I 64% Easy
0909 * Snakes and Ladders 32% Medium
0910 * Smallest Range II 23% Medium
0911 * Online Election 46% Medium
0912 * Sort an Array 64% Medium
0913 * Cat and Mouse 28% Hard
0914 * X of a Kind in a Deck of Cards 34% Easy
0915 * Partition Array into Disjoint Intervals 43% Medium
0916 * Word Subsets 45% Medium
0917 * Reverse Only Letters 55% Easy
0918 * Maximum Sum Circular Subarray 31% Medium
0919 * Complete Binary Tree Inserter 55% Medium
0920 * Number of Music Playlists 43% Hard
0921 * Minimum Add to Make Parentheses Valid 70% Medium
0922 * Sort Array By Parity II 67% Easy
0923 * 3Sum With Multiplicity 33% Medium
0924 * Minimize Malware Spread 39% Hard
0925 * Long Pressed Name 44% Easy
0926 * Flip String to Monotone Increasing 49% Medium
0927 * Three Equal Parts 30% Hard
0928 * Minimize Malware Spread II 38% Hard
0929 * Unique Email Addresses 71% Easy
0930 * Binary Subarrays With Sum 37% Medium
0931 * Minimum Falling Path Sum 58% Medium
0932 * Beautiful Array 52% Medium
0933 * Number of Recent Calls 69% Easy
0934 * Shortest Bridge 43% Medium
0935 * Knight Dialer 40% Medium
0936 * Stamping The Sequence 36% Hard
0937 * Reorder Log Files 57% Easy
0938 * Range Sum of BST 79% Easy
0939 * Minimum Area Rectangle 50% Medium
0940 * Distinct Subsequences II 39% Hard
0941 * Valid Mountain Array 35% Easy
0942 * DI String Match 69% Easy
0943 * Find the Shortest Superstring 37% Hard
0944 * Delete Columns to Make Sorted 69% Easy
0945 * Minimum Increment to Make Array Unique 42% Medium
0946 * Validate Stack Sequences 57% Medium
0947 * Most Stones Removed with Same Row or Column 54% Medium
0948 * Bag of Tokens 39% Medium
0949 * Largest Time for Given Digits 33% Easy
0950 * Reveal Cards In Increasing Order 71% Medium
0951 * Flip Equivalent Binary Trees 65% Medium
0952 * Largest Component Size by Common Factor 26% Hard
0953 * Verifying an Alien Dictionary 55% Easy
0954 * Array of Doubled Pairs 34% Medium
0955 * Delete Columns to Make Sorted II 31% Medium
0956 * Tallest Billboard 37% Hard
0957 * Prison Cells After N Days 37% Medium
0958 * Check Completeness of a Binary Tree 46% Medium
0959 * Regions Cut By Slashes 62% Medium
0960 * Delete Columns to Make Sorted III 52% Hard
0961 * N-Repeated Element in Size 2N Array 72% Easy
0962 * Maximum Width Ramp 41% Medium
0963 * Minimum Area Rectangle II 44% Medium
0964 * Least Operators to Express Number 40% Hard
0965 * Univalued Binary Tree 66% Easy
0966 * Vowel Spellchecker 41% Medium
0967 * Numbers With Same Consecutive Differences 36% Medium
0968 * Binary Tree Cameras 34% Hard
0969 * Pancake Sorting 62% Medium
0970 * Powerful Integers 39% Easy
0971 * Flip Binary Tree To Match Preorder Traversal 42% Medium
0972 * Equal Rational Numbers 40% Hard
0973 * K Closest Points to Origin 62% Medium
0974 * Subarray Sums Divisible by K 44% Medium
0975 * Odd Even Jump 49% Hard
0976 * Largest Perimeter Triangle 56% Easy
0977 * Squares of a Sorted Array 72% Easy
0978 * Longest Turbulent Subarray 45% Medium
0979 * Distribute Coins in Binary Tree 66% Medium
0980 * Unique Paths III 71% Hard
0981 * Time Based Key-Value Store 50% Medium
0982 * Triples with Bitwise AND Equal To Zero 53% Hard
0983 * Minimum Cost For Tickets 57% Medium
0984 * String Without AAA or BBB 33% Medium
0985 * Sum of Even Numbers After Queries 64% Easy
0986 * Interval List Intersections 62% Medium
0987 * Vertical Order Traversal of a Binary Tree 32% Medium
0988 * Smallest String Starting From Leaf 46% Medium
0989 * Add to Array-Form of Integer 44% Easy
0990 * Satisfiability of Equality Equations 39% Medium
0991 * Broken Calculator 39% Medium
0992 * Subarrays with K Different Integers 45% Hard
0993 * Cousins in Binary Tree 52% Easy
0994 * Rotting Oranges 46% Easy
0995 * Minimum Number of K Consecutive Bit Flips 49% Hard
0996 * Number of Squareful Arrays 48% Hard
0997 * Find the Town Judge 48% Easy
0998 * Maximum Binary Tree II 62% Medium
0999 * Available Captures for Rook 66% Easy
1000 * Minimum Cost to Merge Stones 29% Hard
1001 * Grid Illumination 34% Hard
1002 * Find Common Characters 65% Easy
1003 * Check If Word Is Valid After Substitutions 51% Medium
1004 * Max Consecutive Ones III 52% Medium
1005 * Maximize Sum Of Array After K Negations 49% Easy
1006 * Clumsy Factorial 54% Medium
1007 * Minimum Domino Rotations For Equal Row 47% Medium
1008 * Construct Binary Search Tree from Preorder Traversal 72% Medium
1009 * Complement of Base 10 Integer 58% Easy
1010 * Pairs of Songs With Total Durations Divisible by 60 45% Easy
1011 * Capacity To Ship Packages Within D Days 52% Medium
1012 * Numbers With Repeated Digits 34% Hard
1013 * Partition Array Into Three Parts With Equal Sum 55% Easy
1014 * Best Sightseeing Pair 48% Medium
1015 * Smallest Integer Divisible by K 27% Medium
1016 * Binary String With Substrings Representing 1 To N 62% Medium
1017 * Convert to Base -2 55% Medium
1018 * Binary Prefix Divisible By 5 46% Easy
1019 * Next Greater Node In Linked List 56% Medium
1020 * Number of Enclaves 54% Medium
1021 * Remove Outermost Parentheses 77% Easy
1022 * Sum of Root To Leaf Binary Numbers 51% Easy
1023 * Camelcase Matching 57% Medium
1024 * Video Stitching 47% Medium
1025 * Divisor Game 62% Easy
1026 * Maximum Difference Between Node and Ancestor 58% Medium
1027 * Longest Arithmetic Sequence 45% Medium
1028 * Recover a Tree From Preorder Traversal 71% Hard
1029 * Two City Scheduling 53% Easy
1030 * Matrix Cells in Distance Order 66% Easy
1031 * Maximum Sum of Two Non-Overlapping Subarrays 55% Medium
1032 * Stream of Characters 40% Hard
1033 * Moving Stones Until Consecutive 33% Easy
1034 * Coloring A Border 42% Medium
1035 * Uncrossed Lines 50% Medium
1036 * Escape a Large Maze 38% Hard
1037 * Valid Boomerang 37% Easy
1038 * Binary Search Tree to Greater Sum Tree 80% Medium
1039 * Minimum Score Triangulation of Polygon 39% Medium
1040 * Moving Stones Until Consecutive II 45% Medium
1041 * Robot Bounded In Circle 40% Easy
1042 * Flower Planting With No Adjacent 45% Easy
1043 * Partition Array for Maximum Sum 58% Medium
1044 * Longest Duplicate Substring 23% Hard

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

题解

notes LeetCode 题解,也会记录我答题过程中对知识点的总结。


学习方法

  1. 仔细研读经典算法书籍(详细书单见后文)
  2. 把所有经典数据结构和算法都写一遍
  3. 刷题(LeetCode等)
  4. 找志同道合的人一起交流学习
  5. 参加比赛
  6. 。。。

推荐阅读

基础(进行中...

  • ☆☆☆☆☆《算法基础-打开算法之门》科尔曼[算法导论作者之一](阅读进度20%
  • ☆☆☆☆☆《算法导论》 是一本对算法介绍比较全面的经典书籍
  • ☆☆☆☆《编程珠玑I》
  • ☆☆☆☆《编程珠玑II》
  • ☆☆☆《算法-Algorithms》第四版,普林斯顿大学,这本近千页的书只有6章,其中四章分别是排序,查找,图,字符串,足见介绍的有多么的细致。(暂时不阅读

算法演示

编程网站

  1. LeetCode 全球最大的在线程序评测系统。
  2. OpenJudge OpenJudge是开放的在线程序评测系统 您可以创建自己的OJ小组。

笔试刷题必备

  • 《剑指offer》
  • 《编程之法:面试和算法心得》
  • 《算法谜题》
  • 《编程之美》

延伸阅读

  • 《推荐系统-技术、评估及高效算法》
  • 《深入理解计算机系统》
  • 《TCP/IP详解一二三卷》

其他

比方说:《数据挖掘十大算法系列》、《经典算法研究》、《BAT机器学习面试1000题系列》、《程序员编程艺术》等系列。

如何参与/贡献?

  1. Fork 此项目
  2. 克隆你自己的项目到你本地 (git clone https://github.com/your_github_name/learning-algorithms.git)
  3. 创建你新的 feature 分支 (git checkout -b my_feature)
  4. 添加并提交你的修改内容 (git commit -am 'Add some feature')
  5. 推送到你自己项目的远端 feature 分支 (git push origin my_feature)
  6. 创建一个新的 PR(Pull Request)

参考资料

License

License: BSD 3-Clause License