|
1 | 1 | # [LeetCode](https://leetcode.com) 的 Go 解答
|
2 | 2 |
|
3 | 3 | [](https://leetcode.com/aQuaYi/)
|
4 |
| -[](https://leetcode.com/aQuaYi/) |
5 |
| -[](https://leetcode.com/aQuaYi/) |
| 4 | +[](https://leetcode.com/aQuaYi/) |
| 5 | +[](https://leetcode.com/aQuaYi/) |
6 | 6 | [](https://codecov.io/gh/aQuaYi/LeetCode-in-Go)
|
7 | 7 | [](https://www.travis-ci.org/aQuaYi/LeetCode-in-Go)
|
8 | 8 |
|
|
12 | 12 |
|
13 | 13 | | |Easy|Medium|Hard|Total|
|
14 | 14 | |:---:|:---:|:---:|:---:|:---:|
|
15 |
| -|**Accepted**|159|264|112|535| |
| 15 | +|**Accepted**|160|264|112|536| |
16 | 16 | |**Total**|162|277|119|558|
|
17 | 17 |
|
18 | 18 | ## 题解
|
|
97 | 97 | |76|[Minimum Window Substring](./Algorithms/0076.minimum-window-substring)|26%|Hard|[❤](https://leetcode.com/list/oussv5j)|
|
98 | 98 | |77|[Combinations](./Algorithms/0077.combinations)|41%|Medium| |
|
99 | 99 | |78|[Subsets](./Algorithms/0078.subsets)|44%|Medium|[❤](https://leetcode.com/list/oussv5j)|
|
100 |
| -|79|[Word Search](./Algorithms/0079.word-search)|27%|Medium| | |
| 100 | +|79|[Word Search](./Algorithms/0079.word-search)|28%|Medium| | |
101 | 101 | |80|[Remove Duplicates from Sorted Array II](./Algorithms/0080.remove-duplicates-from-sorted-array-ii)|36%|Medium|[❤](https://leetcode.com/list/oussv5j)|
|
102 | 102 | |81|[Search in Rotated Sorted Array II](./Algorithms/0081.search-in-rotated-sorted-array-ii)|32%|Medium| |
|
103 | 103 | |82|[Remove Duplicates from Sorted List II](./Algorithms/0082.remove-duplicates-from-sorted-list-ii)|29%|Medium|[❤](https://leetcode.com/list/oussv5j)|
|
|
192 | 192 | |206|[Reverse Linked List](./Algorithms/0206.reverse-linked-list)|46%|Easy| |
|
193 | 193 | |207|[Course Schedule](./Algorithms/0207.course-schedule)|33%|Medium|[❤](https://leetcode.com/list/oussv5j)|
|
194 | 194 | |208|[Implement Trie (Prefix Tree)](./Algorithms/0208.implement-trie-prefix-tree)|30%|Medium|[❤](https://leetcode.com/list/oussv5j)|
|
195 |
| -|209|[Minimum Size Subarray Sum](./Algorithms/0209.minimum-size-subarray-sum)|31%|Medium| | |
196 |
| -|210|[Course Schedule II](./Algorithms/0210.course-schedule-ii)|29%|Medium| | |
| 195 | +|209|[Minimum Size Subarray Sum](./Algorithms/0209.minimum-size-subarray-sum)|32%|Medium| | |
| 196 | +|210|[Course Schedule II](./Algorithms/0210.course-schedule-ii)|30%|Medium| | |
197 | 197 | |211|[Add and Search Word - Data structure design](./Algorithms/0211.add-and-search-word-data-structure-design)|25%|Medium|[❤](https://leetcode.com/list/oussv5j)|
|
198 | 198 | |212|[Word Search II](./Algorithms/0212.word-search-ii)|24%|Hard|[❤](https://leetcode.com/list/oussv5j)|
|
199 | 199 | |213|[House Robber II](./Algorithms/0213.house-robber-ii)|34%|Medium| |
|
|
214 | 214 | |229|[Majority Element II](./Algorithms/0229.majority-element-ii)|29%|Medium|[❤](https://leetcode.com/list/oussv5j)|
|
215 | 215 | |230|[Kth Smallest Element in a BST](./Algorithms/0230.kth-smallest-element-in-a-bst)|45%|Medium| |
|
216 | 216 | |231|[Power of Two](./Algorithms/0231.power-of-two)|40%|Easy| |
|
217 |
| -|232|[Implement Queue using Stacks](./Algorithms/0232.implement-queue-using-stacks)|37%|Easy| | |
| 217 | +|232|[Implement Queue using Stacks](./Algorithms/0232.implement-queue-using-stacks)|38%|Easy| | |
218 | 218 | |233|[Number of Digit One](./Algorithms/0233.number-of-digit-one)|28%|Hard|[❤](https://leetcode.com/list/oussv5j)|
|
219 | 219 | |234|[Palindrome Linked List](./Algorithms/0234.palindrome-linked-list)|33%|Easy| |
|
220 | 220 | |238|[Product of Array Except Self](./Algorithms/0238.product-of-array-except-self)|50%|Medium| |
|
|
224 | 224 | |242|[Valid Anagram](./Algorithms/0242.valid-anagram)|47%|Easy| |
|
225 | 225 | |257|[Binary Tree Paths](./Algorithms/0257.binary-tree-paths)|40%|Easy| |
|
226 | 226 | |258|[Add Digits](./Algorithms/0258.add-digits)|51%|Easy| |
|
227 |
| -|260|[Single Number III](./Algorithms/0260.single-number-iii)|52%|Medium|[❤](https://leetcode.com/list/oussv5j)| |
| 227 | +|260|[Single Number III](./Algorithms/0260.single-number-iii)|53%|Medium|[❤](https://leetcode.com/list/oussv5j)| |
228 | 228 | |263|[Ugly Number](./Algorithms/0263.ugly-number)|39%|Easy| |
|
229 | 229 | |264|[Ugly Number II](./Algorithms/0264.ugly-number-ii)|33%|Medium|[❤](https://leetcode.com/list/oussv5j)|
|
230 | 230 | |268|[Missing Number](./Algorithms/0268.missing-number)|44%|Easy| |
|
|
243 | 243 | |300|[Longest Increasing Subsequence](./Algorithms/0300.longest-increasing-subsequence)|38%|Medium|[❤](https://leetcode.com/list/oussv5j)|
|
244 | 244 | |301|[Remove Invalid Parentheses](./Algorithms/0301.remove-invalid-parentheses)|35%|Hard|[❤](https://leetcode.com/list/oussv5j)|
|
245 | 245 | |303|[Range Sum Query - Immutable](./Algorithms/0303.range-sum-query-immutable)|31%|Easy| |
|
246 |
| -|304|[Range Sum Query 2D - Immutable](./Algorithms/0304.range-sum-query-2d-immutable)|26%|Medium| | |
| 246 | +|304|[Range Sum Query 2D - Immutable](./Algorithms/0304.range-sum-query-2d-immutable)|27%|Medium| | |
247 | 247 | |306|[Additive Number](./Algorithms/0306.additive-number)|27%|Medium| |
|
248 | 248 | |307|[Range Sum Query - Mutable](./Algorithms/0307.range-sum-query-mutable)|22%|Medium| |
|
249 | 249 | |309|[Best Time to Buy and Sell Stock with Cooldown](./Algorithms/0309.best-time-to-buy-and-sell-stock-with-cooldown)|41%|Medium|[❤](https://leetcode.com/list/oussv5j)|
|
250 | 250 | |310|[Minimum Height Trees](./Algorithms/0310.minimum-height-trees)|28%|Medium| |
|
251 | 251 | |312|[Burst Balloons](./Algorithms/0312.burst-balloons)|43%|Hard|[❤](https://leetcode.com/list/oussv5j)|
|
252 | 252 | |313|[Super Ugly Number](./Algorithms/0313.super-ugly-number)|38%|Medium|[❤](https://leetcode.com/list/oussv5j)|
|
253 |
| -|315|[Count of Smaller Numbers After Self](./Algorithms/0315.count-of-smaller-numbers-after-self)|34%|Hard|[❤](https://leetcode.com/list/oussv5j)| |
| 253 | +|315|[Count of Smaller Numbers After Self](./Algorithms/0315.count-of-smaller-numbers-after-self)|35%|Hard|[❤](https://leetcode.com/list/oussv5j)| |
254 | 254 | |316|[Remove Duplicate Letters](./Algorithms/0316.remove-duplicate-letters)|30%|Hard|[❤](https://leetcode.com/list/oussv5j)|
|
255 | 255 | |318|[Maximum Product of Word Lengths](./Algorithms/0318.maximum-product-of-word-lengths)|45%|Medium|[❤](https://leetcode.com/list/oussv5j)|
|
256 | 256 | |319|[Bulb Switcher](./Algorithms/0319.bulb-switcher)|42%|Medium|[❤](https://leetcode.com/list/oussv5j)|
|
|
348 | 348 | |450|[Delete Node in a BST](./Algorithms/0450.delete-node-in-a-bst)|37%|Medium|[❤](https://leetcode.com/list/oussv5j)|
|
349 | 349 | |451|[Sort Characters By Frequency](./Algorithms/0451.sort-characters-by-frequency)|51%|Medium| |
|
350 | 350 | |452|[Minimum Number of Arrows to Burst Balloons](./Algorithms/0452.minimum-number-of-arrows-to-burst-balloons)|44%|Medium| |
|
351 |
| -|453|[Minimum Moves to Equal Array Elements](./Algorithms/0453.minimum-moves-to-equal-array-elements)|47%|Easy| | |
| 351 | +|453|[Minimum Moves to Equal Array Elements](./Algorithms/0453.minimum-moves-to-equal-array-elements)|48%|Easy| | |
352 | 352 | |454|[4Sum II](./Algorithms/0454.4sum-ii)|47%|Medium| |
|
353 | 353 | |455|[Assign Cookies](./Algorithms/0455.assign-cookies)|47%|Easy| |
|
354 | 354 | |456|[132 Pattern](./Algorithms/0456.132-pattern)|28%|Medium|[❤](https://leetcode.com/list/oussv5j)|
|
|
386 | 386 | |501|[Find Mode in Binary Search Tree](./Algorithms/0501.find-mode-in-binary-search-tree)|37%|Easy|[❤](https://leetcode.com/list/oussv5j)|
|
387 | 387 | |502|[IPO](./Algorithms/0502.ipo)|36%|Hard| |
|
388 | 388 | |503|[Next Greater Element II](./Algorithms/0503.next-greater-element-ii)|48%|Medium|[❤](https://leetcode.com/list/oussv5j)|
|
389 |
| -|504|[Base 7](./Algorithms/0504.base-7)|43%|Easy| | |
| 389 | +|504|[Base 7](./Algorithms/0504.base-7)|44%|Easy| | |
390 | 390 | |506|[Relative Ranks](./Algorithms/0506.relative-ranks)|46%|Easy| |
|
391 | 391 | |507|[Perfect Number](./Algorithms/0507.perfect-number)|32%|Easy| |
|
392 | 392 | |508|[Most Frequent Subtree Sum](./Algorithms/0508.most-frequent-subtree-sum)|52%|Medium| |
|
|
418 | 418 | |552|[Student Attendance Record II](./Algorithms/0552.student-attendance-record-ii)|31%|Hard|[❤](https://leetcode.com/list/oussv5j)|
|
419 | 419 | |553|[Optimal Division](./Algorithms/0553.optimal-division)|55%|Medium| |
|
420 | 420 | |554|[Brick Wall](./Algorithms/0554.brick-wall)|46%|Medium| |
|
421 |
| -|556|[Next Greater Element III](./Algorithms/0556.next-greater-element-iii)|29%|Medium| | |
| 421 | +|556|[Next Greater Element III](./Algorithms/0556.next-greater-element-iii)|28%|Medium| | |
422 | 422 | |557|[Reverse Words in a String III](./Algorithms/0557.reverse-words-in-a-string-iii)|60%|Easy| |
|
423 | 423 | |560|[Subarray Sum Equals K](./Algorithms/0560.subarray-sum-equals-k)|40%|Medium|[❤](https://leetcode.com/list/oussv5j)|
|
424 | 424 | |561|[Array Partition I](./Algorithms/0561.array-partition-i)|66%|Easy| |
|
|
428 | 428 | |566|[Reshape the Matrix](./Algorithms/0566.reshape-the-matrix)|57%|Easy| |
|
429 | 429 | |567|[Permutation in String](./Algorithms/0567.permutation-in-string)|36%|Medium| |
|
430 | 430 | |572|[Subtree of Another Tree](./Algorithms/0572.subtree-of-another-tree)|40%|Easy|[❤](https://leetcode.com/list/oussv5j)|
|
431 |
| -|575|[Distribute Candies](./Algorithms/0575.distribute-candies)|58%|Easy| | |
| 431 | +|575|[Distribute Candies](./Algorithms/0575.distribute-candies)|57%|Easy| | |
432 | 432 | |576|[Out of Boundary Paths](./Algorithms/0576.out-of-boundary-paths)|30%|Medium|[❤](https://leetcode.com/list/oussv5j)|
|
433 | 433 | |581|[Shortest Unsorted Continuous Subarray](./Algorithms/0581.shortest-unsorted-continuous-subarray)|29%|Easy|[❤](https://leetcode.com/list/oussv5j)|
|
434 | 434 | |583|[Delete Operation for Two Strings](./Algorithms/0583.delete-operation-for-two-strings)|44%|Medium|[❤](https://leetcode.com/list/oussv5j)|
|
|
448 | 448 | |621|[Task Scheduler](./Algorithms/0621.task-scheduler)|42%|Medium|[❤](https://leetcode.com/list/oussv5j)|
|
449 | 449 | |623|[Add One Row to Tree](./Algorithms/0623.add-one-row-to-tree)|46%|Medium| |
|
450 | 450 | |628|[Maximum Product of Three Numbers](./Algorithms/0628.maximum-product-of-three-numbers)|44%|Easy|[❤](https://leetcode.com/list/oussv5j)|
|
451 |
| -|629|[K Inverse Pairs Array](./Algorithms/0629.k-inverse-pairs-array)|26%|Hard| | |
| 451 | +|629|[K Inverse Pairs Array](./Algorithms/0629.k-inverse-pairs-array)|27%|Hard| | |
452 | 452 | |630|[Course Schedule III](./Algorithms/0630.course-schedule-iii)|29%|Hard|[❤](https://leetcode.com/list/oussv5j)|
|
453 | 453 | |632|[Smallest Range](./Algorithms/0632.smallest-range)|42%|Hard| |
|
454 | 454 | |633|[Sum of Square Numbers](./Algorithms/0633.sum-of-square-numbers)|32%|Easy| |
|
|
509 | 509 | |714|[Best Time to Buy and Sell Stock with Transaction Fee](./Algorithms/0714.best-time-to-buy-and-sell-stock-with-transaction-fee)|45%|Medium|[❤](https://leetcode.com/list/oussv5j)|
|
510 | 510 | |715|[Range Module](./Algorithms/0715.range-module)|31%|Hard| |
|
511 | 511 | |717|[1-bit and 2-bit Characters](./Algorithms/0717.1-bit-and-2-bit-characters)|49%|Easy| |
|
512 |
| -|718|[Maximum Length of Repeated Subarray](./Algorithms/0718.maximum-length-of-repeated-subarray)|40%|Medium|[❤](https://leetcode.com/list/oussv5j)| |
| 512 | +|718|[Maximum Length of Repeated Subarray](./Algorithms/0718.maximum-length-of-repeated-subarray)|41%|Medium|[❤](https://leetcode.com/list/oussv5j)| |
513 | 513 | |719|[Find K-th Smallest Pair Distance](./Algorithms/0719.find-k-th-smallest-pair-distance)|27%|Hard|[❤](https://leetcode.com/list/oussv5j)|
|
514 | 514 | |720|[Longest Word in Dictionary](./Algorithms/0720.longest-word-in-dictionary)|41%|Easy| |
|
515 | 515 | |721|[Accounts Merge](./Algorithms/0721.accounts-merge)|32%|Medium|[❤](https://leetcode.com/list/oussv5j)|
|
|
521 | 521 | |729|[My Calendar I](./Algorithms/0729.my-calendar-i)|42%|Medium| |
|
522 | 522 | |730|[Count Different Palindromic Subsequences](./Algorithms/0730.count-different-palindromic-subsequences)|35%|Hard|[❤](https://leetcode.com/list/oussv5j)|
|
523 | 523 | |731|[My Calendar II](./Algorithms/0731.my-calendar-ii)|37%|Medium|[❤](https://leetcode.com/list/oussv5j)|
|
524 |
| -|732|[My Calendar III](./Algorithms/0732.my-calendar-iii)|51%|Hard| | |
| 524 | +|732|[My Calendar III](./Algorithms/0732.my-calendar-iii)|50%|Hard| | |
525 | 525 | |733|[Flood Fill](./Algorithms/0733.flood-fill)|47%|Easy| |
|
526 | 526 | |735|[Asteroid Collision](./Algorithms/0735.asteroid-collision)|37%|Medium| |
|
527 | 527 | |736|[Parse Lisp Expression](./Algorithms/0736.parse-lisp-expression)|43%|Hard|[❤](https://leetcode.com/list/oussv5j)|
|
|
554 | 554 | |771|[Jewels and Stones](./Algorithms/0771.jewels-and-stones)|82%|Easy| |
|
555 | 555 | |773| * Sliding Puzzle|47%|Hard| |
|
556 | 556 | |775| * Global and Local Inversions|30%|Medium| |
|
557 |
| -|777| * Swap Adjacent in LR String|25%|Medium| | |
558 |
| -|778| * Swim in Rising Water|44%|Hard| | |
| 557 | +|777| * Swap Adjacent in LR String|26%|Medium| | |
| 558 | +|778| * Swim in Rising Water|43%|Hard| | |
559 | 559 | |779| * K-th Symbol in Grammar|35%|Medium| |
|
560 | 560 | |780| * Reaching Points|20%|Hard| |
|
561 | 561 | |781| * Rabbits in Forest|48%|Medium| |
|
562 | 562 | |782| * Transform to Chessboard|34%|Hard| |
|
563 |
| -|783| * Minimum Distance Between BST Nodes|46%|Easy| | |
| 563 | +|783|[Minimum Distance Between BST Nodes](./Algorithms/0783.minimum-distance-between-bst-nodes)|47%|Easy| | |
564 | 564 | |784| * Letter Case Permutation|51%|Easy| |
|
565 | 565 | |785| * Is Graph Bipartite?|38%|Medium| |
|
566 | 566 | |786| * K-th Smallest Prime Fraction|28%|Hard| |
|
567 | 567 | |787| * Cheapest Flights Within K Stops|31%|Medium| |
|
568 | 568 | |788| * Rotated Digits|50%|Easy| |
|
569 | 569 | |789| * Escape The Ghosts|44%|Medium| |
|
570 | 570 | |790| * Domino and Tromino Tiling|31%|Medium| |
|
571 |
| -|791| * Custom Sort String|62%|Medium| | |
| 571 | +|791| * Custom Sort String|61%|Medium| | |
572 | 572 | |792| * Number of Matching Subsequences|33%|Medium| |
|
573 |
| -|793| * Preimage Size of Factorial Zeroes Function|41%|Hard| | |
| 573 | +|793| * Preimage Size of Factorial Zeroes Function|48%|Hard| | |
574 | 574 | |794| * Valid Tic-Tac-Toe State|26%|Medium| |
|
575 | 575 | |795| * Number of Subarrays with Bounded Maximum|38%|Medium| |
|
576 |
| -|796| * Rotate String|69%|Easy| | |
577 |
| -|797| * All Paths From Source to Target|70%|Medium| | |
578 |
| -|798| * Smallest Rotation with Highest Score|23%|Hard| | |
579 |
| -|799| * Champagne Tower|26%|Medium| | |
| 576 | +|796| * Rotate String|67%|Easy| | |
| 577 | +|797| * All Paths From Source to Target|68%|Medium| | |
| 578 | +|798| * Smallest Rotation with Highest Score|26%|Hard| | |
| 579 | +|799| * Champagne Tower|27%|Medium| | |
580 | 580 |
|
581 | 581 | 以下免费的算法题,暂时不能使用 Go 解答
|
582 | 582 |
|
|
0 commit comments