Skip to content

🎓 Go Solution for LeetCode algorithm problems, 100% coverage, continually updating.

License

Notifications You must be signed in to change notification settings

antidigital/LeetCode-in-Go

 
 

Repository files navigation

LeetCode 的 Go 解答

LeetCode 排名 codecov Build Status

进度

统计规则:1.免费题,2.算法题,3.能提交 Go 解答

Easy Medium Hard Total
Accepted 215 369 162 746
Total 234 398 173 805

题解

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

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

helper

helper 会处理大部分琐碎的工作。

notes

notes 记录了我答题过程中,对知识点的总结。

kit

针对 LeetCode 中经常出现的以下数据结构,在 kit 中进行了定义,并添加了与 []int 相互转换的函数。利用 Go 1.9 添加的 type alias 功能,易于添加单元测试。

About

🎓 Go Solution for LeetCode algorithm problems, 100% coverage, continually updating.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%