Add solution 0097、0523、0525、1465、1744

This commit is contained in:
YDZ
2021-06-04 16:22:35 +08:00
parent c0191c235d
commit cc78fdd0ef
42 changed files with 1447 additions and 173 deletions

256
README.md
View File

@ -126,16 +126,16 @@
| | Easy | Medium | Hard | Total |
|:--------:|:--------:|:--------:|:--------:|:--------:|
|Optimizing|35|35|21|91|
|Accepted|**285**|**380**|**111**|**776**|
|Optimizing|35|32|21|88|
|Accepted|**285**|**382**|**111**|**778**|
|Total|495|995|395|1885|
|Perfection Rate|87.7%|90.8%|81.1%|88.3%|
|Completion Rate|57.6%|38.2%|28.1%|41.2%|
|Perfection Rate|87.7%|91.6%|81.1%|88.7%|
|Completion Rate|57.6%|38.4%|28.1%|41.3%|
|------------|----------------------------|----------------------------|----------------------------|----------------------------|
## 二. 目录
以下已经收录了 685 道题的题解,还有 11 道题在尝试优化到 beats 100%
以下已经收录了 690 道题的题解,还有 11 道题在尝试优化到 beats 100%
| No. | Title | Solution | Acceptance | Difficulty | Frequency |
|:--------:|:--------------------------------------------------------------|:--------:|:--------:|:--------:|:--------:|
@ -216,7 +216,7 @@
|0075|Sort Colors|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0075.Sort-Colors)|50.4%|Medium||
|0076|Minimum Window Substring|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0076.Minimum-Window-Substring)|36.5%|Hard||
|0077|Combinations|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0077.Combinations)|58.7%|Medium||
|0078|Subsets|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0078.Subsets)|66.3%|Medium||
|0078|Subsets|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0078.Subsets)|66.4%|Medium||
|0079|Word Search|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0079.Word-Search)|37.6%|Medium||
|0080|Remove Duplicates from Sorted Array II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0080.Remove-Duplicates-from-Sorted-Array-II)|46.7%|Medium||
|0081|Search in Rotated Sorted Array II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0081.Search-in-Rotated-Sorted-Array-II)|33.8%|Medium||
@ -235,7 +235,7 @@
|0094|Binary Tree Inorder Traversal|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0094.Binary-Tree-Inorder-Traversal)|66.9%|Easy||
|0095|Unique Binary Search Trees II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0095.Unique-Binary-Search-Trees-II)|43.6%|Medium||
|0096|Unique Binary Search Trees|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0096.Unique-Binary-Search-Trees)|55.0%|Medium||
|0097|Interleaving String||33.7%|Medium||
|0097|Interleaving String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0097.Interleaving-String)|33.7%|Medium||
|0098|Validate Binary Search Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0098.Validate-Binary-Search-Tree)|29.1%|Medium||
|0099|Recover Binary Search Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0099.Recover-Binary-Search-Tree)|43.2%|Medium||
|0100|Same Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0100.Same-Tree)|54.4%|Easy||
@ -259,7 +259,7 @@
|0118|Pascal's Triangle|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0118.Pascal's-Triangle)|56.3%|Easy||
|0119|Pascal's Triangle II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0119.Pascal's-Triangle-II)|53.0%|Easy||
|0120|Triangle|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0120.Triangle)|47.2%|Medium||
|0121|Best Time to Buy and Sell Stock|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0121.Best-Time-to-Buy-and-Sell-Stock)|52.0%|Easy||
|0121|Best Time to Buy and Sell Stock|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0121.Best-Time-to-Buy-and-Sell-Stock)|52.1%|Easy||
|0122|Best Time to Buy and Sell Stock II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0122.Best-Time-to-Buy-and-Sell-Stock-II)|59.2%|Easy||
|0123|Best Time to Buy and Sell Stock III||40.5%|Hard||
|0124|Binary Tree Maximum Path Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0124.Binary-Tree-Maximum-Path-Sum)|35.9%|Hard||
@ -370,7 +370,7 @@
|0229|Majority Element II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0229.Majority-Element-II)|39.4%|Medium||
|0230|Kth Smallest Element in a BST|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0230.Kth-Smallest-Element-in-a-BST)|63.5%|Medium||
|0231|Power of Two|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0231.Power-of-Two)|43.8%|Easy||
|0232|Implement Queue using Stacks|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0232.Implement-Queue-using-Stacks)|53.2%|Easy||
|0232|Implement Queue using Stacks|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0232.Implement-Queue-using-Stacks)|53.3%|Easy||
|0233|Number of Digit One||32.0%|Hard||
|0234|Palindrome Linked List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0234.Palindrome-Linked-List)|42.8%|Easy||
|0235|Lowest Common Ancestor of a Binary Search Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0235.Lowest-Common-Ancestor-of-a-Binary-Search-Tree)|52.6%|Easy||
@ -415,7 +415,7 @@
|0274|H-Index|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0274.H-Index)|36.6%|Medium||
|0275|H-Index II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0275.H-Index-II)|36.5%|Medium||
|0276|Paint Fence||39.5%|Medium||
|0277|Find the Celebrity||44.4%|Medium||
|0277|Find the Celebrity||44.5%|Medium||
|0278|First Bad Version||38.2%|Easy||
|0279|Perfect Squares||49.6%|Medium||
|0280|Wiggle Sort||65.0%|Medium||
@ -479,7 +479,7 @@
|0338|Counting Bits|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0338.Counting-Bits)|70.9%|Easy||
|0339|Nested List Weight Sum||77.3%|Medium||
|0340|Longest Substring with At Most K Distinct Characters||46.0%|Medium||
|0341|Flatten Nested List Iterator|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0341.Flatten-Nested-List-Iterator)|56.2%|Medium||
|0341|Flatten Nested List Iterator|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0341.Flatten-Nested-List-Iterator)|56.3%|Medium||
|0342|Power of Four|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0342.Power-of-Four)|42.0%|Easy||
|0343|Integer Break|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0343.Integer-Break)|51.5%|Medium||
|0344|Reverse String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0344.Reverse-String)|71.1%|Easy||
@ -525,7 +525,7 @@
|0384|Shuffle an Array||54.3%|Medium||
|0385|Mini Parser|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0385.Mini-Parser)|34.8%|Medium||
|0386|Lexicographical Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0386.Lexicographical-Numbers)|55.2%|Medium||
|0387|First Unique Character in a String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0387.First-Unique-Character-in-a-String)|54.3%|Easy||
|0387|First Unique Character in a String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0387.First-Unique-Character-in-a-String)|54.4%|Easy||
|0388|Longest Absolute File Path||43.5%|Medium||
|0389|Find the Difference|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0389.Find-the-Difference)|58.1%|Easy||
|0390|Elimination Game||45.5%|Medium||
@ -539,13 +539,13 @@
|0398|Random Pick Index||59.1%|Medium||
|0399|Evaluate Division|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0399.Evaluate-Division)|55.0%|Medium||
|0400|Nth Digit||32.6%|Medium||
|0401|Binary Watch|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0401.Binary-Watch)|48.8%|Easy||
|0401|Binary Watch|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0401.Binary-Watch)|48.9%|Easy||
|0402|Remove K Digits|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0402.Remove-K-Digits)|28.7%|Medium||
|0403|Frog Jump||41.9%|Hard||
|0404|Sum of Left Leaves|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0404.Sum-of-Left-Leaves)|52.5%|Easy||
|0405|Convert a Number to Hexadecimal|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0405.Convert-a-Number-to-Hexadecimal)|44.8%|Easy||
|0406|Queue Reconstruction by Height||68.8%|Medium||
|0407|Trapping Rain Water II||44.8%|Hard||
|0407|Trapping Rain Water II||44.9%|Hard||
|0408|Valid Word Abbreviation||31.7%|Easy||
|0409|Longest Palindrome|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0409.Longest-Palindrome)|52.4%|Easy||
|0410|Split Array Largest Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0410.Split-Array-Largest-Sum)|47.1%|Hard||
@ -559,7 +559,7 @@
|0418|Sentence Screen Fitting||33.9%|Medium||
|0419|Battleships in a Board||71.6%|Medium||
|0420|Strong Password Checker||13.7%|Hard||
|0421|Maximum XOR of Two Numbers in an Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0421.Maximum-XOR-of-Two-Numbers-in-an-Array)|54.6%|Medium||
|0421|Maximum XOR of Two Numbers in an Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0421.Maximum-XOR-of-Two-Numbers-in-an-Array)|54.7%|Medium||
|0422|Valid Word Square||38.3%|Easy||
|0423|Reconstruct Original Digits from English|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0423.Reconstruct-Original-Digits-from-English)|51.1%|Medium||
|0424|Longest Repeating Character Replacement|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0424.Longest-Repeating-Character-Replacement)|48.8%|Medium||
@ -588,7 +588,7 @@
|0447|Number of Boomerangs|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0447.Number-of-Boomerangs)|52.6%|Medium||
|0448|Find All Numbers Disappeared in an Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0448.Find-All-Numbers-Disappeared-in-an-Array)|56.4%|Easy||
|0449|Serialize and Deserialize BST||54.6%|Medium||
|0450|Delete Node in a BST||45.8%|Medium||
|0450|Delete Node in a BST||45.9%|Medium||
|0451|Sort Characters By Frequency|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0451.Sort-Characters-By-Frequency)|65.0%|Medium||
|0452|Minimum Number of Arrows to Burst Balloons||50.0%|Medium||
|0453|Minimum Moves to Equal Array Elements|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0453.Minimum-Moves-to-Equal-Array-Elements)|51.5%|Easy||
@ -661,9 +661,9 @@
|0520|Detect Capital||54.2%|Easy||
|0521|Longest Uncommon Subsequence I||59.2%|Easy||
|0522|Longest Uncommon Subsequence II||34.3%|Medium||
|0523|Continuous Subarray Sum||25.2%|Medium||
|0523|Continuous Subarray Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0523.Continuous-Subarray-Sum)|25.2%|Medium||
|0524|Longest Word in Dictionary through Deleting|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0524.Longest-Word-in-Dictionary-through-Deleting)|50.2%|Medium||
|0525|Contiguous Array||43.8%|Medium||
|0525|Contiguous Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0525.Contiguous-Array)|43.8%|Medium||
|0526|Beautiful Arrangement|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0526.Beautiful-Arrangement)|62.3%|Medium||
|0527|Word Abbreviation||56.7%|Hard||
|0528|Random Pick with Weight|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0528.Random-Pick-with-Weight)|44.9%|Medium||
@ -745,7 +745,7 @@
|0604|Design Compressed String Iterator||38.4%|Easy||
|0605|Can Place Flowers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0605.Can-Place-Flowers)|31.6%|Easy||
|0606|Construct String from Binary Tree||56.0%|Easy||
|0607|Sales Person||66.0%|Easy||
|0607|Sales Person||65.9%|Easy||
|0608|Tree Node||70.3%|Medium||
|0609|Find Duplicate File in System|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0609.Find-Duplicate-File-in-System)|63.0%|Medium||
|0610|Triangle Judgement||69.4%|Easy||
@ -753,8 +753,8 @@
|0612|Shortest Distance in a Plane||61.9%|Medium||
|0613|Shortest Distance in a Line||80.2%|Easy||
|0614|Second Degree Follower||33.2%|Medium||
|0615|Average Salary: Departments VS Company||53.8%|Hard||
|0616|Add Bold Tag in String||45.1%|Medium||
|0615|Average Salary: Departments VS Company||53.7%|Hard||
|0616|Add Bold Tag in String||45.2%|Medium||
|0617|Merge Two Binary Trees||75.8%|Easy||
|0618|Students Report By Geography||61.2%|Hard||
|0619|Biggest Single Number||45.6%|Easy||
@ -767,7 +767,7 @@
|0626|Exchange Seats||66.8%|Medium||
|0627|Swap Salary||78.6%|Easy||
|0628|Maximum Product of Three Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0628.Maximum-Product-of-Three-Numbers)|46.7%|Easy||
|0629|K Inverse Pairs Array||31.8%|Hard||
|0629|K Inverse Pairs Array||31.9%|Hard||
|0630|Course Schedule III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0630.Course-Schedule-III)|34.8%|Hard||
|0631|Design Excel Sum Formula||32.9%|Hard||
|0632|Smallest Range Covering Elements from K Lists|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0632.Smallest-Range-Covering-Elements-from-K-Lists)|55.0%|Hard||
@ -801,7 +801,7 @@
|0660|Remove 9||54.5%|Hard||
|0661|Image Smoother|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0661.Image-Smoother)|52.5%|Easy||
|0662|Maximum Width of Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0662.Maximum-Width-of-Binary-Tree)|39.6%|Medium||
|0663|Equal Tree Partition||39.8%|Medium||
|0663|Equal Tree Partition||39.9%|Medium||
|0664|Strange Printer||42.2%|Hard||
|0665|Non-decreasing Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0665.Non-decreasing-Array)|20.8%|Medium||
|0666|Path Sum IV||57.3%|Medium||
@ -850,7 +850,7 @@
|0709|To Lower Case|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0709.To-Lower-Case)|80.6%|Easy||
|0710|Random Pick with Blacklist|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0710.Random-Pick-with-Blacklist)|33.2%|Hard||
|0711|Number of Distinct Islands II||50.0%|Hard||
|0712|Minimum ASCII Delete Sum for Two Strings||59.8%|Medium||
|0712|Minimum ASCII Delete Sum for Two Strings||59.9%|Medium||
|0713|Subarray Product Less Than K|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0713.Subarray-Product-Less-Than-K)|40.7%|Medium||
|0714|Best Time to Buy and Sell Stock with Transaction Fee|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0714.Best-Time-to-Buy-and-Sell-Stock-with-Transaction-Fee)|58.4%|Medium||
|0715|Range Module|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0715.Range-Module)|41.4%|Hard||
@ -861,7 +861,7 @@
|0720|Longest Word in Dictionary|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0720.Longest-Word-in-Dictionary)|49.7%|Easy||
|0721|Accounts Merge|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0721.Accounts-Merge)|52.9%|Medium||
|0722|Remove Comments||36.7%|Medium||
|0723|Candy Crush||73.4%|Medium||
|0723|Candy Crush||73.5%|Medium||
|0724|Find Pivot Index|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0724.Find-Pivot-Index)|46.9%|Easy||
|0725|Split Linked List in Parts|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0725.Split-Linked-List-in-Parts)|53.4%|Medium||
|0726|Number of Atoms|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0726.Number-of-Atoms)|51.1%|Hard||
@ -889,8 +889,8 @@
|0748|Shortest Completing Word|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0748.Shortest-Completing-Word)|57.8%|Easy||
|0749|Contain Virus||48.8%|Hard||
|0750|Number Of Corner Rectangles||67.2%|Medium||
|0751|IP to CIDR||58.5%|Medium||
|0752|Open the Lock||53.2%|Medium||
|0751|IP to CIDR||58.4%|Medium||
|0752|Open the Lock||53.3%|Medium||
|0753|Cracking the Safe|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0753.Cracking-the-Safe)|52.8%|Hard||
|0754|Reach a Number||40.6%|Medium||
|0755|Pour Water||44.4%|Medium||
@ -905,7 +905,7 @@
|0764|Largest Plus Sign||46.9%|Medium||
|0765|Couples Holding Hands|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0765.Couples-Holding-Hands)|55.7%|Hard||
|0766|Toeplitz Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0766.Toeplitz-Matrix)|66.0%|Easy||
|0767|Reorganize String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0767.Reorganize-String)|50.5%|Medium||
|0767|Reorganize String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0767.Reorganize-String)|50.6%|Medium||
|0768|Max Chunks To Make Sorted II||50.2%|Hard||
|0769|Max Chunks To Make Sorted||56.1%|Medium||
|0770|Basic Calculator IV||54.3%|Hard||
@ -980,7 +980,7 @@
|0839|Similar String Groups|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0839.Similar-String-Groups)|42.4%|Hard||
|0840|Magic Squares In Grid||37.9%|Medium||
|0841|Keys and Rooms|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0841.Keys-and-Rooms)|66.7%|Medium||
|0842|Split Array into Fibonacci Sequence|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0842.Split-Array-into-Fibonacci-Sequence)|37.0%|Medium||
|0842|Split Array into Fibonacci Sequence|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0842.Split-Array-into-Fibonacci-Sequence)|37.1%|Medium||
|0843|Guess the Word||46.0%|Hard||
|0844|Backspace String Compare|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0844.Backspace-String-Compare)|47.2%|Easy||
|0845|Longest Mountain in Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0845.Longest-Mountain-in-Array)|38.8%|Medium||
@ -997,12 +997,12 @@
|0856|Score of Parentheses|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0856.Score-of-Parentheses)|65.0%|Medium||
|0857|Minimum Cost to Hire K Workers||50.7%|Hard||
|0858|Mirror Reflection||59.5%|Medium||
|0859|Buddy Strings||28.8%|Easy||
|0859|Buddy Strings||28.9%|Easy||
|0860|Lemonade Change||51.9%|Easy||
|0861|Score After Flipping Matrix||73.9%|Medium||
|0862|Shortest Subarray with Sum at Least K|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0862.Shortest-Subarray-with-Sum-at-Least-K)|25.4%|Hard||
|0863|All Nodes Distance K in Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0863.All-Nodes-Distance-K-in-Binary-Tree)|58.5%|Medium||
|0864|Shortest Path to Get All Keys|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0864.Shortest-Path-to-Get-All-Keys)|42.8%|Hard||
|0864|Shortest Path to Get All Keys|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0864.Shortest-Path-to-Get-All-Keys)|42.9%|Hard||
|0865|Smallest Subtree with all the Deepest Nodes||65.5%|Medium||
|0866|Prime Palindrome||25.0%|Medium||
|0867|Transpose Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0867.Transpose-Matrix)|61.9%|Easy||
@ -1027,7 +1027,7 @@
|0886|Possible Bipartition||45.6%|Medium||
|0887|Super Egg Drop|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0887.Super-Egg-Drop)|27.0%|Hard||
|0888|Fair Candy Swap|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0888.Fair-Candy-Swap)|59.3%|Easy||
|0889|Construct Binary Tree from Preorder and Postorder Traversal||68.1%|Medium||
|0889|Construct Binary Tree from Preorder and Postorder Traversal||68.2%|Medium||
|0890|Find and Replace Pattern|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0890.Find-and-Replace-Pattern)|75.5%|Medium||
|0891|Sum of Subsequence Widths|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0891.Sum-of-Subsequence-Widths)|33.3%|Hard||
|0892|Surface Area of 3D Shapes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0892.Surface-Area-of-3D-Shapes)|60.1%|Easy||
@ -1057,7 +1057,7 @@
|0916|Word Subsets|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0916.Word-Subsets)|52.7%|Medium||
|0917|Reverse Only Letters||59.4%|Easy||
|0918|Maximum Sum Circular Subarray|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0918.Maximum-Sum-Circular-Subarray)|34.5%|Medium||
|0919|Complete Binary Tree Inserter||59.6%|Medium||
|0919|Complete Binary Tree Inserter||59.5%|Medium||
|0920|Number of Music Playlists|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0920.Number-of-Music-Playlists)|48.4%|Hard||
|0921|Minimum Add to Make Parentheses Valid|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0921.Minimum-Add-to-Make-Parentheses-Valid)|75.3%|Medium||
|0922|Sort Array By Parity II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0922.Sort-Array-By-Parity-II)|70.7%|Easy||
@ -1097,7 +1097,7 @@
|0956|Tallest Billboard||39.9%|Hard||
|0957|Prison Cells After N Days||40.0%|Medium||
|0958|Check Completeness of a Binary Tree||52.6%|Medium||
|0959|Regions Cut By Slashes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0959.Regions-Cut-By-Slashes)|67.4%|Medium||
|0959|Regions Cut By Slashes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0959.Regions-Cut-By-Slashes)|67.5%|Medium||
|0960|Delete Columns to Make Sorted III||55.5%|Hard||
|0961|N-Repeated Element in Size 2N Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0961.N-Repeated-Element-in-Size-2N-Array)|74.8%|Easy||
|0962|Maximum Width Ramp||46.7%|Medium||
@ -1140,7 +1140,7 @@
|0999|Available Captures for Rook|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0999.Available-Captures-for-Rook)|67.7%|Easy||
|1000|Minimum Cost to Merge Stones||40.8%|Hard||
|1001|Grid Illumination||36.0%|Hard||
|1002|Find Common Characters|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1002.Find-Common-Characters)|68.7%|Easy||
|1002|Find Common Characters|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1002.Find-Common-Characters)|68.8%|Easy||
|1003|Check If Word Is Valid After Substitutions|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1003.Check-If-Word-Is-Valid-After-Substitutions)|56.9%|Medium||
|1004|Max Consecutive Ones III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1004.Max-Consecutive-Ones-III)|61.2%|Medium||
|1005|Maximize Sum Of Array After K Negations|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1005.Maximize-Sum-Of-Array-After-K-Negations)|52.3%|Easy||
@ -1155,7 +1155,7 @@
|1014|Best Sightseeing Pair||53.0%|Medium||
|1015|Smallest Integer Divisible by K||42.0%|Medium||
|1016|Binary String With Substrings Representing 1 To N||58.6%|Medium||
|1017|Convert to Base -2|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1017.Convert-to-Base--2)|59.4%|Medium||
|1017|Convert to Base -2|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1017.Convert-to-Base--2)|59.3%|Medium||
|1018|Binary Prefix Divisible By 5|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1018.Binary-Prefix-Divisible-By-5)|47.6%|Easy||
|1019|Next Greater Node In Linked List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1019.Next-Greater-Node-In-Linked-List)|58.3%|Medium||
|1020|Number of Enclaves|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1020.Number-of-Enclaves)|59.5%|Medium||
@ -1189,7 +1189,7 @@
|1048|Longest String Chain|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1048.Longest-String-Chain)|56.1%|Medium||
|1049|Last Stone Weight II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1049.Last-Stone-Weight-II)|46.9%|Medium||
|1050|Actors and Directors Who Cooperated At Least Three Times||72.3%|Easy||
|1051|Height Checker|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1051.Height-Checker)|72.8%|Easy||
|1051|Height Checker|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1051.Height-Checker)|72.9%|Easy||
|1052|Grumpy Bookstore Owner|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1052.Grumpy-Bookstore-Owner)|56.1%|Medium||
|1053|Previous Permutation With One Swap||51.6%|Medium||
|1054|Distant Barcodes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1054.Distant-Barcodes)|44.5%|Medium||
@ -1218,15 +1218,15 @@
|1077|Project Employees III||78.3%|Medium||
|1078|Occurrences After Bigram|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1078.Occurrences-After-Bigram)|64.9%|Easy||
|1079|Letter Tile Possibilities|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1079.Letter-Tile-Possibilities)|76.1%|Medium||
|1080|Insufficient Nodes in Root to Leaf Paths||50.3%|Medium||
|1080|Insufficient Nodes in Root to Leaf Paths||50.4%|Medium||
|1081|Smallest Subsequence of Distinct Characters||53.7%|Medium||
|1082|Sales Analysis I||74.3%|Easy||
|1083|Sales Analysis II||50.9%|Easy||
|1084|Sales Analysis III||54.6%|Easy||
|1084|Sales Analysis III||54.5%|Easy||
|1085|Sum of Digits in the Minimum Number||75.5%|Easy||
|1086|High Five||76.8%|Easy||
|1087|Brace Expansion||63.5%|Medium||
|1088|Confusing Number II||45.8%|Hard||
|1088|Confusing Number II||45.9%|Hard||
|1089|Duplicate Zeros|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1089.Duplicate-Zeros)|51.5%|Easy||
|1090|Largest Values From Labels||60.2%|Medium||
|1091|Shortest Path in Binary Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1091.Shortest-Path-in-Binary-Matrix)|40.5%|Medium||
@ -1240,7 +1240,7 @@
|1099|Two Sum Less Than K||60.8%|Easy||
|1100|Find K-Length Substrings With No Repeated Characters||73.2%|Medium||
|1101|The Earliest Moment When Everyone Become Friends||67.8%|Medium||
|1102|Path With Maximum Minimum Value||51.2%|Medium||
|1102|Path With Maximum Minimum Value||51.3%|Medium||
|1103|Distribute Candies to People||63.4%|Easy||
|1104|Path In Zigzag Labelled Binary Tree||73.7%|Medium||
|1105|Filling Bookcase Shelves|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1105.Filling-Bookcase-Shelves)|57.6%|Medium||
@ -1251,7 +1251,7 @@
|1110|Delete Nodes And Return Forest|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1110.Delete-Nodes-And-Return-Forest)|68.1%|Medium||
|1111|Maximum Nesting Depth of Two Valid Parentheses Strings|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1111.Maximum-Nesting-Depth-of-Two-Valid-Parentheses-Strings)|72.8%|Medium||
|1112|Highest Grade For Each Student||72.5%|Medium||
|1113|Reported Posts||66.2%|Easy||
|1113|Reported Posts||66.1%|Easy||
|1114|Print in Order||67.5%|Easy||
|1115|Print FooBar Alternately||59.0%|Medium||
|1116|Print Zero Even Odd||58.1%|Medium||
@ -1267,7 +1267,7 @@
|1126|Active Businesses||68.4%|Medium||
|1127|User Purchase Platform||50.7%|Hard||
|1128|Number of Equivalent Domino Pairs|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1128.Number-of-Equivalent-Domino-Pairs)|46.0%|Easy||
|1129|Shortest Path with Alternating Colors||40.5%|Medium||
|1129|Shortest Path with Alternating Colors||40.6%|Medium||
|1130|Minimum Cost Tree From Leaf Values||67.4%|Medium||
|1131|Maximum of Absolute Value Expression||51.4%|Medium||
|1132|Reported Posts II||34.4%|Medium||
@ -1297,24 +1297,24 @@
|1156|Swap For Longest Repeated Character Substring||47.0%|Medium||
|1157|Online Majority Element In Subarray|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1157.Online-Majority-Element-In-Subarray)|41.0%|Hard||
|1158|Market Analysis I||64.5%|Medium||
|1159|Market Analysis II||56.6%|Hard||
|1159|Market Analysis II||56.7%|Hard||
|1160|Find Words That Can Be Formed by Characters|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1160.Find-Words-That-Can-Be-Formed-by-Characters)|67.9%|Easy||
|1161|Maximum Level Sum of a Binary Tree||68.2%|Medium||
|1162|As Far from Land as Possible||45.9%|Medium||
|1163|Last Substring in Lexicographical Order||36.2%|Hard||
|1164|Product Price at a Given Date||68.9%|Medium||
|1164|Product Price at a Given Date||69.0%|Medium||
|1165|Single-Row Keyboard||85.4%|Easy||
|1166|Design File System||58.8%|Medium||
|1166|Design File System||58.7%|Medium||
|1167|Minimum Cost to Connect Sticks||65.2%|Medium||
|1168|Optimize Water Distribution in a Village||61.3%|Hard||
|1169|Invalid Transactions||30.7%|Medium||
|1169|Invalid Transactions||30.6%|Medium||
|1170|Compare Strings by Frequency of the Smallest Character|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1170.Compare-Strings-by-Frequency-of-the-Smallest-Character)|60.5%|Medium||
|1171|Remove Zero Sum Consecutive Nodes from Linked List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1171.Remove-Zero-Sum-Consecutive-Nodes-from-Linked-List)|41.5%|Medium||
|1172|Dinner Plate Stacks||37.1%|Hard||
|1173|Immediate Food Delivery I||83.0%|Easy||
|1174|Immediate Food Delivery II||62.5%|Medium||
|1175|Prime Arrangements|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1175.Prime-Arrangements)|51.8%|Easy||
|1176|Diet Plan Performance||53.8%|Easy||
|1176|Diet Plan Performance||53.7%|Easy||
|1177|Can Make Palindrome from Substring||36.1%|Medium||
|1178|Number of Valid Words for Each Puzzle|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1178.Number-of-Valid-Words-for-Each-Puzzle)|40.2%|Hard||
|1179|Reformat Department Table||82.1%|Easy||
@ -1324,9 +1324,9 @@
|1183|Maximum Number of Ones||58.3%|Hard||
|1184|Distance Between Bus Stops|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1184.Distance-Between-Bus-Stops)|53.8%|Easy||
|1185|Day of the Week|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1185.Day-of-the-Week)|60.7%|Easy||
|1186|Maximum Subarray Sum with One Deletion||39.4%|Medium||
|1187|Make Array Strictly Increasing||42.9%|Hard||
|1188|Design Bounded Blocking Queue||73.2%|Medium||
|1186|Maximum Subarray Sum with One Deletion||39.5%|Medium||
|1187|Make Array Strictly Increasing||43.0%|Hard||
|1188|Design Bounded Blocking Queue||73.3%|Medium||
|1189|Maximum Number of Balloons|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1189.Maximum-Number-of-Balloons)|62.2%|Easy||
|1190|Reverse Substrings Between Each Pair of Parentheses|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1190.Reverse-Substrings-Between-Each-Pair-of-Parentheses)|64.4%|Medium||
|1191|K-Concatenation Maximum Sum||24.8%|Medium||
@ -1363,7 +1363,7 @@
|1222|Queens That Can Attack the King||69.6%|Medium||
|1223|Dice Roll Simulation||47.0%|Hard||
|1224|Maximum Equal Frequency||35.8%|Hard||
|1225|Report Contiguous Dates||63.3%|Hard||
|1225|Report Contiguous Dates||63.2%|Hard||
|1226|The Dining Philosophers||60.5%|Medium||
|1227|Airplane Seat Assignment Probability||62.4%|Medium||
|1228|Missing Number In Arithmetic Progression||51.2%|Easy||
@ -1392,7 +1392,7 @@
|1251|Average Selling Price||83.1%|Easy||
|1252|Cells with Odd Values in a Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1252.Cells-with-Odd-Values-in-a-Matrix)|78.5%|Easy||
|1253|Reconstruct a 2-Row Binary Matrix||42.1%|Medium||
|1254|Number of Closed Islands|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1254.Number-of-Closed-Islands)|62.0%|Medium||
|1254|Number of Closed Islands|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1254.Number-of-Closed-Islands)|62.1%|Medium||
|1255|Maximum Score Words Formed by Letters||70.4%|Hard||
|1256|Encode Number||68.3%|Medium||
|1257|Smallest Common Region||61.4%|Medium||
@ -1418,7 +1418,7 @@
|1277|Count Square Submatrices with All Ones||73.0%|Medium||
|1278|Palindrome Partitioning III||61.3%|Hard||
|1279|Traffic Light Controlled Intersection||76.4%|Easy||
|1280|Students and Examinations||75.7%|Easy||
|1280|Students and Examinations||75.6%|Easy||
|1281|Subtract the Product and Sum of Digits of an Integer|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1281.Subtract-the-Product-and-Sum-of-Digits-of-an-Integer)|85.6%|Easy||
|1282|Group the People Given the Group Size They Belong To||84.6%|Medium||
|1283|Find the Smallest Divisor Given a Threshold|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1283.Find-the-Smallest-Divisor-Given-a-Threshold)|50.4%|Medium||
@ -1435,7 +1435,7 @@
|1294|Weather Type in Each Country||66.9%|Easy||
|1295|Find Numbers with Even Number of Digits|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1295.Find-Numbers-with-Even-Number-of-Digits)|78.4%|Easy||
|1296|Divide Array in Sets of K Consecutive Numbers||55.8%|Medium||
|1297|Maximum Number of Occurrences of a Substring||51.2%|Medium||
|1297|Maximum Number of Occurrences of a Substring||51.3%|Medium||
|1298|Maximum Candies You Can Get from Boxes||60.1%|Hard||
|1299|Replace Elements with Greatest Element on Right Side|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1299.Replace-Elements-with-Greatest-Element-on-Right-Side)|74.5%|Easy||
|1300|Sum of Mutated Array Closest to Target|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1300.Sum-of-Mutated-Array-Closest-to-Target)|42.7%|Medium||
@ -1486,7 +1486,7 @@
|1345|Jump Game IV||42.1%|Hard||
|1346|Check If N and Its Double Exist||35.8%|Easy||
|1347|Minimum Number of Steps to Make Two Strings Anagram||75.0%|Medium||
|1348|Tweet Counts Per Frequency||38.5%|Medium||
|1348|Tweet Counts Per Frequency||38.6%|Medium||
|1349|Maximum Students Taking Exam||44.8%|Hard||
|1350|Students With Invalid Departments||90.5%|Easy||
|1351|Count Negative Numbers in a Sorted Matrix||75.6%|Easy||
@ -1531,12 +1531,12 @@
|1390|Four Divisors||39.7%|Medium||
|1391|Check if There is a Valid Path in a Grid||45.4%|Medium||
|1392|Longest Happy Prefix||42.6%|Hard||
|1393|Capital Gain/Loss||91.2%|Medium||
|1393|Capital Gain/Loss||91.1%|Medium||
|1394|Find Lucky Integer in an Array||63.1%|Easy||
|1395|Count Number of Teams||73.2%|Medium||
|1396|Design Underground System|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1396.Design-Underground-System)|71.8%|Medium||
|1397|Find All Good Strings||39.0%|Hard||
|1398|Customers Who Bought Products A and B but Not C||82.4%|Medium||
|1398|Customers Who Bought Products A and B but Not C||82.3%|Medium||
|1399|Count Largest Group||65.4%|Easy||
|1400|Construct K Palindrome Strings||63.2%|Medium||
|1401|Circle and Rectangle Overlapping||42.8%|Medium||
@ -1554,7 +1554,7 @@
|1413|Minimum Value to Get Positive Step by Step Sum||65.5%|Easy||
|1414|Find the Minimum Number of Fibonacci Numbers Whose Sum Is K||63.0%|Medium||
|1415|The k-th Lexicographical String of All Happy Strings of Length n||70.1%|Medium||
|1416|Restore The Array||36.6%|Hard||
|1416|Restore The Array||36.7%|Hard||
|1417|Reformat The String||56.6%|Easy||
|1418|Display Table of Food Orders in a Restaurant||70.0%|Medium||
|1419|Minimum Number of Frogs Croaking||47.9%|Medium||
@ -1569,7 +1569,7 @@
|1428|Leftmost Column with at Least a One||50.0%|Medium||
|1429|First Unique Number||50.3%|Medium||
|1430|Check If a String Is a Valid Sequence from Root to Leaves Path in a Binary Tree||45.3%|Medium||
|1431|Kids With the Greatest Number of Candies||88.1%|Easy||
|1431|Kids With the Greatest Number of Candies||88.0%|Easy||
|1432|Max Difference You Can Get From Changing an Integer||43.0%|Medium||
|1433|Check If a String Can Break Another String||67.6%|Medium||
|1434|Number of Ways to Wear Different Hats to Each Other||39.9%|Hard||
@ -1587,7 +1587,7 @@
|1446|Consecutive Characters||61.3%|Easy||
|1447|Simplified Fractions||62.6%|Medium||
|1448|Count Good Nodes in Binary Tree||72.0%|Medium||
|1449|Form Largest Integer With Digits That Add up to Target||44.7%|Hard||
|1449|Form Largest Integer With Digits That Add up to Target||44.8%|Hard||
|1450|Number of Students Doing Homework at a Given Time||76.8%|Easy||
|1451|Rearrange Words in a Sentence||60.2%|Medium||
|1452|People Whose List of Favorite Companies Is Not a Subset of Another List||55.5%|Medium||
@ -1603,7 +1603,7 @@
|1462|Course Schedule IV||45.8%|Medium||
|1463|Cherry Pickup II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1463.Cherry-Pickup-II)|68.7%|Hard||
|1464|Maximum Product of Two Elements in an Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1464.Maximum-Product-of-Two-Elements-in-an-Array)|77.0%|Easy||
|1465|Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts||36.7%|Medium||
|1465|Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1465.Maximum-Area-of-a-Piece-of-Cake-After-Horizontal-and-Vertical-Cuts)|37.0%|Medium||
|1466|Reorder Routes to Make All Paths Lead to the City Zero||62.0%|Medium||
|1467|Probability of a Two Boxes Having The Same Number of Distinct Balls||60.7%|Hard||
|1468|Calculate Salaries||82.3%|Medium||
@ -1614,11 +1614,11 @@
|1473|Paint House III||49.0%|Hard||
|1474|Delete N Nodes After M Nodes of a Linked List||73.3%|Easy||
|1475|Final Prices With a Special Discount in a Shop||74.8%|Easy||
|1476|Subrectangle Queries||87.8%|Medium||
|1476|Subrectangle Queries||87.9%|Medium||
|1477|Find Two Non-overlapping Sub-arrays Each With Target Sum||35.5%|Medium||
|1478|Allocate Mailboxes||53.9%|Hard||
|1479|Sales by Day of the Week||83.1%|Hard||
|1480|Running Sum of 1d Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1480.Running-Sum-of-1d-Array)|88.9%|Easy||
|1480|Running Sum of 1d Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1480.Running-Sum-of-1d-Array)|88.8%|Easy||
|1481|Least Number of Unique Integers after K Removals||56.1%|Medium||
|1482|Minimum Number of Days to Make m Bouquets|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1482.Minimum-Number-of-Days-to-Make-m-Bouquets)|51.8%|Medium||
|1483|Kth Ancestor of a Tree Node||32.7%|Hard||
@ -1626,7 +1626,7 @@
|1485|Clone Binary Tree With Random Pointer||79.5%|Medium||
|1486|XOR Operation in an Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1486.XOR-Operation-in-an-Array)|83.9%|Easy||
|1487|Making File Names Unique||31.7%|Medium||
|1488|Avoid Flood in The City||24.6%|Medium||
|1488|Avoid Flood in The City||24.5%|Medium||
|1489|Find Critical and Pseudo-Critical Edges in Minimum Spanning Tree||51.7%|Hard||
|1490|Clone N-ary Tree||83.0%|Medium||
|1491|Average Salary Excluding the Minimum and Maximum Salary||68.0%|Easy||
@ -1686,8 +1686,8 @@
|1545|Find Kth Bit in Nth Binary String||57.8%|Medium||
|1546|Maximum Number of Non-Overlapping Subarrays With Sum Equals Target||44.5%|Medium||
|1547|Minimum Cost to Cut a Stick||53.0%|Hard||
|1548|The Most Similar Path in a Graph||55.4%|Hard||
|1549|The Most Recent Orders for Each Product||67.5%|Medium||
|1548|The Most Similar Path in a Graph||55.5%|Hard||
|1549|The Most Recent Orders for Each Product||67.4%|Medium||
|1550|Three Consecutive Odds||64.1%|Easy||
|1551|Minimum Operations to Make Array Equal|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1551.Minimum-Operations-to-Make-Array-Equal)|80.6%|Medium||
|1552|Magnetic Force Between Two Balls||50.0%|Medium||
@ -1713,10 +1713,10 @@
|1572|Matrix Diagonal Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1572.Matrix-Diagonal-Sum)|77.9%|Easy||
|1573|Number of Ways to Split a String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1573.Number-of-Ways-to-Split-a-String)|31.3%|Medium||
|1574|Shortest Subarray to be Removed to Make Array Sorted||34.3%|Medium||
|1575|Count All Possible Routes||57.5%|Hard||
|1575|Count All Possible Routes||57.4%|Hard||
|1576|Replace All ?'s to Avoid Consecutive Repeating Characters||50.2%|Easy||
|1577|Number of Ways Where Square of Number Is Equal to Product of Two Numbers||38.1%|Medium||
|1578|Minimum Deletion Cost to Avoid Repeating Letters||60.9%|Medium||
|1578|Minimum Deletion Cost to Avoid Repeating Letters||61.0%|Medium||
|1579|Remove Max Number of Edges to Keep Graph Fully Traversable|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1579.Remove-Max-Number-of-Edges-to-Keep-Graph-Fully-Traversable)|46.6%|Hard||
|1580|Put Boxes Into the Warehouse II||63.4%|Medium||
|1581|Customer Who Visited but Did Not Make Any Transactions||89.4%|Easy||
@ -1746,13 +1746,13 @@
|1605|Find Valid Matrix Given Row and Column Sums||77.4%|Medium||
|1606|Find Servers That Handled Most Number of Requests||38.0%|Hard||
|1607|Sellers With No Sales||55.1%|Easy||
|1608|Special Array With X Elements Greater Than or Equal X|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1608.Special-Array-With-X-Elements-Greater-Than-or-Equal-X)|61.4%|Easy||
|1608|Special Array With X Elements Greater Than or Equal X|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1608.Special-Array-With-X-Elements-Greater-Than-or-Equal-X)|61.3%|Easy||
|1609|Even Odd Tree||52.2%|Medium||
|1610|Maximum Number of Visible Points||32.3%|Hard||
|1611|Minimum One Bit Operations to Make Integers Zero||58.6%|Hard||
|1612|Check If Two Expression Trees are Equivalent||70.0%|Medium||
|1613|Find the Missing IDs||74.9%|Medium||
|1614|Maximum Nesting Depth of the Parentheses|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1614.Maximum-Nesting-Depth-of-the-Parentheses)|82.7%|Easy||
|1614|Maximum Nesting Depth of the Parentheses|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1614.Maximum-Nesting-Depth-of-the-Parentheses)|82.6%|Easy||
|1615|Maximal Network Rank||53.8%|Medium||
|1616|Split Two Strings to Make Palindrome||30.6%|Medium||
|1617|Count Subtrees With Max Distance Between Cities||63.6%|Hard||
@ -1761,7 +1761,7 @@
|1620|Coordinate With Maximum Network Quality||37.0%|Medium||
|1621|Number of Sets of K Non-Overlapping Line Segments||41.9%|Medium||
|1622|Fancy Sequence||14.7%|Hard||
|1623|All Valid Triplets That Can Represent a Country||89.0%|Easy||
|1623|All Valid Triplets That Can Represent a Country||88.9%|Easy||
|1624|Largest Substring Between Two Equal Characters|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1624.Largest-Substring-Between-Two-Equal-Characters)|58.5%|Easy||
|1625|Lexicographically Smallest String After Applying Operations||65.0%|Medium||
|1626|Best Team With No Conflicts||39.1%|Medium||
@ -1773,7 +1773,7 @@
|1632|Rank Transform of a Matrix||32.1%|Hard||
|1633|Percentage of Users Attended a Contest||70.7%|Easy||
|1634|Add Two Polynomials Represented as Linked Lists||52.9%|Medium||
|1635|Hopper Company Queries I||56.5%|Hard||
|1635|Hopper Company Queries I||56.6%|Hard||
|1636|Sort Array by Increasing Frequency|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1636.Sort-Array-by-Increasing-Frequency)|67.1%|Easy||
|1637|Widest Vertical Area Between Two Points Containing No Points||83.9%|Medium||
|1638|Count Substrings That Differ by One Character||71.0%|Medium||
@ -1781,12 +1781,12 @@
|1640|Check Array Formation Through Concatenation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1640.Check-Array-Formation-Through-Concatenation)|55.6%|Easy||
|1641|Count Sorted Vowel Strings|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1641.Count-Sorted-Vowel-Strings)|75.1%|Medium||
|1642|Furthest Building You Can Reach|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1642.Furthest-Building-You-Can-Reach)|43.2%|Medium||
|1643|Kth Smallest Instructions||45.4%|Hard||
|1643|Kth Smallest Instructions||45.3%|Hard||
|1644|Lowest Common Ancestor of a Binary Tree II||56.8%|Medium||
|1645|Hopper Company Queries II||38.8%|Hard||
|1646|Get Maximum in Generated Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1646.Get-Maximum-in-Generated-Array)|52.9%|Easy||
|1647|Minimum Deletions to Make Character Frequencies Unique|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique)|55.5%|Medium||
|1648|Sell Diminishing-Valued Colored Balls|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1648.Sell-Diminishing-Valued-Colored-Balls)|30.8%|Medium||
|1648|Sell Diminishing-Valued Colored Balls|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1648.Sell-Diminishing-Valued-Colored-Balls)|30.9%|Medium||
|1649|Create Sorted Array through Instructions|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1649.Create-Sorted-Array-through-Instructions)|36.8%|Hard||
|1650|Lowest Common Ancestor of a Binary Tree III||76.6%|Medium||
|1651|Hopper Company Queries III||66.5%|Hard||
@ -1799,12 +1799,12 @@
|1658|Minimum Operations to Reduce X to Zero|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1658.Minimum-Operations-to-Reduce-X-to-Zero)|33.3%|Medium||
|1659|Maximize Grid Happiness|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1659.Maximize-Grid-Happiness)|35.9%|Hard||
|1660|Correct a Binary Tree||75.9%|Medium||
|1661|Average Time of Process per Machine||79.5%|Easy||
|1661|Average Time of Process per Machine||79.6%|Easy||
|1662|Check If Two String Arrays are Equivalent|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1662.Check-If-Two-String-Arrays-are-Equivalent)|82.2%|Easy||
|1663|Smallest String With A Given Numeric Value|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1663.Smallest-String-With-A-Given-Numeric-Value)|64.2%|Medium||
|1664|Ways to Make a Fair Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1664.Ways-to-Make-a-Fair-Array)|61.9%|Medium||
|1665|Minimum Initial Energy to Finish Tasks|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1665.Minimum-Initial-Energy-to-Finish-Tasks)|54.7%|Hard||
|1666|Change the Root of a Binary Tree||69.5%|Medium||
|1666|Change the Root of a Binary Tree||69.4%|Medium||
|1667|Fix Names in a Table||62.3%|Easy||
|1668|Maximum Repeating Substring|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1668.Maximum-Repeating-Substring)|38.7%|Easy||
|1669|Merge In Between Linked Lists|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1669.Merge-In-Between-Linked-Lists)|75.1%|Medium||
@ -1812,21 +1812,21 @@
|1671|Minimum Number of Removals to Make Mountain Array||44.7%|Hard||
|1672|Richest Customer Wealth|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1672.Richest-Customer-Wealth)|88.1%|Easy||
|1673|Find the Most Competitive Subsequence|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1673.Find-the-Most-Competitive-Subsequence)|45.7%|Medium||
|1674|Minimum Moves to Make Array Complementary|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1674.Minimum-Moves-to-Make-Array-Complementary)|36.1%|Medium||
|1674|Minimum Moves to Make Array Complementary|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1674.Minimum-Moves-to-Make-Array-Complementary)|36.2%|Medium||
|1675|Minimize Deviation in Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1675.Minimize-Deviation-in-Array)|48.1%|Hard||
|1676|Lowest Common Ancestor of a Binary Tree IV||79.2%|Medium||
|1677|Product's Worth Over Invoices||55.8%|Easy||
|1676|Lowest Common Ancestor of a Binary Tree IV||79.3%|Medium||
|1677|Product's Worth Over Invoices||55.6%|Easy||
|1678|Goal Parser Interpretation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1678.Goal-Parser-Interpretation)|84.9%|Easy||
|1679|Max Number of K-Sum Pairs|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1679.Max-Number-of-K-Sum-Pairs)|53.6%|Medium||
|1680|Concatenation of Consecutive Binary Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1680.Concatenation-of-Consecutive-Binary-Numbers)|52.2%|Medium||
|1681|Minimum Incompatibility|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1681.Minimum-Incompatibility)|35.9%|Hard||
|1682|Longest Palindromic Subsequence II||51.9%|Medium||
|1682|Longest Palindromic Subsequence II||51.8%|Medium||
|1683|Invalid Tweets||91.0%|Easy||
|1684|Count the Number of Consistent Strings|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1684.Count-the-Number-of-Consistent-Strings)|81.6%|Easy||
|1685|Sum of Absolute Differences in a Sorted Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1685.Sum-of-Absolute-Differences-in-a-Sorted-Array)|63.4%|Medium||
|1686|Stone Game VI||50.7%|Medium||
|1687|Delivering Boxes from Storage to Ports||35.9%|Hard||
|1688|Count of Matches in Tournament|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1688.Count-of-Matches-in-Tournament)|81.6%|Easy||
|1688|Count of Matches in Tournament|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1688.Count-of-Matches-in-Tournament)|81.7%|Easy||
|1689|Partitioning Into Minimum Number Of Deci-Binary Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1689.Partitioning-Into-Minimum-Number-Of-Deci-Binary-Numbers)|88.8%|Medium||
|1690|Stone Game VII|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1690.Stone-Game-VII)|50.1%|Medium||
|1691|Maximum Height by Stacking Cuboids|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1691.Maximum-Height-by-Stacking-Cuboids)|50.8%|Hard||
@ -1836,7 +1836,7 @@
|1695|Maximum Erasure Value|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1695.Maximum-Erasure-Value)|52.5%|Medium||
|1696|Jump Game VI|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1696.Jump-Game-VI)|38.3%|Medium||
|1697|Checking Existence of Edge Length Limited Paths||47.8%|Hard||
|1698|Number of Distinct Substrings in a String||61.1%|Medium||
|1698|Number of Distinct Substrings in a String||60.9%|Medium||
|1699|Number of Calls Between Two Persons||85.9%|Medium||
|1700|Number of Students Unable to Eat Lunch|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1700.Number-of-Students-Unable-to-Eat-Lunch)|67.7%|Easy||
|1701|Average Waiting Time||61.0%|Medium||
@ -1844,7 +1844,7 @@
|1703|Minimum Adjacent Swaps for K Consecutive Ones||37.3%|Hard||
|1704|Determine if String Halves Are Alike|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1704.Determine-if-String-Halves-Are-Alike)|78.7%|Easy||
|1705|Maximum Number of Eaten Apples||34.0%|Medium||
|1706|Where Will the Ball Fall||61.9%|Medium||
|1706|Where Will the Ball Fall||62.0%|Medium||
|1707|Maximum XOR With an Element From Array||42.6%|Hard||
|1708|Largest Subarray Length K||63.5%|Easy||
|1709|Biggest Window Between Visits||81.0%|Medium||
@ -1862,17 +1862,17 @@
|1721|Swapping Nodes in a Linked List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1721.Swapping-Nodes-in-a-Linked-List)|66.9%|Medium||
|1722|Minimize Hamming Distance After Swap Operations||45.9%|Medium||
|1723|Find Minimum Time to Finish All Jobs||40.8%|Hard||
|1724|Checking Existence of Edge Length Limited Paths II||57.1%|Hard||
|1724|Checking Existence of Edge Length Limited Paths II||57.2%|Hard||
|1725|Number Of Rectangles That Can Form The Largest Square|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1725.Number-Of-Rectangles-That-Can-Form-The-Largest-Square)|78.2%|Easy||
|1726|Tuple with Same Product||58.2%|Medium||
|1727|Largest Submatrix With Rearrangements||59.1%|Medium||
|1728|Cat and Mouse II||41.0%|Hard||
|1729|Find Followers Count||70.5%|Easy||
|1729|Find Followers Count||70.4%|Easy||
|1730|Shortest Path to Get Food||55.4%|Medium||
|1731|The Number of Employees Which Report to Each Employee||49.2%|Easy||
|1731|The Number of Employees Which Report to Each Employee||49.3%|Easy||
|1732|Find the Highest Altitude|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1732.Find-the-Highest-Altitude)|79.4%|Easy||
|1733|Minimum Number of People to Teach||38.2%|Medium||
|1734|Decode XORed Permutation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1734.Decode-XORed-Permutation)|56.1%|Medium||
|1734|Decode XORed Permutation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1734.Decode-XORed-Permutation)|56.2%|Medium||
|1735|Count Ways to Make Array With Product||48.2%|Hard||
|1736|Latest Time by Replacing Hidden Digits|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1736.Latest-Time-by-Replacing-Hidden-Digits)|41.4%|Easy||
|1737|Change Minimum Characters to Satisfy One of Three Conditions||30.3%|Medium||
@ -1882,7 +1882,7 @@
|1741|Find Total Time Spent by Each Employee||90.8%|Easy||
|1742|Maximum Number of Balls in a Box|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1742.Maximum-Number-of-Balls-in-a-Box)|73.2%|Easy||
|1743|Restore the Array From Adjacent Pairs||64.4%|Medium||
|1744|Can You Eat Your Favorite Candy on Your Favorite Day?||31.3%|Medium||
|1744|Can You Eat Your Favorite Candy on Your Favorite Day?|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1744.Can-You-Eat-Your-Favorite-Candy-on-Your-Favorite-Day?)|31.3%|Medium||
|1745|Palindrome Partitioning IV||49.8%|Hard||
|1746|Maximum Subarray Sum After One Operation||61.9%|Medium||
|1747|Leetflex Banned Accounts||68.5%|Medium||
@ -1893,11 +1893,11 @@
|1752|Check if Array Is Sorted and Rotated|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1752.Check-if-Array-Is-Sorted-and-Rotated)|44.4%|Easy||
|1753|Maximum Score From Removing Stones||62.6%|Medium||
|1754|Largest Merge Of Two Strings||41.5%|Medium||
|1755|Closest Subsequence Sum||34.1%|Hard||
|1756|Design Most Recently Used Queue||78.4%|Medium||
|1755|Closest Subsequence Sum||34.0%|Hard||
|1756|Design Most Recently Used Queue||78.5%|Medium||
|1757|Recyclable and Low Fat Products||95.3%|Easy||
|1758|Minimum Changes To Make Alternating Binary String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1758.Minimum-Changes-To-Make-Alternating-Binary-String)|58.1%|Easy||
|1759|Count Number of Homogenous Substrings||43.4%|Medium||
|1759|Count Number of Homogenous Substrings||43.5%|Medium||
|1760|Minimum Limit of Balls in a Bag||53.6%|Medium||
|1761|Minimum Degree of a Connected Trio in a Graph||38.3%|Hard||
|1762|Buildings With an Ocean View||81.5%|Medium||
@ -1907,16 +1907,16 @@
|1766|Tree of Coprimes||36.2%|Hard||
|1767|Find the Subtasks That Did Not Execute||85.6%|Hard||
|1768|Merge Strings Alternately||74.4%|Easy||
|1769|Minimum Number of Operations to Move All Balls to Each Box||86.0%|Medium||
|1769|Minimum Number of Operations to Move All Balls to Each Box||85.9%|Medium||
|1770|Maximum Score from Performing Multiplication Operations||30.2%|Medium||
|1771|Maximize Palindrome Length From Subsequences||34.3%|Hard||
|1772|Sort Features by Popularity||65.7%|Medium||
|1772|Sort Features by Popularity||65.8%|Medium||
|1773|Count Items Matching a Rule||84.6%|Easy||
|1774|Closest Dessert Cost||45.2%|Medium||
|1775|Equal Sum Arrays With Minimum Number of Operations||50.5%|Medium||
|1776|Car Fleet II||49.1%|Hard||
|1777|Product's Price for Each Store||86.5%|Easy||
|1778|Shortest Path in a Hidden Grid||44.0%|Medium||
|1778|Shortest Path in a Hidden Grid||44.1%|Medium||
|1779|Find Nearest Point That Has the Same X or Y Coordinate||66.7%|Easy||
|1780|Check if Number is a Sum of Powers of Three||63.0%|Medium||
|1781|Sum of Beauty of All Substrings||58.3%|Medium||
@ -1924,7 +1924,7 @@
|1783|Grand Slam Titles||90.2%|Medium||
|1784|Check if Binary String Has at Most One Segment of Ones||41.4%|Easy||
|1785|Minimum Elements to Add to Form a Given Sum||39.9%|Medium||
|1786|Number of Restricted Paths From First to Last Node||36.4%|Medium||
|1786|Number of Restricted Paths From First to Last Node||36.3%|Medium||
|1787|Make the XOR of All Segments Equal to Zero||37.1%|Hard||
|1788|Maximize the Beauty of the Garden||67.4%|Hard||
|1789|Primary Department for Each Employee||79.0%|Easy||
@ -1933,7 +1933,7 @@
|1792|Maximum Average Pass Ratio||46.9%|Medium||
|1793|Maximum Score of a Good Subarray||47.5%|Hard||
|1794|Count Pairs of Equal Substrings With Minimum Difference||68.9%|Medium||
|1795|Rearrange Products Table||90.1%|Easy||
|1795|Rearrange Products Table||90.2%|Easy||
|1796|Second Largest Digit in a String||47.8%|Easy||
|1797|Design Authentication Manager||49.7%|Medium||
|1798|Maximum Number of Consecutive Values You Can Make||46.1%|Medium||
@ -1948,8 +1948,8 @@
|1807|Evaluate the Bracket Pairs of a String||66.3%|Medium||
|1808|Maximize Number of Nice Divisors||28.0%|Hard||
|1809|Ad-Free Sessions||64.2%|Easy||
|1810|Minimum Path Cost in a Hidden Grid||53.7%|Medium||
|1811|Find Interview Candidates||68.2%|Medium||
|1810|Minimum Path Cost in a Hidden Grid||53.8%|Medium||
|1811|Find Interview Candidates||68.3%|Medium||
|1812|Determine Color of a Chessboard Square||77.6%|Easy||
|1813|Sentence Similarity III||31.5%|Medium||
|1814|Count Nice Pairs in an Array||39.1%|Medium||
@ -1959,71 +1959,71 @@
|1818|Minimum Absolute Sum Difference||28.4%|Medium||
|1819|Number of Different Subsequences GCDs||34.3%|Hard||
|1820|Maximum Number of Accepted Invitations||47.9%|Medium||
|1821|Find Customers With Positive Revenue this Year||89.3%|Easy||
|1821|Find Customers With Positive Revenue this Year||89.4%|Easy||
|1822|Sign of the Product of an Array||63.5%|Easy||
|1823|Find the Winner of the Circular Game||72.1%|Medium||
|1824|Minimum Sideway Jumps||47.4%|Medium||
|1825|Finding MK Average||27.7%|Hard||
|1826|Faulty Sensor||58.2%|Easy||
|1827|Minimum Operations to Make the Array Increasing||78.2%|Easy||
|1828|Queries on Number of Points Inside a Circle||86.8%|Medium||
|1829|Maximum XOR for Each Query||73.3%|Medium||
|1830|Minimum Number of Operations to Make String Sorted||46.3%|Hard||
|1828|Queries on Number of Points Inside a Circle||86.7%|Medium||
|1829|Maximum XOR for Each Query||73.4%|Medium||
|1830|Minimum Number of Operations to Make String Sorted||46.2%|Hard||
|1831|Maximum Transaction Each Day||85.3%|Medium||
|1832|Check if the Sentence Is Pangram||82.9%|Easy||
|1833|Maximum Ice Cream Bars||63.6%|Medium||
|1834|Single-Threaded CPU||33.1%|Medium||
|1835|Find XOR Sum of All Pairs Bitwise AND||56.1%|Hard||
|1836|Remove Duplicates From an Unsorted Linked List||72.6%|Medium||
|1834|Single-Threaded CPU||33.2%|Medium||
|1835|Find XOR Sum of All Pairs Bitwise AND||56.2%|Hard||
|1836|Remove Duplicates From an Unsorted Linked List||72.4%|Medium||
|1837|Sum of Digits in Base K||75.0%|Easy||
|1838|Frequency of the Most Frequent Element||32.8%|Medium||
|1839|Longest Substring Of All Vowels in Order||47.3%|Medium||
|1840|Maximum Building Height||34.2%|Hard||
|1841|League Statistics||62.5%|Medium||
|1842|Next Palindrome Using Same Digits||63.7%|Hard||
|1841|League Statistics||62.4%|Medium||
|1842|Next Palindrome Using Same Digits||63.9%|Hard||
|1843|Suspicious Bank Accounts||51.9%|Medium||
|1844|Replace All Digits with Characters||80.8%|Easy||
|1844|Replace All Digits with Characters||80.7%|Easy||
|1845|Seat Reservation Manager||54.7%|Medium||
|1846|Maximum Element After Decreasing and Rearranging||54.3%|Medium||
|1847|Closest Room||31.3%|Hard||
|1846|Maximum Element After Decreasing and Rearranging||54.4%|Medium||
|1847|Closest Room||31.2%|Hard||
|1848|Minimum Distance to the Target Element||60.4%|Easy||
|1849|Splitting a String Into Descending Consecutive Values||27.2%|Medium||
|1850|Minimum Adjacent Swaps to Reach the Kth Smallest Number||63.1%|Medium||
|1851|Minimum Interval to Include Each Query||42.0%|Hard||
|1852|Distinct Numbers in Each Subarray||76.9%|Medium||
|1852|Distinct Numbers in Each Subarray||76.8%|Medium||
|1853|Convert Date Format||88.5%|Easy||
|1854|Maximum Population Year||57.0%|Easy||
|1854|Maximum Population Year||56.9%|Easy||
|1855|Maximum Distance Between a Pair of Values||45.6%|Medium||
|1856|Maximum Subarray Min-Product||33.2%|Medium||
|1857|Largest Color Value in a Directed Graph||35.3%|Hard||
|1858|Longest Word With All Prefixes||68.1%|Medium||
|1858|Longest Word With All Prefixes||68.0%|Medium||
|1859|Sorting the Sentence||81.7%|Easy||
|1860|Incremental Memory Leak||69.2%|Medium||
|1861|Rotating the Box||61.2%|Medium||
|1860|Incremental Memory Leak||69.1%|Medium||
|1861|Rotating the Box||61.3%|Medium||
|1862|Sum of Floored Pairs||27.0%|Hard||
|1863|Sum of All Subset XOR Totals||78.0%|Easy||
|1864|Minimum Number of Swaps to Make the Binary String Alternating||35.7%|Medium||
|1865|Finding Pairs With a Certain Sum||45.5%|Medium||
|1866|Number of Ways to Rearrange Sticks With K Sticks Visible||53.7%|Hard||
|1867|Orders With Maximum Quantity Above Average||79.0%|Medium||
|1868|Product of Two Run-Length Encoded Arrays||59.1%|Medium||
|1869|Longer Contiguous Segments of Ones than Zeros||59.8%|Easy||
|1866|Number of Ways to Rearrange Sticks With K Sticks Visible||53.6%|Hard||
|1867|Orders With Maximum Quantity Above Average||78.9%|Medium||
|1868|Product of Two Run-Length Encoded Arrays||59.2%|Medium||
|1869|Longer Contiguous Segments of Ones than Zeros||59.7%|Easy||
|1870|Minimum Speed to Arrive on Time||32.1%|Medium||
|1871|Jump Game VII||23.9%|Medium||
|1872|Stone Game VIII||50.3%|Hard||
|1873|Calculate Special Bonus||92.0%|Easy||
|1874|Minimize Product Sum of Two Arrays||92.3%|Medium||
|1874|Minimize Product Sum of Two Arrays||92.2%|Medium||
|1875|Group Employees of the Same Salary||75.6%|Medium||
|1876|Substrings of Size Three with Distinct Characters||66.8%|Easy||
|1877|Minimize Maximum Pair Sum in Array||79.1%|Medium||
|1878|Get Biggest Three Rhombus Sums in a Grid||42.4%|Medium||
|1879|Minimum XOR Sum of Two Arrays||32.7%|Hard||
|1876|Substrings of Size Three with Distinct Characters||66.9%|Easy||
|1877|Minimize Maximum Pair Sum in Array||79.0%|Medium||
|1878|Get Biggest Three Rhombus Sums in a Grid||42.5%|Medium||
|1879|Minimum XOR Sum of Two Arrays||33.1%|Hard||
|1880|Check if Word Equals Summation of Two Words||75.5%|Easy||
|1881|Maximum Value after Insertion||33.5%|Medium||
|1882|Process Tasks Using Servers||29.3%|Medium||
|1882|Process Tasks Using Servers||29.4%|Medium||
|1883|Minimum Skips to Arrive at Meeting On Time||33.8%|Hard||
|1884|Egg Drop With 2 Eggs and N Floors||73.7%|Medium||
|1885|Count Pairs in Two Arrays||66.2%|Medium||
|1884|Egg Drop With 2 Eggs and N Floors||74.1%|Medium||
|1885|Count Pairs in Two Arrays||67.7%|Medium||
|------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|
------------------------------------------------------------------

View File

@ -0,0 +1,35 @@
package leetcode
func isInterleave(s1 string, s2 string, s3 string) bool {
if len(s1)+len(s2) != len(s3) {
return false
}
visited := make(map[int]bool)
return dfs(s1, s2, s3, 0, 0, visited)
}
func dfs(s1, s2, s3 string, p1, p2 int, visited map[int]bool) bool {
if p1+p2 == len(s3) {
return true
}
if _, ok := visited[(p1*len(s3))+p2]; ok {
return false
}
visited[(p1*len(s3))+p2] = true
var match1, match2 bool
if p1 < len(s1) && s3[p1+p2] == s1[p1] {
match1 = true
}
if p2 < len(s2) && s3[p1+p2] == s2[p2] {
match2 = true
}
if match1 && match2 {
return dfs(s1, s2, s3, p1+1, p2, visited) || dfs(s1, s2, s3, p1, p2+1, visited)
} else if match1 {
return dfs(s1, s2, s3, p1+1, p2, visited)
} else if match2 {
return dfs(s1, s2, s3, p1, p2+1, visited)
} else {
return false
}
}

View File

@ -0,0 +1,54 @@
package leetcode
import (
"fmt"
"testing"
)
type question97 struct {
para97
ans97
}
// para 是参数
// one 代表第一个参数
type para97 struct {
s1 string
s2 string
s3 string
}
// ans 是答案
// one 代表第一个答案
type ans97 struct {
one bool
}
func Test_Problem97(t *testing.T) {
qs := []question97{
{
para97{"aabcc", "dbbca", "aadbbcbcac"},
ans97{true},
},
{
para97{"aabcc", "dbbca", "aadbbbaccc"},
ans97{false},
},
{
para97{"", "", ""},
ans97{true},
},
}
fmt.Printf("------------------------Leetcode Problem 97------------------------\n")
for _, q := range qs {
_, p := q.ans97, q.para97
fmt.Printf("【input】:%v 【output】:%v\n", p, isInterleave(p.s1, p.s2, p.s3))
}
fmt.Printf("\n\n\n")
}

View File

@ -0,0 +1,104 @@
# [97. Interleaving String](https://leetcode.com/problems/interleaving-string/)
## 题目
Given strings `s1`, `s2`, and `s3`, find whether `s3` is formed by an **interleaving** of `s1` and `s2`.
An **interleaving** of two strings `s` and `t` is a configuration where they are divided into **non-empty** substrings such that:
- `s = s1 + s2 + ... + sn`
- `t = t1 + t2 + ... + tm`
- `|n - m| <= 1`
- The **interleaving** is `s1 + t1 + s2 + t2 + s3 + t3 + ...` or `t1 + s1 + t2 + s2 + t3 + s3 + ...`
**Note:** `a + b` is the concatenation of strings `a` and `b`.
**Example 1:**
![https://assets.leetcode.com/uploads/2020/09/02/interleave.jpg](https://assets.leetcode.com/uploads/2020/09/02/interleave.jpg)
```
Input: s1 = "aabcc", s2 = "dbbca", s3 = "aadbbcbcac"
Output: true
```
**Example 2:**
```
Input: s1 = "aabcc", s2 = "dbbca", s3 = "aadbbbaccc"
Output: false
```
**Example 3:**
```
Input: s1 = "", s2 = "", s3 = ""
Output: true
```
**Constraints:**
- `0 <= s1.length, s2.length <= 100`
- `0 <= s3.length <= 200`
- `s1`, `s2`, and `s3` consist of lowercase English letters.
**Follow up:** Could you solve it using only `O(s2.length)` additional memory space?
## 题目大意
给定三个字符串 s1、s2、s3请你帮忙验证 s3 是否是由 s1  s2 交错 组成的。两个字符串 s 和 t 交错 的定义与过程如下,其中每个字符串都会被分割成若干 非空 子字符串:
- s = s1 + s2 + ... + sn
- t = t1 + t2 + ... + tm
- |n - m| <= 1
- 交错 是 s1 + t1 + s2 + t2 + s3 + t3 + ... 或者 t1 + s1 + t2 + s2 + t3 + s3 + ...
提示a + b 意味着字符串 a 和 b 连接。
## 解题思路
- 深搜或者广搜暴力解题。笔者用深搜实现的。记录 s1 和 s2 串当前比较的位置 p1 和 p2。如果 s3[p1+p2] 的位置上等于 s1[p1] 或者 s2[p2] 代表能匹配上,那么继续往后移动 p1 和 p2 相应的位置。因为是交错字符串,所以判断匹配的位置是 s3[p1+p2] 的位置。如果仅仅这么写会超时s1 和 s2 两个字符串重复交叉判断的位置太多了。需要加上记忆化搜索。可以用 visited[i][j] 这样的二维数组来记录是否搜索过了。笔者为了压缩空间,将 i 和 j 编码压缩到一维数组了。i * len(s3) + j 是唯一下标,所以可以用这种方式存储是否搜索过。具体代码见下面的实现。
## 代码
```go
package leetcode
func isInterleave(s1 string, s2 string, s3 string) bool {
if len(s1)+len(s2) != len(s3) {
return false
}
visited := make(map[int]bool)
return dfs(s1, s2, s3, 0, 0, visited)
}
func dfs(s1, s2, s3 string, p1, p2 int, visited map[int]bool) bool {
if p1+p2 == len(s3) {
return true
}
if _, ok := visited[(p1*len(s3))+p2]; ok {
return false
}
visited[(p1*len(s3))+p2] = true
var match1, match2 bool
if p1 < len(s1) && s3[p1+p2] == s1[p1] {
match1 = true
}
if p2 < len(s2) && s3[p1+p2] == s2[p2] {
match2 = true
}
if match1 && match2 {
return dfs(s1, s2, s3, p1+1, p2, visited) || dfs(s1, s2, s3, p1, p2+1, visited)
} else if match1 {
return dfs(s1, s2, s3, p1+1, p2, visited)
} else if match2 {
return dfs(s1, s2, s3, p1, p2+1, visited)
} else {
return false
}
}
```

View File

@ -0,0 +1,18 @@
package leetcode
func checkSubarraySum(nums []int, k int) bool {
m := make(map[int]int)
m[0] = -1
sum := 0
for i, n := range nums {
sum += n
if r, ok := m[sum%k]; ok {
if i-2 >= r {
return true
}
} else {
m[sum%k] = i
}
}
return false
}

View File

@ -0,0 +1,53 @@
package leetcode
import (
"fmt"
"testing"
)
type question523 struct {
para523
ans523
}
// para 是参数
// one 代表第一个参数
type para523 struct {
nums []int
k int
}
// ans 是答案
// one 代表第一个答案
type ans523 struct {
one bool
}
func Test_Problem523(t *testing.T) {
qs := []question523{
{
para523{[]int{23, 2, 4, 6, 7}, 6},
ans523{true},
},
{
para523{[]int{23, 2, 6, 4, 7}, 6},
ans523{true},
},
{
para523{[]int{23, 2, 6, 4, 7}, 13},
ans523{false},
},
}
fmt.Printf("------------------------Leetcode Problem 523------------------------\n")
for _, q := range qs {
_, p := q.ans523, q.para523
fmt.Printf("【input】:%v 【output】:%v\n", p, checkSubarraySum(p.nums, p.k))
}
fmt.Printf("\n\n\n")
}

View File

@ -0,0 +1,75 @@
# [523. Continuous Subarray Sum](https://leetcode.com/problems/continuous-subarray-sum/)
## 题目
Given an integer array `nums` and an integer `k`, return `true` *if* `nums` *has a continuous subarray of size **at least two** whose elements sum up to a multiple of* `k`*, or* `false` *otherwise*.
An integer `x` is a multiple of `k` if there exists an integer `n` such that `x = n * k`. `0` is **always** a multiple of `k`.
**Example 1:**
```
Input: nums = [23,2,4,6,7], k = 6
Output: true
Explanation: [2, 4] is a continuous subarray of size 2 whose elements sum up to 6.
```
**Example 2:**
```
Input: nums = [23,2,6,4,7], k = 6
Output: true
Explanation: [23, 2, 6, 4, 7] is an continuous subarray of size 5 whose elements sum up to 42.
42 is a multiple of 6 because 42 = 7 * 6 and 7 is an integer.
```
**Example 3:**
```
Input: nums = [23,2,6,4,7], k = 13
Output: false
```
**Constraints:**
- `1 <= nums.length <= 105`
- `0 <= nums[i] <= 109`
- `0 <= sum(nums[i]) <= 231 - 1`
- `1 <= k <= 231 - 1`
## 题目大意
给你一个整数数组 nums 和一个整数 k ,编写一个函数来判断该数组是否含有同时满足下述条件的连续子数组:
- 子数组大小至少为 2 ,且
- 子数组元素总和为 k 的倍数。
如果存在,返回 true ;否则,返回 false 。如果存在一个整数 n ,令整数 x 符合 x = n * k ,则称 x 是 k 的一个倍数。
## 解题思路
- 简单题。题目只要求是否存在,不要求找出所有解。用一个变量 sum 记录累加和。子数组的元素和可以用前缀和相减得到,例如 [i,j] 区间内的元素和,可以由 prefixSum[j] - prefixSum[i] 得到。当 prefixSums[j]prefixSums[i] 为 k 的倍数时prefixSums[i] 和 prefixSums[j] 除以 k 的余数相同。因此只需要计算每个下标对应的前缀和除以 k 的余数即可,使用 map 存储每个余数第一次出现的下标即可。在 map 中如果存在相同余数的 key代表当前下标和 map 中这个 key 记录的下标可以满足总和为 k 的倍数这一条件。再判断一下能否满足大小至少为 2 的条件即可。用 2 个下标相减,长度大于等于 2 即满足条件,可以输出 true。
## 代码
```go
package leetcode
func checkSubarraySum(nums []int, k int) bool {
m := make(map[int]int)
m[0] = -1
sum := 0
for i, n := range nums {
sum += n
if r, ok := m[sum%k]; ok {
if i-2 >= r {
return true
}
} else {
m[sum%k] = i
}
}
return false
}
```

View File

@ -0,0 +1,27 @@
package leetcode
func findMaxLength(nums []int) int {
dict := map[int]int{}
dict[0] = -1
count, res := 0, 0
for i := 0; i < len(nums); i++ {
if nums[i] == 0 {
count--
} else {
count++
}
if idx, ok := dict[count]; ok {
res = max(res, i-idx)
} else {
dict[count] = i
}
}
return res
}
func max(a, b int) int {
if a > b {
return a
}
return b
}

View File

@ -0,0 +1,47 @@
package leetcode
import (
"fmt"
"testing"
)
type question525 struct {
para525
ans525
}
// para 是参数
// one 代表第一个参数
type para525 struct {
nums []int
}
// ans 是答案
// one 代表第一个答案
type ans525 struct {
one int
}
func Test_Problem525(t *testing.T) {
qs := []question525{
{
para525{[]int{0, 1}},
ans525{2},
},
{
para525{[]int{0, 1, 0}},
ans525{2},
},
}
fmt.Printf("------------------------Leetcode Problem 525------------------------\n")
for _, q := range qs {
_, p := q.ans525, q.para525
fmt.Printf("【input】:%v 【output】:%v\n", p, findMaxLength(p.nums))
}
fmt.Printf("\n\n\n")
}

View File

@ -0,0 +1,67 @@
# [525. Contiguous Array](https://leetcode.com/problems/contiguous-array/)
## 题目
Given a binary array `nums`, return *the maximum length of a contiguous subarray with an equal number of* `0` *and* `1`.
**Example 1:**
```
Input: nums = [0,1]
Output: 2
Explanation: [0, 1] is the longest contiguous subarray with an equal number of 0 and 1.
```
**Example 2:**
```
Input: nums = [0,1,0]
Output: 2
Explanation: [0, 1] (or [1, 0]) is a longest contiguous subarray with equal number of 0 and 1.
```
**Constraints:**
- `1 <= nums.length <= 105`
- `nums[i]` is either `0` or `1`.
## 题目大意
给定一个二进制数组 nums , 找到含有相同数量的 0 和 1 的最长连续子数组,并返回该子数组的长度。
## 解题思路
- 0 和 1 的数量相同可以转化为两者数量相差为 0如果将 0 看作为 -1那么原题转化为求最长连续子数组其元素和为 0 。又变成了区间内求和的问题,自然而然转换为前缀和来处理。假设连续子数组是 [i,j] 区间,这个区间内元素和为 0 意味着 prefixSum[j] - prefixSum[i] = 0也就是 prefixSum[i] = prefixSum[j]。不断累加前缀和,将每个前缀和存入 map 中。一旦某个 key 存在了,代表之前某个下标的前缀和和当前下标构成的区间,这段区间内的元素和为 0 。这个区间是所求。扫完整个数组,扫描过程中动态更新最大区间长度,扫描完成便可得到最大区间长度,即最长连续子数组。
## 代码
```go
package leetcode
func findMaxLength(nums []int) int {
dict := map[int]int{}
dict[0] = -1
count, res := 0, 0
for i := 0; i < len(nums); i++ {
if nums[i] == 0 {
count--
} else {
count++
}
if idx, ok := dict[count]; ok {
res = max(res, i-idx)
} else {
dict[count] = i
}
}
return res
}
func max(a, b int) int {
if a > b {
return a
}
return b
}
```

View File

@ -0,0 +1,26 @@
package leetcode
import "sort"
func maxArea(h int, w int, horizontalCuts []int, verticalCuts []int) int {
sort.Ints(horizontalCuts)
sort.Ints(verticalCuts)
maxw, maxl := horizontalCuts[0], verticalCuts[0]
for i, c := range horizontalCuts[1:] {
if c-horizontalCuts[i] > maxw {
maxw = c - horizontalCuts[i]
}
}
if h-horizontalCuts[len(horizontalCuts)-1] > maxw {
maxw = h - horizontalCuts[len(horizontalCuts)-1]
}
for i, c := range verticalCuts[1:] {
if c-verticalCuts[i] > maxl {
maxl = c - verticalCuts[i]
}
}
if w-verticalCuts[len(verticalCuts)-1] > maxl {
maxl = w - verticalCuts[len(verticalCuts)-1]
}
return (maxw * maxl) % (1000000007)
}

View File

@ -0,0 +1,55 @@
package leetcode
import (
"fmt"
"testing"
)
type question1465 struct {
para1465
ans1465
}
// para 是参数
// one 代表第一个参数
type para1465 struct {
h int
w int
horizontalCuts []int
verticalCuts []int
}
// ans 是答案
// one 代表第一个答案
type ans1465 struct {
one int
}
func Test_Problem1465(t *testing.T) {
qs := []question1465{
{
para1465{5, 4, []int{1, 2, 4}, []int{1, 3}},
ans1465{4},
},
{
para1465{5, 4, []int{3, 1}, []int{1}},
ans1465{6},
},
{
para1465{5, 4, []int{3}, []int{3}},
ans1465{9},
},
}
fmt.Printf("------------------------Leetcode Problem 1465------------------------\n")
for _, q := range qs {
_, p := q.ans1465, q.para1465
fmt.Printf("【input】:%v 【output】:%v \n", p, maxArea(p.h, p.w, p.horizontalCuts, p.verticalCuts))
}
fmt.Printf("\n\n\n")
}

View File

@ -0,0 +1,89 @@
# [1465. Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts](https://leetcode.com/problems/maximum-area-of-a-piece-of-cake-after-horizontal-and-vertical-cuts/)
## 题目
Given a rectangular cake with height `h` and width `w`, and two arrays of integers `horizontalCuts` and `verticalCuts` where `horizontalCuts[i]` is the distance from the top of the rectangular cake to the `ith` horizontal cut and similarly, `verticalCuts[j]` is the distance from the left of the rectangular cake to the `jth` vertical cut.
*Return the maximum area of a piece of cake after you cut at each horizontal and vertical position provided in the arrays `horizontalCuts` and `verticalCuts`.* Since the answer can be a huge number, return this modulo 10^9 + 7.
**Example 1:**
![https://assets.leetcode.com/uploads/2020/05/14/leetcode_max_area_2.png](https://assets.leetcode.com/uploads/2020/05/14/leetcode_max_area_2.png)
```
Input: h = 5, w = 4, horizontalCuts = [1,2,4], verticalCuts = [1,3]
Output: 4
Explanation: The figure above represents the given rectangular cake. Red lines are the horizontal and vertical cuts. After you cut the cake, the green piece of cake has the maximum area.
```
**Example 2:**
![https://assets.leetcode.com/uploads/2020/05/14/leetcode_max_area_3.png](https://assets.leetcode.com/uploads/2020/05/14/leetcode_max_area_3.png)
```
Input: h = 5, w = 4, horizontalCuts = [3,1], verticalCuts = [1]
Output: 6
Explanation: The figure above represents the given rectangular cake. Red lines are the horizontal and vertical cuts. After you cut the cake, the green and yellow pieces of cake have the maximum area.
```
**Example 3:**
```
Input: h = 5, w = 4, horizontalCuts = [3], verticalCuts = [3]
Output: 9
```
**Constraints:**
- `2 <= h, w <= 10^9`
- `1 <= horizontalCuts.length < min(h, 10^5)`
- `1 <= verticalCuts.length < min(w, 10^5)`
- `1 <= horizontalCuts[i] < h`
- `1 <= verticalCuts[i] < w`
- It is guaranteed that all elements in `horizontalCuts` are distinct.
- It is guaranteed that all elements in `verticalCuts` are distinct.
## 题目大意
矩形蛋糕的高度为 h 且宽度为 w给你两个整数数组 horizontalCuts 和 verticalCuts其中 horizontalCuts[i] 是从矩形蛋糕顶部到第  i 个水平切口的距离,类似地, verticalCuts[j] 是从矩形蛋糕的左侧到第 j 个竖直切口的距离。请你按数组 horizontalCuts 和 verticalCuts 中提供的水平和竖直位置切割后,请你找出 面积最大 的那份蛋糕,并返回其 面积 。由于答案可能是一个很大的数字,因此需要将结果对 10^9 + 7 取余后返回。
## 解题思路
- 读完题比较容易想到解题思路。找到水平切口最大的差值和竖直切口最大的差值,这 4 条边构成的矩形即为最大矩形。不过有特殊情况需要判断,切口除了题目给的切口坐标以外,默认还有 4 个切口,即蛋糕原始的 4 条边。如下图二,最大的矩形其实在切口之外。所以找水平切口最大差值和竖直切口最大差值需要考虑到蛋糕原始的 4 条边。
![https://img.halfrost.com/Leetcode/leetcode_1465.png](https://img.halfrost.com/Leetcode/leetcode_1465.png)
## 代码
```go
package leetcode
import "sort"
func maxArea(h int, w int, hcuts []int, vcuts []int) int {
sort.Ints(hcuts)
sort.Ints(vcuts)
maxw, maxl := hcuts[0], vcuts[0]
for i, c := range hcuts[1:] {
if c-hcuts[i] > maxw {
maxw = c - hcuts[i]
}
}
if h-hcuts[len(hcuts)-1] > maxw {
maxw = h - hcuts[len(hcuts)-1]
}
for i, c := range vcuts[1:] {
if c-vcuts[i] > maxl {
maxl = c - vcuts[i]
}
}
if w-vcuts[len(vcuts)-1] > maxl {
maxl = w - vcuts[len(vcuts)-1]
}
return (maxw * maxl) % (1000000007)
}
```

View File

@ -0,0 +1,23 @@
package leetcode
func canEat(candiesCount []int, queries [][]int) []bool {
n := len(candiesCount)
prefixSum := make([]int, n)
prefixSum[0] = candiesCount[0]
for i := 1; i < n; i++ {
prefixSum[i] = prefixSum[i-1] + candiesCount[i]
}
res := make([]bool, len(queries))
for i, q := range queries {
favoriteType, favoriteDay, dailyCap := q[0], q[1], q[2]
x1 := favoriteDay + 1
y1 := (favoriteDay + 1) * dailyCap
x2 := 1
if favoriteType > 0 {
x2 = prefixSum[favoriteType-1] + 1
}
y2 := prefixSum[favoriteType]
res[i] = !(x1 > y2 || y1 < x2)
}
return res
}

View File

@ -0,0 +1,48 @@
package leetcode
import (
"fmt"
"testing"
)
type question1744 struct {
para1744
ans1744
}
// para 是参数
// one 代表第一个参数
type para1744 struct {
candiesCount []int
queries [][]int
}
// ans 是答案
// one 代表第一个答案
type ans1744 struct {
one []bool
}
func Test_Problem1744(t *testing.T) {
qs := []question1744{
{
para1744{[]int{7, 4, 5, 3, 8}, [][]int{{0, 2, 2}, {4, 2, 4}, {2, 13, 1000000000}}},
ans1744{[]bool{true, false, true}},
},
{
para1744{[]int{5, 2, 6, 4, 1}, [][]int{{3, 1, 2}, {4, 10, 3}, {3, 10, 100}, {4, 100, 30}, {1, 3, 1}}},
ans1744{[]bool{false, true, true, false, false}},
},
}
fmt.Printf("------------------------Leetcode Problem 1744------------------------\n")
for _, q := range qs {
_, p := q.ans1744, q.para1744
fmt.Printf("【input】:%v 【output】:%v\n", p, canEat(p.candiesCount, p.queries))
}
fmt.Printf("\n\n\n")
}

View File

@ -0,0 +1,88 @@
# [1744. Can You Eat Your Favorite Candy on Your Favorite Day?](https://leetcode.com/problems/can-you-eat-your-favorite-candy-on-your-favorite-day/)
## 题目
You are given a **(0-indexed)** array of positive integers `candiesCount` where `candiesCount[i]` represents the number of candies of the `ith` type you have. You are also given a 2D array `queries` where `queries[i] = [favoriteTypei, favoriteDayi, dailyCapi]`.
You play a game with the following rules:
- You start eating candies on day **`0`**.
- You **cannot** eat **any** candy of type `i` unless you have eaten **all** candies of type `i - 1`.
- You must eat **at least** **one** candy per day until you have eaten all the candies.
Construct a boolean array `answer` such that `answer.length == queries.length` and `answer[i]` is `true` if you can eat a candy of type `favoriteTypei` on day `favoriteDayi` without eating **more than** `dailyCapi` candies on **any** day, and `false` otherwise. Note that you can eat different types of candy on the same day, provided that you follow rule 2.
Return *the constructed array* `answer`.
**Example 1:**
```
Input: candiesCount = [7,4,5,3,8], queries = [[0,2,2],[4,2,4],[2,13,1000000000]]
Output: [true,false,true]
Explanation:
1- If you eat 2 candies (type 0) on day 0 and 2 candies (type 0) on day 1, you will eat a candy of type 0 on day 2.
2- You can eat at most 4 candies each day.
If you eat 4 candies every day, you will eat 4 candies (type 0) on day 0 and 4 candies (type 0 and type 1) on day 1.
On day 2, you can only eat 4 candies (type 1 and type 2), so you cannot eat a candy of type 4 on day 2.
3- If you eat 1 candy each day, you will eat a candy of type 2 on day 13.
```
**Example 2:**
```
Input: candiesCount = [5,2,6,4,1], queries = [[3,1,2],[4,10,3],[3,10,100],[4,100,30],[1,3,1]]
Output: [false,true,true,false,false]
```
**Constraints:**
- `1 <= candiesCount.length <= 105`
- `1 <= candiesCount[i] <= 105`
- `1 <= queries.length <= 105`
- `queries[i].length == 3`
- `0 <= favoriteTypei < candiesCount.length`
- `0 <= favoriteDayi <= 109`
- `1 <= dailyCapi <= 109`
## 题目大意
给你一个下标从 0 开始的正整数数组 candiesCount 其中 candiesCount[i] 表示你拥有的第 i 类糖果的数目。同时给你一个二维数组 queries 其中 queries[i] = [favoriteTypei, favoriteDayi, dailyCapi] 。你按照如下规则进行一场游戏:
- 你从第 0 天开始吃糖果。
- 你在吃完 所有 第 i - 1 类糖果之前不能 吃任何一颗第 i 类糖果。
- 在吃完所有糖果之前,你必须每天 至少 吃 一颗 糖果。
请你构建一个布尔型数组 answer 满足 answer.length == queries.length 。answer[i]  true 的条件是在每天吃 不超过 dailyCapi 颗糖果的前提下你可以在第 favoriteDayi 天吃到第 favoriteTypei 类糖果否则 answer[i] 为 false 。注意只要满足上面 3 条规则中的第二条规则你就可以在同一天吃不同类型的糖果。请你返回得到的数组 answer 
## 解题思路
- 每天吃糖个数的下限是 1 颗,上限是 dailyCap。针对每一个 query 查询在第 i 天能否吃到 i 类型的糖果,要想吃到 i 类型的糖果,必须吃完 i-1 类型的糖果。意味着在 [favoriteDayi + 1, (favoriteDayi+1)×dailyCapi] 区间内能否包含一颗第 favoriteTypei 类型的糖果。如果能包含则输出 true不能包含则输出 false。吃的糖果数是累积的所以这里利用前缀和计算出累积吃糖果数所在区间 [sum[favoriteTypei1]+1, sum[favoriteTypei]]。最后判断 query 区间和累积吃糖果数的区间是否有重叠即可。如果重叠即输出 true。
- 判断两个区间是否重合,情况有好几种:内包含,全包含,半包含等等。没有交集的情况比较少,所以可以用排除法。对于区间 [x1, y1] 以及 [x2, y2],它们没有交集当且仅当 x1 > y2 或者 y1 < x2
## 代码
```go
package leetcode
func canEat(candiesCount []int, queries [][]int) []bool {
n := len(candiesCount)
prefixSum := make([]int, n)
prefixSum[0] = candiesCount[0]
for i := 1; i < n; i++ {
prefixSum[i] = prefixSum[i-1] + candiesCount[i]
}
res := make([]bool, len(queries))
for i, q := range queries {
favoriteType, favoriteDay, dailyCap := q[0], q[1], q[2]
x1 := favoriteDay + 1
y1 := (favoriteDay + 1) * dailyCap
x2 := 1
if favoriteType > 0 {
x2 = prefixSum[favoriteType-1] + 1
}
y2 := prefixSum[favoriteType]
res[i] = !(x1 > y2 || y1 < x2)
}
return res
}
```

View File

@ -56,5 +56,5 @@ func numTrees(n int) int {
----------------------------------------------
<div style="display: flex;justify-content: space-between;align-items: center;">
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/0001~0099/0095.Unique-Binary-Search-Trees-II/">⬅️上一页</a></p>
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/0001~0099/0098.Validate-Binary-Search-Tree/">下一页➡️</a></p>
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/0001~0099/0097.Interleaving-String/">下一页➡️</a></p>
</div>

View File

@ -0,0 +1,111 @@
# [97. Interleaving String](https://leetcode.com/problems/interleaving-string/)
## 题目
Given strings `s1`, `s2`, and `s3`, find whether `s3` is formed by an **interleaving** of `s1` and `s2`.
An **interleaving** of two strings `s` and `t` is a configuration where they are divided into **non-empty** substrings such that:
- `s = s1 + s2 + ... + sn`
- `t = t1 + t2 + ... + tm`
- `|n - m| <= 1`
- The **interleaving** is `s1 + t1 + s2 + t2 + s3 + t3 + ...` or `t1 + s1 + t2 + s2 + t3 + s3 + ...`
**Note:** `a + b` is the concatenation of strings `a` and `b`.
**Example 1:**
![https://assets.leetcode.com/uploads/2020/09/02/interleave.jpg](https://assets.leetcode.com/uploads/2020/09/02/interleave.jpg)
```
Input: s1 = "aabcc", s2 = "dbbca", s3 = "aadbbcbcac"
Output: true
```
**Example 2:**
```
Input: s1 = "aabcc", s2 = "dbbca", s3 = "aadbbbaccc"
Output: false
```
**Example 3:**
```
Input: s1 = "", s2 = "", s3 = ""
Output: true
```
**Constraints:**
- `0 <= s1.length, s2.length <= 100`
- `0 <= s3.length <= 200`
- `s1`, `s2`, and `s3` consist of lowercase English letters.
**Follow up:** Could you solve it using only `O(s2.length)` additional memory space?
## 题目大意
给定三个字符串 s1、s2、s3请你帮忙验证 s3 是否是由 s1  s2 交错 组成的。两个字符串 s 和 t 交错 的定义与过程如下,其中每个字符串都会被分割成若干 非空 子字符串:
- s = s1 + s2 + ... + sn
- t = t1 + t2 + ... + tm
- |n - m| <= 1
- 交错 是 s1 + t1 + s2 + t2 + s3 + t3 + ... 或者 t1 + s1 + t2 + s2 + t3 + s3 + ...
提示a + b 意味着字符串 a 和 b 连接。
## 解题思路
- 深搜或者广搜暴力解题。笔者用深搜实现的。记录 s1 和 s2 串当前比较的位置 p1 和 p2。如果 s3[p1+p2] 的位置上等于 s1[p1] 或者 s2[p2] 代表能匹配上,那么继续往后移动 p1 和 p2 相应的位置。因为是交错字符串,所以判断匹配的位置是 s3[p1+p2] 的位置。如果仅仅这么写会超时s1 和 s2 两个字符串重复交叉判断的位置太多了。需要加上记忆化搜索。可以用 visited[i][j] 这样的二维数组来记录是否搜索过了。笔者为了压缩空间,将 i 和 j 编码压缩到一维数组了。i * len(s3) + j 是唯一下标,所以可以用这种方式存储是否搜索过。具体代码见下面的实现。
## 代码
```go
package leetcode
func isInterleave(s1 string, s2 string, s3 string) bool {
if len(s1)+len(s2) != len(s3) {
return false
}
visited := make(map[int]bool)
return dfs(s1, s2, s3, 0, 0, visited)
}
func dfs(s1, s2, s3 string, p1, p2 int, visited map[int]bool) bool {
if p1+p2 == len(s3) {
return true
}
if _, ok := visited[(p1*len(s3))+p2]; ok {
return false
}
visited[(p1*len(s3))+p2] = true
var match1, match2 bool
if p1 < len(s1) && s3[p1+p2] == s1[p1] {
match1 = true
}
if p2 < len(s2) && s3[p1+p2] == s2[p2] {
match2 = true
}
if match1 && match2 {
return dfs(s1, s2, s3, p1+1, p2, visited) || dfs(s1, s2, s3, p1, p2+1, visited)
} else if match1 {
return dfs(s1, s2, s3, p1+1, p2, visited)
} else if match2 {
return dfs(s1, s2, s3, p1, p2+1, visited)
} else {
return false
}
}
```
----------------------------------------------
<div style="display: flex;justify-content: space-between;align-items: center;">
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/0001~0099/0096.Unique-Binary-Search-Trees/">⬅️上一页</a></p>
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/0001~0099/0098.Validate-Binary-Search-Tree/">下一页➡️</a></p>
</div>

View File

@ -101,6 +101,6 @@ func inOrder(root *TreeNode, arr *[]int) {
----------------------------------------------
<div style="display: flex;justify-content: space-between;align-items: center;">
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/0001~0099/0096.Unique-Binary-Search-Trees/">⬅️上一页</a></p>
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/0001~0099/0097.Interleaving-String/">⬅️上一页</a></p>
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/0001~0099/0099.Recover-Binary-Search-Tree/">下一页➡️</a></p>
</div>

View File

@ -96,5 +96,5 @@ func largestValues1(root *TreeNode) []int {
----------------------------------------------
<div style="display: flex;justify-content: space-between;align-items: center;">
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/0500~0599/0513.Find-Bottom-Left-Tree-Value/">⬅️上一页</a></p>
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/0500~0599/0524.Longest-Word-in-Dictionary-through-Deleting/">下一页➡️</a></p>
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/0500~0599/0523.Continuous-Subarray-Sum/">下一页➡️</a></p>
</div>

View File

@ -0,0 +1,82 @@
# [523. Continuous Subarray Sum](https://leetcode.com/problems/continuous-subarray-sum/)
## 题目
Given an integer array `nums` and an integer `k`, return `true` *if* `nums` *has a continuous subarray of size **at least two** whose elements sum up to a multiple of* `k`*, or* `false` *otherwise*.
An integer `x` is a multiple of `k` if there exists an integer `n` such that `x = n * k`. `0` is **always** a multiple of `k`.
**Example 1:**
```
Input: nums = [23,2,4,6,7], k = 6
Output: true
Explanation: [2, 4] is a continuous subarray of size 2 whose elements sum up to 6.
```
**Example 2:**
```
Input: nums = [23,2,6,4,7], k = 6
Output: true
Explanation: [23, 2, 6, 4, 7] is an continuous subarray of size 5 whose elements sum up to 42.
42 is a multiple of 6 because 42 = 7 * 6 and 7 is an integer.
```
**Example 3:**
```
Input: nums = [23,2,6,4,7], k = 13
Output: false
```
**Constraints:**
- `1 <= nums.length <= 105`
- `0 <= nums[i] <= 109`
- `0 <= sum(nums[i]) <= 231 - 1`
- `1 <= k <= 231 - 1`
## 题目大意
给你一个整数数组 nums 和一个整数 k ,编写一个函数来判断该数组是否含有同时满足下述条件的连续子数组:
- 子数组大小至少为 2 ,且
- 子数组元素总和为 k 的倍数。
如果存在,返回 true ;否则,返回 false 。如果存在一个整数 n ,令整数 x 符合 x = n * k ,则称 x 是 k 的一个倍数。
## 解题思路
- 简单题。题目只要求是否存在,不要求找出所有解。用一个变量 sum 记录累加和。子数组的元素和可以用前缀和相减得到,例如 [i,j] 区间内的元素和,可以由 prefixSum[j] - prefixSum[i] 得到。当 prefixSums[j]prefixSums[i] 为 k 的倍数时prefixSums[i] 和 prefixSums[j] 除以 k 的余数相同。因此只需要计算每个下标对应的前缀和除以 k 的余数即可,使用 map 存储每个余数第一次出现的下标即可。在 map 中如果存在相同余数的 key代表当前下标和 map 中这个 key 记录的下标可以满足总和为 k 的倍数这一条件。再判断一下能否满足大小至少为 2 的条件即可。用 2 个下标相减,长度大于等于 2 即满足条件,可以输出 true。
## 代码
```go
package leetcode
func checkSubarraySum(nums []int, k int) bool {
m := make(map[int]int)
m[0] = -1
sum := 0
for i, n := range nums {
sum += n
if r, ok := m[sum%k]; ok {
if i-2 >= r {
return true
}
} else {
m[sum%k] = i
}
}
return false
}
```
----------------------------------------------
<div style="display: flex;justify-content: space-between;align-items: center;">
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/0500~0599/0515.Find-Largest-Value-in-Each-Tree-Row/">⬅️上一页</a></p>
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/0500~0599/0524.Longest-Word-in-Dictionary-through-Deleting/">下一页➡️</a></p>
</div>

View File

@ -78,6 +78,6 @@ func findLongestWord(s string, d []string) string {
----------------------------------------------
<div style="display: flex;justify-content: space-between;align-items: center;">
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/0500~0599/0515.Find-Largest-Value-in-Each-Tree-Row/">⬅️上一页</a></p>
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/0500~0599/0526.Beautiful-Arrangement/">下一页➡️</a></p>
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/0500~0599/0523.Continuous-Subarray-Sum/">⬅️上一页</a></p>
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/0500~0599/0525.Contiguous-Array/">下一页➡️</a></p>
</div>

View File

@ -0,0 +1,74 @@
# [525. Contiguous Array](https://leetcode.com/problems/contiguous-array/)
## 题目
Given a binary array `nums`, return *the maximum length of a contiguous subarray with an equal number of* `0` *and* `1`.
**Example 1:**
```
Input: nums = [0,1]
Output: 2
Explanation: [0, 1] is the longest contiguous subarray with an equal number of 0 and 1.
```
**Example 2:**
```
Input: nums = [0,1,0]
Output: 2
Explanation: [0, 1] (or [1, 0]) is a longest contiguous subarray with equal number of 0 and 1.
```
**Constraints:**
- `1 <= nums.length <= 105`
- `nums[i]` is either `0` or `1`.
## 题目大意
给定一个二进制数组 nums , 找到含有相同数量的 0 和 1 的最长连续子数组,并返回该子数组的长度。
## 解题思路
- 0 和 1 的数量相同可以转化为两者数量相差为 0如果将 0 看作为 -1那么原题转化为求最长连续子数组其元素和为 0 。又变成了区间内求和的问题,自然而然转换为前缀和来处理。假设连续子数组是 [i,j] 区间,这个区间内元素和为 0 意味着 prefixSum[j] - prefixSum[i] = 0也就是 prefixSum[i] = prefixSum[j]。不断累加前缀和,将每个前缀和存入 map 中。一旦某个 key 存在了,代表之前某个下标的前缀和和当前下标构成的区间,这段区间内的元素和为 0 。这个区间是所求。扫完整个数组,扫描过程中动态更新最大区间长度,扫描完成便可得到最大区间长度,即最长连续子数组。
## 代码
```go
package leetcode
func findMaxLength(nums []int) int {
dict := map[int]int{}
dict[0] = -1
count, res := 0, 0
for i := 0; i < len(nums); i++ {
if nums[i] == 0 {
count--
} else {
count++
}
if idx, ok := dict[count]; ok {
res = max(res, i-idx)
} else {
dict[count] = i
}
}
return res
}
func max(a, b int) int {
if a > b {
return a
}
return b
}
```
----------------------------------------------
<div style="display: flex;justify-content: space-between;align-items: center;">
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/0500~0599/0524.Longest-Word-in-Dictionary-through-Deleting/">⬅️上一页</a></p>
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/0500~0599/0526.Beautiful-Arrangement/">下一页➡️</a></p>
</div>

View File

@ -112,6 +112,6 @@ func checkDivisible(num, d int) bool {
----------------------------------------------
<div style="display: flex;justify-content: space-between;align-items: center;">
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/0500~0599/0524.Longest-Word-in-Dictionary-through-Deleting/">⬅️上一页</a></p>
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/0500~0599/0525.Contiguous-Array/">⬅️上一页</a></p>
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/0500~0599/0528.Random-Pick-with-Weight/">下一页➡️</a></p>
</div>

View File

@ -69,5 +69,5 @@ func maxProduct(nums []int) int {
----------------------------------------------
<div style="display: flex;justify-content: space-between;align-items: center;">
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1400~1499/1463.Cherry-Pickup-II/">⬅️上一页</a></p>
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1400~1499/1470.Shuffle-the-Array/">下一页➡️</a></p>
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1400~1499/1465.Maximum-Area-of-a-Piece-of-Cake-After-Horizontal-and-Vertical-Cuts/">下一页➡️</a></p>
</div>

View File

@ -0,0 +1,96 @@
# [1465. Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts](https://leetcode.com/problems/maximum-area-of-a-piece-of-cake-after-horizontal-and-vertical-cuts/)
## 题目
Given a rectangular cake with height `h` and width `w`, and two arrays of integers `horizontalCuts` and `verticalCuts` where `horizontalCuts[i]` is the distance from the top of the rectangular cake to the `ith` horizontal cut and similarly, `verticalCuts[j]` is the distance from the left of the rectangular cake to the `jth` vertical cut.
*Return the maximum area of a piece of cake after you cut at each horizontal and vertical position provided in the arrays `horizontalCuts` and `verticalCuts`.* Since the answer can be a huge number, return this modulo 10^9 + 7.
**Example 1:**
![https://assets.leetcode.com/uploads/2020/05/14/leetcode_max_area_2.png](https://assets.leetcode.com/uploads/2020/05/14/leetcode_max_area_2.png)
```
Input: h = 5, w = 4, horizontalCuts = [1,2,4], verticalCuts = [1,3]
Output: 4
Explanation: The figure above represents the given rectangular cake. Red lines are the horizontal and vertical cuts. After you cut the cake, the green piece of cake has the maximum area.
```
**Example 2:**
![https://assets.leetcode.com/uploads/2020/05/14/leetcode_max_area_3.png](https://assets.leetcode.com/uploads/2020/05/14/leetcode_max_area_3.png)
```
Input: h = 5, w = 4, horizontalCuts = [3,1], verticalCuts = [1]
Output: 6
Explanation: The figure above represents the given rectangular cake. Red lines are the horizontal and vertical cuts. After you cut the cake, the green and yellow pieces of cake have the maximum area.
```
**Example 3:**
```
Input: h = 5, w = 4, horizontalCuts = [3], verticalCuts = [3]
Output: 9
```
**Constraints:**
- `2 <= h, w <= 10^9`
- `1 <= horizontalCuts.length < min(h, 10^5)`
- `1 <= verticalCuts.length < min(w, 10^5)`
- `1 <= horizontalCuts[i] < h`
- `1 <= verticalCuts[i] < w`
- It is guaranteed that all elements in `horizontalCuts` are distinct.
- It is guaranteed that all elements in `verticalCuts` are distinct.
## 题目大意
矩形蛋糕的高度为 h 且宽度为 w给你两个整数数组 horizontalCuts 和 verticalCuts其中 horizontalCuts[i] 是从矩形蛋糕顶部到第  i 个水平切口的距离,类似地, verticalCuts[j] 是从矩形蛋糕的左侧到第 j 个竖直切口的距离。请你按数组 horizontalCuts 和 verticalCuts 中提供的水平和竖直位置切割后,请你找出 面积最大 的那份蛋糕,并返回其 面积 。由于答案可能是一个很大的数字,因此需要将结果对 10^9 + 7 取余后返回。
## 解题思路
- 读完题比较容易想到解题思路。找到水平切口最大的差值和竖直切口最大的差值,这 4 条边构成的矩形即为最大矩形。不过有特殊情况需要判断,切口除了题目给的切口坐标以外,默认还有 4 个切口,即蛋糕原始的 4 条边。如下图二,最大的矩形其实在切口之外。所以找水平切口最大差值和竖直切口最大差值需要考虑到蛋糕原始的 4 条边。
![https://img.halfrost.com/Leetcode/leetcode_1465.png](https://img.halfrost.com/Leetcode/leetcode_1465.png)
## 代码
```go
package leetcode
import "sort"
func maxArea(h int, w int, hcuts []int, vcuts []int) int {
sort.Ints(hcuts)
sort.Ints(vcuts)
maxw, maxl := hcuts[0], vcuts[0]
for i, c := range hcuts[1:] {
if c-hcuts[i] > maxw {
maxw = c - hcuts[i]
}
}
if h-hcuts[len(hcuts)-1] > maxw {
maxw = h - hcuts[len(hcuts)-1]
}
for i, c := range vcuts[1:] {
if c-vcuts[i] > maxl {
maxl = c - vcuts[i]
}
}
if w-vcuts[len(vcuts)-1] > maxl {
maxl = w - vcuts[len(vcuts)-1]
}
return (maxw * maxl) % (1000000007)
}
```
----------------------------------------------
<div style="display: flex;justify-content: space-between;align-items: center;">
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1400~1499/1464.Maximum-Product-of-Two-Elements-in-an-Array/">⬅️上一页</a></p>
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1400~1499/1470.Shuffle-the-Array/">下一页➡️</a></p>
</div>

View File

@ -66,6 +66,6 @@ func shuffle(nums []int, n int) []int {
----------------------------------------------
<div style="display: flex;justify-content: space-between;align-items: center;">
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1400~1499/1464.Maximum-Product-of-Two-Elements-in-an-Array/">⬅️上一页</a></p>
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1400~1499/1465.Maximum-Area-of-a-Piece-of-Cake-After-Horizontal-and-Vertical-Cuts/">⬅️上一页</a></p>
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1400~1499/1480.Running-Sum-of-1d-Array/">下一页➡️</a></p>
</div>

View File

@ -84,5 +84,5 @@ func countBalls(lowLimit int, highLimit int) int {
----------------------------------------------
<div style="display: flex;justify-content: space-between;align-items: center;">
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1700~1799/1738.Find-Kth-Largest-XOR-Coordinate-Value/">⬅️上一页</a></p>
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1700~1799/1748.Sum-of-Unique-Elements/">下一页➡️</a></p>
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1700~1799/1744.Can-You-Eat-Your-Favorite-Candy-on-Your-Favorite-Day/">下一页➡️</a></p>
</div>

View File

@ -0,0 +1,95 @@
# [1744. Can You Eat Your Favorite Candy on Your Favorite Day?](https://leetcode.com/problems/can-you-eat-your-favorite-candy-on-your-favorite-day/)
## 题目
You are given a **(0-indexed)** array of positive integers `candiesCount` where `candiesCount[i]` represents the number of candies of the `ith` type you have. You are also given a 2D array `queries` where `queries[i] = [favoriteTypei, favoriteDayi, dailyCapi]`.
You play a game with the following rules:
- You start eating candies on day **`0`**.
- You **cannot** eat **any** candy of type `i` unless you have eaten **all** candies of type `i - 1`.
- You must eat **at least** **one** candy per day until you have eaten all the candies.
Construct a boolean array `answer` such that `answer.length == queries.length` and `answer[i]` is `true` if you can eat a candy of type `favoriteTypei` on day `favoriteDayi` without eating **more than** `dailyCapi` candies on **any** day, and `false` otherwise. Note that you can eat different types of candy on the same day, provided that you follow rule 2.
Return *the constructed array* `answer`.
**Example 1:**
```
Input: candiesCount = [7,4,5,3,8], queries = [[0,2,2],[4,2,4],[2,13,1000000000]]
Output: [true,false,true]
Explanation:
1- If you eat 2 candies (type 0) on day 0 and 2 candies (type 0) on day 1, you will eat a candy of type 0 on day 2.
2- You can eat at most 4 candies each day.
If you eat 4 candies every day, you will eat 4 candies (type 0) on day 0 and 4 candies (type 0 and type 1) on day 1.
On day 2, you can only eat 4 candies (type 1 and type 2), so you cannot eat a candy of type 4 on day 2.
3- If you eat 1 candy each day, you will eat a candy of type 2 on day 13.
```
**Example 2:**
```
Input: candiesCount = [5,2,6,4,1], queries = [[3,1,2],[4,10,3],[3,10,100],[4,100,30],[1,3,1]]
Output: [false,true,true,false,false]
```
**Constraints:**
- `1 <= candiesCount.length <= 105`
- `1 <= candiesCount[i] <= 105`
- `1 <= queries.length <= 105`
- `queries[i].length == 3`
- `0 <= favoriteTypei < candiesCount.length`
- `0 <= favoriteDayi <= 109`
- `1 <= dailyCapi <= 109`
## 题目大意
给你一个下标从 0 开始的正整数数组 candiesCount 其中 candiesCount[i] 表示你拥有的第 i 类糖果的数目。同时给你一个二维数组 queries 其中 queries[i] = [favoriteTypei, favoriteDayi, dailyCapi] 。你按照如下规则进行一场游戏:
- 你从第 0 天开始吃糖果。
- 你在吃完 所有 第 i - 1 类糖果之前不能 吃任何一颗第 i 类糖果。
- 在吃完所有糖果之前,你必须每天 至少 吃 一颗 糖果。
请你构建一个布尔型数组 answer 满足 answer.length == queries.length 。answer[i]  true 的条件是在每天吃 不超过 dailyCapi 颗糖果的前提下你可以在第 favoriteDayi 天吃到第 favoriteTypei 类糖果否则 answer[i] 为 false 。注意只要满足上面 3 条规则中的第二条规则你就可以在同一天吃不同类型的糖果。请你返回得到的数组 answer 
## 解题思路
- 每天吃糖个数的下限是 1 颗,上限是 dailyCap。针对每一个 query 查询在第 i 天能否吃到 i 类型的糖果,要想吃到 i 类型的糖果,必须吃完 i-1 类型的糖果。意味着在 [favoriteDayi + 1, (favoriteDayi+1)×dailyCapi] 区间内能否包含一颗第 favoriteTypei 类型的糖果。如果能包含则输出 true不能包含则输出 false。吃的糖果数是累积的所以这里利用前缀和计算出累积吃糖果数所在区间 [sum[favoriteTypei1]+1, sum[favoriteTypei]]。最后判断 query 区间和累积吃糖果数的区间是否有重叠即可。如果重叠即输出 true。
- 判断两个区间是否重合,情况有好几种:内包含,全包含,半包含等等。没有交集的情况比较少,所以可以用排除法。对于区间 [x1, y1] 以及 [x2, y2],它们没有交集当且仅当 x1 > y2 或者 y1 < x2
## 代码
```go
package leetcode
func canEat(candiesCount []int, queries [][]int) []bool {
n := len(candiesCount)
prefixSum := make([]int, n)
prefixSum[0] = candiesCount[0]
for i := 1; i < n; i++ {
prefixSum[i] = prefixSum[i-1] + candiesCount[i]
}
res := make([]bool, len(queries))
for i, q := range queries {
favoriteType, favoriteDay, dailyCap := q[0], q[1], q[2]
x1 := favoriteDay + 1
y1 := (favoriteDay + 1) * dailyCap
x2 := 1
if favoriteType > 0 {
x2 = prefixSum[favoriteType-1] + 1
}
y2 := prefixSum[favoriteType]
res[i] = !(x1 > y2 || y1 < x2)
}
return res
}
```
----------------------------------------------
<div style="display: flex;justify-content: space-between;align-items: center;">
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1700~1799/1742.Maximum-Number-of-Balls-in-a-Box/">⬅️上一页</a></p>
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1700~1799/1748.Sum-of-Unique-Elements/">下一页➡️</a></p>
</div>

View File

@ -69,6 +69,6 @@ func sumOfUnique(nums []int) int {
----------------------------------------------
<div style="display: flex;justify-content: space-between;align-items: center;">
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1700~1799/1742.Maximum-Number-of-Balls-in-a-Box/">⬅️上一页</a></p>
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1700~1799/1744.Can-You-Eat-Your-Favorite-Candy-on-Your-Favorite-Day/">⬅️上一页</a></p>
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1700~1799/1752.Check-if-Array-Is-Sorted-and-Rotated/">下一页➡️</a></p>
</div>

View File

@ -39,7 +39,7 @@ weight: 1
|0073|Set Matrix Zeroes|[Go]({{< relref "/ChapterFour/0001~0099/0073.Set-Matrix-Zeroes.md" >}})|Medium||||44.9%|
|0074|Search a 2D Matrix|[Go]({{< relref "/ChapterFour/0001~0099/0074.Search-a-2D-Matrix.md" >}})|Medium||||38.6%|
|0075|Sort Colors|[Go]({{< relref "/ChapterFour/0001~0099/0075.Sort-Colors.md" >}})|Medium| O(n)| O(1)|❤️|50.4%|
|0078|Subsets|[Go]({{< relref "/ChapterFour/0001~0099/0078.Subsets.md" >}})|Medium| O(n^2)| O(n)|❤️|66.3%|
|0078|Subsets|[Go]({{< relref "/ChapterFour/0001~0099/0078.Subsets.md" >}})|Medium| O(n^2)| O(n)|❤️|66.4%|
|0079|Word Search|[Go]({{< relref "/ChapterFour/0001~0099/0079.Word-Search.md" >}})|Medium| O(n^2)| O(n^2)|❤️|37.6%|
|0080|Remove Duplicates from Sorted Array II|[Go]({{< relref "/ChapterFour/0001~0099/0080.Remove-Duplicates-from-Sorted-Array-II.md" >}})|Medium| O(n)| O(1||46.7%|
|0081|Search in Rotated Sorted Array II|[Go]({{< relref "/ChapterFour/0001~0099/0081.Search-in-Rotated-Sorted-Array-II.md" >}})|Medium||||33.8%|
@ -51,7 +51,7 @@ weight: 1
|0118|Pascal's Triangle|[Go]({{< relref "/ChapterFour/0100~0199/0118.Pascals-Triangle.md" >}})|Easy||||56.3%|
|0119|Pascal's Triangle II|[Go]({{< relref "/ChapterFour/0100~0199/0119.Pascals-Triangle-II.md" >}})|Easy||||53.0%|
|0120|Triangle|[Go]({{< relref "/ChapterFour/0100~0199/0120.Triangle.md" >}})|Medium| O(n^2)| O(n)||47.2%|
|0121|Best Time to Buy and Sell Stock|[Go]({{< relref "/ChapterFour/0100~0199/0121.Best-Time-to-Buy-and-Sell-Stock.md" >}})|Easy| O(n)| O(1)||52.0%|
|0121|Best Time to Buy and Sell Stock|[Go]({{< relref "/ChapterFour/0100~0199/0121.Best-Time-to-Buy-and-Sell-Stock.md" >}})|Easy| O(n)| O(1)||52.1%|
|0122|Best Time to Buy and Sell Stock II|[Go]({{< relref "/ChapterFour/0100~0199/0122.Best-Time-to-Buy-and-Sell-Stock-II.md" >}})|Easy| O(n)| O(1)||59.2%|
|0126|Word Ladder II|[Go]({{< relref "/ChapterFour/0100~0199/0126.Word-Ladder-II.md" >}})|Hard| O(n)| O(n^2)|❤️|24.1%|
|0128|Longest Consecutive Sequence|[Go]({{< relref "/ChapterFour/0100~0199/0128.Longest-Consecutive-Sequence.md" >}})|Medium||||46.9%|
@ -105,7 +105,7 @@ weight: 1
|0870|Advantage Shuffle|[Go]({{< relref "/ChapterFour/0800~0899/0870.Advantage-Shuffle.md" >}})|Medium||||50.7%|
|0888|Fair Candy Swap|[Go]({{< relref "/ChapterFour/0800~0899/0888.Fair-Candy-Swap.md" >}})|Easy||||59.3%|
|0891|Sum of Subsequence Widths|[Go]({{< relref "/ChapterFour/0800~0899/0891.Sum-of-Subsequence-Widths.md" >}})|Hard| O(n log n)| O(1)||33.3%|
|0896|Monotonic Array|[Go]({{< relref "/ChapterFour/0800~0899/0896.Monotonic-Array.md" >}})|Easy||||57.9%|
|0896|Monotonic Array|[Go]({{< relref "/ChapterFour/0800~0899/0896.Monotonic-Array.md" >}})|Easy||||57.8%|
|0907|Sum of Subarray Minimums|[Go]({{< relref "/ChapterFour/0900~0999/0907.Sum-of-Subarray-Minimums.md" >}})|Medium| O(n)| O(n)|❤️|33.0%|
|0914|X of a Kind in a Deck of Cards|[Go]({{< relref "/ChapterFour/0900~0999/0914.X-of-a-Kind-in-a-Deck-of-Cards.md" >}})|Easy||||33.7%|
|0918|Maximum Sum Circular Subarray|[Go]({{< relref "/ChapterFour/0900~0999/0918.Maximum-Sum-Circular-Subarray.md" >}})|Medium||||34.5%|
@ -116,11 +116,11 @@ weight: 1
|0985|Sum of Even Numbers After Queries|[Go]({{< relref "/ChapterFour/0900~0999/0985.Sum-of-Even-Numbers-After-Queries.md" >}})|Easy||||60.5%|
|0989|Add to Array-Form of Integer|[Go]({{< relref "/ChapterFour/0900~0999/0989.Add-to-Array-Form-of-Integer.md" >}})|Easy||||44.9%|
|0999|Available Captures for Rook|[Go]({{< relref "/ChapterFour/0900~0999/0999.Available-Captures-for-Rook.md" >}})|Easy||||67.7%|
|1002|Find Common Characters|[Go]({{< relref "/ChapterFour/1000~1099/1002.Find-Common-Characters.md" >}})|Easy||||68.7%|
|1002|Find Common Characters|[Go]({{< relref "/ChapterFour/1000~1099/1002.Find-Common-Characters.md" >}})|Easy||||68.8%|
|1011|Capacity To Ship Packages Within D Days|[Go]({{< relref "/ChapterFour/1000~1099/1011.Capacity-To-Ship-Packages-Within-D-Days.md" >}})|Medium||||60.3%|
|1018|Binary Prefix Divisible By 5|[Go]({{< relref "/ChapterFour/1000~1099/1018.Binary-Prefix-Divisible-By-5.md" >}})|Easy||||47.6%|
|1040|Moving Stones Until Consecutive II|[Go]({{< relref "/ChapterFour/1000~1099/1040.Moving-Stones-Until-Consecutive-II.md" >}})|Medium||||54.6%|
|1051|Height Checker|[Go]({{< relref "/ChapterFour/1000~1099/1051.Height-Checker.md" >}})|Easy||||72.8%|
|1051|Height Checker|[Go]({{< relref "/ChapterFour/1000~1099/1051.Height-Checker.md" >}})|Easy||||72.9%|
|1052|Grumpy Bookstore Owner|[Go]({{< relref "/ChapterFour/1000~1099/1052.Grumpy-Bookstore-Owner.md" >}})|Medium||||56.1%|
|1074|Number of Submatrices That Sum to Target|[Go]({{< relref "/ChapterFour/1000~1099/1074.Number-of-Submatrices-That-Sum-to-Target.md" >}})|Hard||||65.1%|
|1089|Duplicate Zeros|[Go]({{< relref "/ChapterFour/1000~1099/1089.Duplicate-Zeros.md" >}})|Easy||||51.5%|
@ -138,7 +138,7 @@ weight: 1
|1232|Check If It Is a Straight Line|[Go]({{< relref "/ChapterFour/1200~1299/1232.Check-If-It-Is-a-Straight-Line.md" >}})|Easy||||42.9%|
|1252|Cells with Odd Values in a Matrix|[Go]({{< relref "/ChapterFour/1200~1299/1252.Cells-with-Odd-Values-in-a-Matrix.md" >}})|Easy||||78.5%|
|1260|Shift 2D Grid|[Go]({{< relref "/ChapterFour/1200~1299/1260.Shift-2D-Grid.md" >}})|Easy||||61.8%|
|1266|Minimum Time Visiting All Points|[Go]({{< relref "/ChapterFour/1200~1299/1266.Minimum-Time-Visiting-All-Points.md" >}})|Easy||||79.3%|
|1266|Minimum Time Visiting All Points|[Go]({{< relref "/ChapterFour/1200~1299/1266.Minimum-Time-Visiting-All-Points.md" >}})|Easy||||79.2%|
|1275|Find Winner on a Tic Tac Toe Game|[Go]({{< relref "/ChapterFour/1200~1299/1275.Find-Winner-on-a-Tic-Tac-Toe-Game.md" >}})|Easy||||52.9%|
|1287|Element Appearing More Than 25% In Sorted Array|[Go]({{< relref "/ChapterFour/1200~1299/1287.Element-Appearing-More-Than-25-In-Sorted-Array.md" >}})|Easy||||60.1%|
|1295|Find Numbers with Even Number of Digits|[Go]({{< relref "/ChapterFour/1200~1299/1295.Find-Numbers-with-Even-Number-of-Digits.md" >}})|Easy||||78.4%|
@ -156,14 +156,15 @@ weight: 1
|1438|Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit|[Go]({{< relref "/ChapterFour/1400~1499/1438.Longest-Continuous-Subarray-With-Absolute-Diff-Less-Than-or-Equal-to-Limit.md" >}})|Medium||||44.7%|
|1442|Count Triplets That Can Form Two Arrays of Equal XOR|[Go]({{< relref "/ChapterFour/1400~1499/1442.Count-Triplets-That-Can-Form-Two-Arrays-of-Equal-XOR.md" >}})|Medium||||72.6%|
|1464|Maximum Product of Two Elements in an Array|[Go]({{< relref "/ChapterFour/1400~1499/1464.Maximum-Product-of-Two-Elements-in-an-Array.md" >}})|Easy||||77.0%|
|1465|Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts|[Go]({{< relref "/ChapterFour/1400~1499/1465.Maximum-Area-of-a-Piece-of-Cake-After-Horizontal-and-Vertical-Cuts.md" >}})|Medium||||37.0%|
|1470|Shuffle the Array|[Go]({{< relref "/ChapterFour/1400~1499/1470.Shuffle-the-Array.md" >}})|Easy||||88.1%|
|1480|Running Sum of 1d Array|[Go]({{< relref "/ChapterFour/1400~1499/1480.Running-Sum-of-1d-Array.md" >}})|Easy||||88.9%|
|1480|Running Sum of 1d Array|[Go]({{< relref "/ChapterFour/1400~1499/1480.Running-Sum-of-1d-Array.md" >}})|Easy||||88.8%|
|1482|Minimum Number of Days to Make m Bouquets|[Go]({{< relref "/ChapterFour/1400~1499/1482.Minimum-Number-of-Days-to-Make-m-Bouquets.md" >}})|Medium||||51.8%|
|1486|XOR Operation in an Array|[Go]({{< relref "/ChapterFour/1400~1499/1486.XOR-Operation-in-an-Array.md" >}})|Easy||||83.9%|
|1512|Number of Good Pairs|[Go]({{< relref "/ChapterFour/1500~1599/1512.Number-of-Good-Pairs.md" >}})|Easy||||87.6%|
|1539|Kth Missing Positive Number|[Go]({{< relref "/ChapterFour/1500~1599/1539.Kth-Missing-Positive-Number.md" >}})|Easy||||54.7%|
|1572|Matrix Diagonal Sum|[Go]({{< relref "/ChapterFour/1500~1599/1572.Matrix-Diagonal-Sum.md" >}})|Easy||||77.9%|
|1608|Special Array With X Elements Greater Than or Equal X|[Go]({{< relref "/ChapterFour/1600~1699/1608.Special-Array-With-X-Elements-Greater-Than-or-Equal-X.md" >}})|Easy||||61.4%|
|1608|Special Array With X Elements Greater Than or Equal X|[Go]({{< relref "/ChapterFour/1600~1699/1608.Special-Array-With-X-Elements-Greater-Than-or-Equal-X.md" >}})|Easy||||61.3%|
|1619|Mean of Array After Removing Some Elements|[Go]({{< relref "/ChapterFour/1600~1699/1619.Mean-of-Array-After-Removing-Some-Elements.md" >}})|Easy||||64.5%|
|1629|Slowest Key|[Go]({{< relref "/ChapterFour/1600~1699/1629.Slowest-Key.md" >}})|Easy||||59.0%|
|1636|Sort Array by Increasing Frequency|[Go]({{< relref "/ChapterFour/1600~1699/1636.Sort-Array-by-Increasing-Frequency.md" >}})|Easy||||67.1%|
@ -177,7 +178,7 @@ weight: 1
|1738|Find Kth Largest XOR Coordinate Value|[Go]({{< relref "/ChapterFour/1700~1799/1738.Find-Kth-Largest-XOR-Coordinate-Value.md" >}})|Medium||||62.9%|
|1742|Maximum Number of Balls in a Box|[Go]({{< relref "/ChapterFour/1700~1799/1742.Maximum-Number-of-Balls-in-a-Box.md" >}})|Easy||||73.2%|
|1748|Sum of Unique Elements|[Go]({{< relref "/ChapterFour/1700~1799/1748.Sum-of-Unique-Elements.md" >}})|Easy||||74.7%|
|1752|Check if Array Is Sorted and Rotated|[Go]({{< relref "/ChapterFour/1700~1799/1752.Check-if-Array-Is-Sorted-and-Rotated.md" >}})|Easy||||44.4%|
|1752|Check if Array Is Sorted and Rotated|[Go]({{< relref "/ChapterFour/1700~1799/1752.Check-if-Array-Is-Sorted-and-Rotated.md" >}})|Easy||||44.3%|
|1758|Minimum Changes To Make Alternating Binary String|[Go]({{< relref "/ChapterFour/1700~1799/1758.Minimum-Changes-To-Make-Alternating-Binary-String.md" >}})|Easy||||58.1%|
|------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------|

View File

@ -111,7 +111,7 @@ func updateMatrix_BFS(matrix [][]int) [][]int {
|0052|N-Queens II|[Go]({{< relref "/ChapterFour/0001~0099/0052.N-Queens-II.md" >}})|Hard| O(n!)| O(n)|❤️|62.5%|
|0060|Permutation Sequence|[Go]({{< relref "/ChapterFour/0001~0099/0060.Permutation-Sequence.md" >}})|Hard| O(n log n)| O(1)||39.9%|
|0077|Combinations|[Go]({{< relref "/ChapterFour/0001~0099/0077.Combinations.md" >}})|Medium| O(n)| O(n)|❤️|58.7%|
|0078|Subsets|[Go]({{< relref "/ChapterFour/0001~0099/0078.Subsets.md" >}})|Medium| O(n^2)| O(n)|❤️|66.3%|
|0078|Subsets|[Go]({{< relref "/ChapterFour/0001~0099/0078.Subsets.md" >}})|Medium| O(n^2)| O(n)|❤️|66.4%|
|0079|Word Search|[Go]({{< relref "/ChapterFour/0001~0099/0079.Word-Search.md" >}})|Medium| O(n^2)| O(n^2)|❤️|37.6%|
|0089|Gray Code|[Go]({{< relref "/ChapterFour/0001~0099/0089.Gray-Code.md" >}})|Medium| O(n)| O(1)||51.1%|
|0090|Subsets II|[Go]({{< relref "/ChapterFour/0001~0099/0090.Subsets-II.md" >}})|Medium| O(n^2)| O(n)|❤️|49.6%|
@ -123,10 +123,10 @@ func updateMatrix_BFS(matrix [][]int) [][]int {
|0216|Combination Sum III|[Go]({{< relref "/ChapterFour/0200~0299/0216.Combination-Sum-III.md" >}})|Medium| O(n)| O(1)|❤️|61.1%|
|0306|Additive Number|[Go]({{< relref "/ChapterFour/0300~0399/0306.Additive-Number.md" >}})|Medium| O(n^2)| O(1)|❤️|29.9%|
|0357|Count Numbers with Unique Digits|[Go]({{< relref "/ChapterFour/0300~0399/0357.Count-Numbers-with-Unique-Digits.md" >}})|Medium| O(1)| O(1)||49.2%|
|0401|Binary Watch|[Go]({{< relref "/ChapterFour/0400~0499/0401.Binary-Watch.md" >}})|Easy| O(1)| O(1)||48.8%|
|0401|Binary Watch|[Go]({{< relref "/ChapterFour/0400~0499/0401.Binary-Watch.md" >}})|Easy| O(1)| O(1)||48.9%|
|0526|Beautiful Arrangement|[Go]({{< relref "/ChapterFour/0500~0599/0526.Beautiful-Arrangement.md" >}})|Medium| O(n^2)| O(1)|❤️|62.3%|
|0784|Letter Case Permutation|[Go]({{< relref "/ChapterFour/0700~0799/0784.Letter-Case-Permutation.md" >}})|Medium| O(n)| O(n)||69.1%|
|0842|Split Array into Fibonacci Sequence|[Go]({{< relref "/ChapterFour/0800~0899/0842.Split-Array-into-Fibonacci-Sequence.md" >}})|Medium| O(n^2)| O(1)|❤️|37.0%|
|0842|Split Array into Fibonacci Sequence|[Go]({{< relref "/ChapterFour/0800~0899/0842.Split-Array-into-Fibonacci-Sequence.md" >}})|Medium| O(n^2)| O(1)|❤️|37.1%|
|0980|Unique Paths III|[Go]({{< relref "/ChapterFour/0900~0999/0980.Unique-Paths-III.md" >}})|Hard| O(n log n)| O(n)||77.1%|
|0996|Number of Squareful Arrays|[Go]({{< relref "/ChapterFour/0900~0999/0996.Number-of-Squareful-Arrays.md" >}})|Hard| O(n log n)| O(n) ||48.6%|
|1079|Letter Tile Possibilities|[Go]({{< relref "/ChapterFour/1000~1099/1079.Letter-Tile-Possibilities.md" >}})|Medium| O(n^2)| O(1)|❤️|76.1%|

View File

@ -44,7 +44,7 @@ X & ~X = 0
| No. | Title | Solution | Difficulty | TimeComplexity | SpaceComplexity |Favorite| Acceptance |
|:--------:|:------- | :--------: | :----------: | :----: | :-----: | :-----: |:-----: |
|0078|Subsets|[Go]({{< relref "/ChapterFour/0001~0099/0078.Subsets.md" >}})|Medium| O(n^2)| O(n)|❤️|66.3%|
|0078|Subsets|[Go]({{< relref "/ChapterFour/0001~0099/0078.Subsets.md" >}})|Medium| O(n^2)| O(n)|❤️|66.4%|
|0136|Single Number|[Go]({{< relref "/ChapterFour/0100~0199/0136.Single-Number.md" >}})|Easy| O(n)| O(1)||67.0%|
|0137|Single Number II|[Go]({{< relref "/ChapterFour/0100~0199/0137.Single-Number-II.md" >}})|Medium| O(n)| O(1)|❤️|54.5%|
|0169|Majority Element|[Go]({{< relref "/ChapterFour/0100~0199/0169.Majority-Element.md" >}})|Easy| O(n)| O(1)|❤️|60.5%|
@ -62,9 +62,9 @@ X & ~X = 0
|0389|Find the Difference|[Go]({{< relref "/ChapterFour/0300~0399/0389.Find-the-Difference.md" >}})|Easy| O(n)| O(1)||58.1%|
|0393|UTF-8 Validation|[Go]({{< relref "/ChapterFour/0300~0399/0393.UTF-8-Validation.md" >}})|Medium| O(n)| O(1)||38.4%|
|0397|Integer Replacement|[Go]({{< relref "/ChapterFour/0300~0399/0397.Integer-Replacement.md" >}})|Medium| O(n)| O(1)||33.6%|
|0401|Binary Watch|[Go]({{< relref "/ChapterFour/0400~0499/0401.Binary-Watch.md" >}})|Easy| O(1)| O(1)||48.8%|
|0401|Binary Watch|[Go]({{< relref "/ChapterFour/0400~0499/0401.Binary-Watch.md" >}})|Easy| O(1)| O(1)||48.9%|
|0405|Convert a Number to Hexadecimal|[Go]({{< relref "/ChapterFour/0400~0499/0405.Convert-a-Number-to-Hexadecimal.md" >}})|Easy| O(n)| O(1)||44.8%|
|0421|Maximum XOR of Two Numbers in an Array|[Go]({{< relref "/ChapterFour/0400~0499/0421.Maximum-XOR-of-Two-Numbers-in-an-Array.md" >}})|Medium| O(n)| O(1)|❤️|54.6%|
|0421|Maximum XOR of Two Numbers in an Array|[Go]({{< relref "/ChapterFour/0400~0499/0421.Maximum-XOR-of-Two-Numbers-in-an-Array.md" >}})|Medium| O(n)| O(1)|❤️|54.7%|
|0461|Hamming Distance|[Go]({{< relref "/ChapterFour/0400~0499/0461.Hamming-Distance.md" >}})|Easy| O(n)| O(1)||73.4%|
|0476|Number Complement|[Go]({{< relref "/ChapterFour/0400~0499/0476.Number-Complement.md" >}})|Easy| O(n)| O(1)||65.2%|
|0477|Total Hamming Distance|[Go]({{< relref "/ChapterFour/0400~0499/0477.Total-Hamming-Distance.md" >}})|Medium| O(n)| O(1)||50.9%|
@ -80,7 +80,7 @@ X & ~X = 0
|1461|Check If a String Contains All Binary Codes of Size K|[Go]({{< relref "/ChapterFour/1400~1499/1461.Check-If-a-String-Contains-All-Binary-Codes-of-Size-K.md" >}})|Medium||||54.2%|
|1486|XOR Operation in an Array|[Go]({{< relref "/ChapterFour/1400~1499/1486.XOR-Operation-in-an-Array.md" >}})|Easy||||83.9%|
|1720|Decode XORed Array|[Go]({{< relref "/ChapterFour/1700~1799/1720.Decode-XORed-Array.md" >}})|Easy||||85.4%|
|1734|Decode XORed Permutation|[Go]({{< relref "/ChapterFour/1700~1799/1734.Decode-XORed-Permutation.md" >}})|Medium||||56.1%|
|1734|Decode XORed Permutation|[Go]({{< relref "/ChapterFour/1700~1799/1734.Decode-XORed-Permutation.md" >}})|Medium||||56.2%|
|------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------|

View File

@ -30,7 +30,7 @@ weight: 10
|0785|Is Graph Bipartite?|[Go]({{< relref "/ChapterFour/0700~0799/0785.Is-Graph-Bipartite.md" >}})|Medium||||49.0%|
|0815|Bus Routes|[Go]({{< relref "/ChapterFour/0800~0899/0815.Bus-Routes.md" >}})|Hard||||43.7%|
|0863|All Nodes Distance K in Binary Tree|[Go]({{< relref "/ChapterFour/0800~0899/0863.All-Nodes-Distance-K-in-Binary-Tree.md" >}})|Medium||||58.5%|
|0864|Shortest Path to Get All Keys|[Go]({{< relref "/ChapterFour/0800~0899/0864.Shortest-Path-to-Get-All-Keys.md" >}})|Hard||||42.8%|
|0864|Shortest Path to Get All Keys|[Go]({{< relref "/ChapterFour/0800~0899/0864.Shortest-Path-to-Get-All-Keys.md" >}})|Hard||||42.9%|
|0987|Vertical Order Traversal of a Binary Tree|[Go]({{< relref "/ChapterFour/0900~0999/0987.Vertical-Order-Traversal-of-a-Binary-Tree.md" >}})|Hard||||39.2%|
|0993|Cousins in Binary Tree|[Go]({{< relref "/ChapterFour/0900~0999/0993.Cousins-in-Binary-Tree.md" >}})|Easy| O(n)| O(1)||52.4%|
|1091|Shortest Path in Binary Matrix|[Go]({{< relref "/ChapterFour/1000~1099/1091.Shortest-Path-in-Binary-Matrix.md" >}})|Medium||||40.5%|

View File

@ -71,7 +71,7 @@ weight: 9
|0928|Minimize Malware Spread II|[Go]({{< relref "/ChapterFour/0900~0999/0928.Minimize-Malware-Spread-II.md" >}})|Hard||||41.6%|
|0938|Range Sum of BST|[Go]({{< relref "/ChapterFour/0900~0999/0938.Range-Sum-of-BST.md" >}})|Easy||||83.4%|
|0947|Most Stones Removed with Same Row or Column|[Go]({{< relref "/ChapterFour/0900~0999/0947.Most-Stones-Removed-with-Same-Row-or-Column.md" >}})|Medium||||55.8%|
|0959|Regions Cut By Slashes|[Go]({{< relref "/ChapterFour/0900~0999/0959.Regions-Cut-By-Slashes.md" >}})|Medium||||67.4%|
|0959|Regions Cut By Slashes|[Go]({{< relref "/ChapterFour/0900~0999/0959.Regions-Cut-By-Slashes.md" >}})|Medium||||67.5%|
|0968|Binary Tree Cameras|[Go]({{< relref "/ChapterFour/0900~0999/0968.Binary-Tree-Cameras.md" >}})|Hard||||40.5%|
|0971|Flip Binary Tree To Match Preorder Traversal|[Go]({{< relref "/ChapterFour/0900~0999/0971.Flip-Binary-Tree-To-Match-Preorder-Traversal.md" >}})|Medium||||49.9%|
|0979|Distribute Coins in Binary Tree|[Go]({{< relref "/ChapterFour/0900~0999/0979.Distribute-Coins-in-Binary-Tree.md" >}})|Medium||||70.1%|
@ -84,8 +84,8 @@ weight: 9
|1110|Delete Nodes And Return Forest|[Go]({{< relref "/ChapterFour/1100~1199/1110.Delete-Nodes-And-Return-Forest.md" >}})|Medium||||68.1%|
|1123|Lowest Common Ancestor of Deepest Leaves|[Go]({{< relref "/ChapterFour/1100~1199/1123.Lowest-Common-Ancestor-of-Deepest-Leaves.md" >}})|Medium||||68.4%|
|1145|Binary Tree Coloring Game|[Go]({{< relref "/ChapterFour/1100~1199/1145.Binary-Tree-Coloring-Game.md" >}})|Medium||||51.2%|
|1203|Sort Items by Groups Respecting Dependencies|[Go]({{< relref "/ChapterFour/1200~1299/1203.Sort-Items-by-Groups-Respecting-Dependencies.md" >}})|Hard||||48.4%|
|1254|Number of Closed Islands|[Go]({{< relref "/ChapterFour/1200~1299/1254.Number-of-Closed-Islands.md" >}})|Medium||||62.0%|
|1203|Sort Items by Groups Respecting Dependencies|[Go]({{< relref "/ChapterFour/1200~1299/1203.Sort-Items-by-Groups-Respecting-Dependencies.md" >}})|Hard||||48.3%|
|1254|Number of Closed Islands|[Go]({{< relref "/ChapterFour/1200~1299/1254.Number-of-Closed-Islands.md" >}})|Medium||||62.1%|
|1302|Deepest Leaves Sum|[Go]({{< relref "/ChapterFour/1300~1399/1302.Deepest-Leaves-Sum.md" >}})|Medium||||85.4%|
|1306|Jump Game III|[Go]({{< relref "/ChapterFour/1300~1399/1306.Jump-Game-III.md" >}})|Medium||||61.8%|
|1319|Number of Operations to Make Network Connected|[Go]({{< relref "/ChapterFour/1300~1399/1319.Number-of-Operations-to-Make-Network-Connected.md" >}})|Medium||||55.5%|

View File

@ -20,9 +20,10 @@ weight: 7
|0091|Decode Ways|[Go]({{< relref "/ChapterFour/0001~0099/0091.Decode-Ways.md" >}})|Medium| O(n)| O(n)||27.3%|
|0095|Unique Binary Search Trees II|[Go]({{< relref "/ChapterFour/0001~0099/0095.Unique-Binary-Search-Trees-II.md" >}})|Medium||||43.6%|
|0096|Unique Binary Search Trees|[Go]({{< relref "/ChapterFour/0001~0099/0096.Unique-Binary-Search-Trees.md" >}})|Medium| O(n)| O(n)||55.0%|
|0097|Interleaving String|[Go]({{< relref "/ChapterFour/0001~0099/0097.Interleaving-String.md" >}})|Medium||||33.7%|
|0115|Distinct Subsequences|[Go]({{< relref "/ChapterFour/0100~0199/0115.Distinct-Subsequences.md" >}})|Hard||||40.3%|
|0120|Triangle|[Go]({{< relref "/ChapterFour/0100~0199/0120.Triangle.md" >}})|Medium| O(n^2)| O(n)||47.2%|
|0121|Best Time to Buy and Sell Stock|[Go]({{< relref "/ChapterFour/0100~0199/0121.Best-Time-to-Buy-and-Sell-Stock.md" >}})|Easy| O(n)| O(1)||52.0%|
|0121|Best Time to Buy and Sell Stock|[Go]({{< relref "/ChapterFour/0100~0199/0121.Best-Time-to-Buy-and-Sell-Stock.md" >}})|Easy| O(n)| O(1)||52.1%|
|0131|Palindrome Partitioning|[Go]({{< relref "/ChapterFour/0100~0199/0131.Palindrome-Partitioning.md" >}})|Medium||||53.4%|
|0152|Maximum Product Subarray|[Go]({{< relref "/ChapterFour/0100~0199/0152.Maximum-Product-Subarray.md" >}})|Medium| O(n)| O(1)||33.0%|
|0174|Dungeon Game|[Go]({{< relref "/ChapterFour/0100~0199/0174.Dungeon-Game.md" >}})|Hard||||33.6%|
@ -48,6 +49,7 @@ weight: 7
|0416|Partition Equal Subset Sum|[Go]({{< relref "/ChapterFour/0400~0499/0416.Partition-Equal-Subset-Sum.md" >}})|Medium| O(n^2)| O(n)||45.2%|
|0474|Ones and Zeroes|[Go]({{< relref "/ChapterFour/0400~0499/0474.Ones-and-Zeroes.md" >}})|Medium||||43.4%|
|0494|Target Sum|[Go]({{< relref "/ChapterFour/0400~0499/0494.Target-Sum.md" >}})|Medium||||45.6%|
|0523|Continuous Subarray Sum|[Go]({{< relref "/ChapterFour/0500~0599/0523.Continuous-Subarray-Sum.md" >}})|Medium||||25.2%|
|0638|Shopping Offers|[Go]({{< relref "/ChapterFour/0600~0699/0638.Shopping-Offers.md" >}})|Medium||||53.6%|
|0647|Palindromic Substrings|[Go]({{< relref "/ChapterFour/0600~0699/0647.Palindromic-Substrings.md" >}})|Medium||||62.9%|
|0714|Best Time to Buy and Sell Stock with Transaction Fee|[Go]({{< relref "/ChapterFour/0700~0799/0714.Best-Time-to-Buy-and-Sell-Stock-with-Transaction-Fee.md" >}})|Medium| O(n)| O(1)||58.4%|

View File

@ -32,7 +32,7 @@ weight: 13
|0347|Top K Frequent Elements|[Go]({{< relref "/ChapterFour/0300~0399/0347.Top-K-Frequent-Elements.md" >}})|Medium| O(n)| O(n) ||62.9%|
|0349|Intersection of Two Arrays|[Go]({{< relref "/ChapterFour/0300~0399/0349.Intersection-of-Two-Arrays.md" >}})|Easy| O(n)| O(n) ||65.9%|
|0350|Intersection of Two Arrays II|[Go]({{< relref "/ChapterFour/0300~0399/0350.Intersection-of-Two-Arrays-II.md" >}})|Easy| O(n)| O(n) ||52.4%|
|0387|First Unique Character in a String|[Go]({{< relref "/ChapterFour/0300~0399/0387.First-Unique-Character-in-a-String.md" >}})|Easy||||54.3%|
|0387|First Unique Character in a String|[Go]({{< relref "/ChapterFour/0300~0399/0387.First-Unique-Character-in-a-String.md" >}})|Easy||||54.4%|
|0389|Find the Difference|[Go]({{< relref "/ChapterFour/0300~0399/0389.Find-the-Difference.md" >}})|Easy||||58.1%|
|0409|Longest Palindrome|[Go]({{< relref "/ChapterFour/0400~0499/0409.Longest-Palindrome.md" >}})|Easy||||52.4%|
|0438|Find All Anagrams in a String|[Go]({{< relref "/ChapterFour/0400~0499/0438.Find-All-Anagrams-in-a-String.md" >}})|Medium| O(n)| O(1) ||45.5%|
@ -42,6 +42,7 @@ weight: 13
|0463|Island Perimeter|[Go]({{< relref "/ChapterFour/0400~0499/0463.Island-Perimeter.md" >}})|Easy||||67.1%|
|0500|Keyboard Row|[Go]({{< relref "/ChapterFour/0500~0599/0500.Keyboard-Row.md" >}})|Easy||||66.2%|
|0508|Most Frequent Subtree Sum|[Go]({{< relref "/ChapterFour/0500~0599/0508.Most-Frequent-Subtree-Sum.md" >}})|Medium||||59.7%|
|0525|Contiguous Array|[Go]({{< relref "/ChapterFour/0500~0599/0525.Contiguous-Array.md" >}})|Medium||||43.8%|
|0535|Encode and Decode TinyURL|[Go]({{< relref "/ChapterFour/0500~0599/0535.Encode-and-Decode-TinyURL.md" >}})|Medium||||82.6%|
|0554|Brick Wall|[Go]({{< relref "/ChapterFour/0500~0599/0554.Brick-Wall.md" >}})|Medium||||51.7%|
|0575|Distribute Candies|[Go]({{< relref "/ChapterFour/0500~0599/0575.Distribute-Candies.md" >}})|Easy||||64.5%|
@ -53,7 +54,7 @@ weight: 13
|0648|Replace Words|[Go]({{< relref "/ChapterFour/0600~0699/0648.Replace-Words.md" >}})|Medium| O(n)| O(n) ||59.6%|
|0676|Implement Magic Dictionary|[Go]({{< relref "/ChapterFour/0600~0699/0676.Implement-Magic-Dictionary.md" >}})|Medium| O(n)| O(n) ||55.5%|
|0690|Employee Importance|[Go]({{< relref "/ChapterFour/0600~0699/0690.Employee-Importance.md" >}})|Easy||||59.4%|
|0692|Top K Frequent Words|[Go]({{< relref "/ChapterFour/0600~0699/0692.Top-K-Frequent-Words.md" >}})|Medium||||53.4%|
|0692|Top K Frequent Words|[Go]({{< relref "/ChapterFour/0600~0699/0692.Top-K-Frequent-Words.md" >}})|Medium||||53.5%|
|0705|Design HashSet|[Go]({{< relref "/ChapterFour/0700~0799/0705.Design-HashSet.md" >}})|Easy||||64.3%|
|0706|Design HashMap|[Go]({{< relref "/ChapterFour/0700~0799/0706.Design-HashMap.md" >}})|Easy||||64.0%|
|0710|Random Pick with Blacklist|[Go]({{< relref "/ChapterFour/0700~0799/0710.Random-Pick-with-Blacklist.md" >}})|Hard| O(n)| O(n) ||33.2%|
@ -75,7 +76,7 @@ weight: 13
|0981|Time Based Key-Value Store|[Go]({{< relref "/ChapterFour/0900~0999/0981.Time-Based-Key-Value-Store.md" >}})|Medium||||54.5%|
|0987|Vertical Order Traversal of a Binary Tree|[Go]({{< relref "/ChapterFour/0900~0999/0987.Vertical-Order-Traversal-of-a-Binary-Tree.md" >}})|Hard||||39.2%|
|0992|Subarrays with K Different Integers|[Go]({{< relref "/ChapterFour/0900~0999/0992.Subarrays-with-K-Different-Integers.md" >}})|Hard| O(n)| O(n) |❤️|51.4%|
|1002|Find Common Characters|[Go]({{< relref "/ChapterFour/1000~1099/1002.Find-Common-Characters.md" >}})|Easy||||68.7%|
|1002|Find Common Characters|[Go]({{< relref "/ChapterFour/1000~1099/1002.Find-Common-Characters.md" >}})|Easy||||68.8%|
|1048|Longest String Chain|[Go]({{< relref "/ChapterFour/1000~1099/1048.Longest-String-Chain.md" >}})|Medium||||56.1%|
|1078|Occurrences After Bigram|[Go]({{< relref "/ChapterFour/1000~1099/1078.Occurrences-After-Bigram.md" >}})|Easy||||64.9%|
|1160|Find Words That Can Be Formed by Characters|[Go]({{< relref "/ChapterFour/1100~1199/1160.Find-Words-That-Can-Be-Formed-by-Characters.md" >}})|Easy||||67.9%|

View File

@ -49,6 +49,7 @@ weight: 12
|0478|Generate Random Point in a Circle|[Go]({{< relref "/ChapterFour/0400~0499/0478.Generate-Random-Point-in-a-Circle.md" >}})|Medium||||39.1%|
|0483|Smallest Good Base|[Go]({{< relref "/ChapterFour/0400~0499/0483.Smallest-Good-Base.md" >}})|Hard||||36.5%|
|0507|Perfect Number|[Go]({{< relref "/ChapterFour/0500~0599/0507.Perfect-Number.md" >}})|Easy||||36.5%|
|0523|Continuous Subarray Sum|[Go]({{< relref "/ChapterFour/0500~0599/0523.Continuous-Subarray-Sum.md" >}})|Medium||||25.2%|
|0535|Encode and Decode TinyURL|[Go]({{< relref "/ChapterFour/0500~0599/0535.Encode-and-Decode-TinyURL.md" >}})|Medium||||82.6%|
|0537|Complex Number Multiplication|[Go]({{< relref "/ChapterFour/0500~0599/0537.Complex-Number-Multiplication.md" >}})|Medium||||68.5%|
|0598|Range Addition II|[Go]({{< relref "/ChapterFour/0500~0599/0598.Range-Addition-II.md" >}})|Easy||||50.4%|
@ -78,7 +79,7 @@ weight: 12
|0991|Broken Calculator|[Go]({{< relref "/ChapterFour/0900~0999/0991.Broken-Calculator.md" >}})|Medium||||49.8%|
|0996|Number of Squareful Arrays|[Go]({{< relref "/ChapterFour/0900~0999/0996.Number-of-Squareful-Arrays.md" >}})|Hard| O(n log n)| O(n) ||48.6%|
|1006|Clumsy Factorial|[Go]({{< relref "/ChapterFour/1000~1099/1006.Clumsy-Factorial.md" >}})|Medium||||54.0%|
|1017|Convert to Base -2|[Go]({{< relref "/ChapterFour/1000~1099/1017.Convert-to-Base-2.md" >}})|Medium||||59.4%|
|1017|Convert to Base -2|[Go]({{< relref "/ChapterFour/1000~1099/1017.Convert-to-Base-2.md" >}})|Medium||||59.3%|
|1025|Divisor Game|[Go]({{< relref "/ChapterFour/1000~1099/1025.Divisor-Game.md" >}})|Easy| O(1)| O(1)||66.1%|
|1037|Valid Boomerang|[Go]({{< relref "/ChapterFour/1000~1099/1037.Valid-Boomerang.md" >}})|Easy||||37.4%|
|1073|Adding Two Negabinary Numbers|[Go]({{< relref "/ChapterFour/1000~1099/1073.Adding-Two-Negabinary-Numbers.md" >}})|Medium||||34.7%|
@ -94,10 +95,11 @@ weight: 12
|1512|Number of Good Pairs|[Go]({{< relref "/ChapterFour/1500~1599/1512.Number-of-Good-Pairs.md" >}})|Easy||||87.6%|
|1551|Minimum Operations to Make Array Equal|[Go]({{< relref "/ChapterFour/1500~1599/1551.Minimum-Operations-to-Make-Array-Equal.md" >}})|Medium||||80.6%|
|1641|Count Sorted Vowel Strings|[Go]({{< relref "/ChapterFour/1600~1699/1641.Count-Sorted-Vowel-Strings.md" >}})|Medium||||75.1%|
|1648|Sell Diminishing-Valued Colored Balls|[Go]({{< relref "/ChapterFour/1600~1699/1648.Sell-Diminishing-Valued-Colored-Balls.md" >}})|Medium||||30.8%|
|1648|Sell Diminishing-Valued Colored Balls|[Go]({{< relref "/ChapterFour/1600~1699/1648.Sell-Diminishing-Valued-Colored-Balls.md" >}})|Medium||||30.9%|
|1680|Concatenation of Consecutive Binary Numbers|[Go]({{< relref "/ChapterFour/1600~1699/1680.Concatenation-of-Consecutive-Binary-Numbers.md" >}})|Medium||||52.2%|
|1685|Sum of Absolute Differences in a Sorted Array|[Go]({{< relref "/ChapterFour/1600~1699/1685.Sum-of-Absolute-Differences-in-a-Sorted-Array.md" >}})|Medium||||63.4%|
|1716|Calculate Money in Leetcode Bank|[Go]({{< relref "/ChapterFour/1700~1799/1716.Calculate-Money-in-Leetcode-Bank.md" >}})|Easy||||64.2%|
|1744|Can You Eat Your Favorite Candy on Your Favorite Day?|[Go]({{< relref "/ChapterFour/1700~1799/1744.Can-You-Eat-Your-Favorite-Candy-on-Your-Favorite-Day.md" >}})|Medium||||31.3%|
|------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------|

View File

@ -36,7 +36,7 @@ weight: 14
|0493|Reverse Pairs|[Go]({{< relref "/ChapterFour/0400~0499/0493.Reverse-Pairs.md" >}})|Hard||||27.6%|
|0524|Longest Word in Dictionary through Deleting|[Go]({{< relref "/ChapterFour/0500~0599/0524.Longest-Word-in-Dictionary-through-Deleting.md" >}})|Medium| O(n)| O(1) ||50.2%|
|0710|Random Pick with Blacklist|[Go]({{< relref "/ChapterFour/0700~0799/0710.Random-Pick-with-Blacklist.md" >}})|Hard| O(n)| O(n) ||33.2%|
|0767|Reorganize String|[Go]({{< relref "/ChapterFour/0700~0799/0767.Reorganize-String.md" >}})|Medium| O(n log n)| O(log n) |❤️|50.5%|
|0767|Reorganize String|[Go]({{< relref "/ChapterFour/0700~0799/0767.Reorganize-String.md" >}})|Medium| O(n log n)| O(log n) |❤️|50.6%|
|0853|Car Fleet|[Go]({{< relref "/ChapterFour/0800~0899/0853.Car-Fleet.md" >}})|Medium| O(n log n)| O(log n) ||44.8%|
|0922|Sort Array By Parity II|[Go]({{< relref "/ChapterFour/0900~0999/0922.Sort-Array-By-Parity-II.md" >}})|Easy| O(n)| O(1) ||70.7%|
|0969|Pancake Sorting|[Go]({{< relref "/ChapterFour/0900~0999/0969.Pancake-Sorting.md" >}})|Medium| O(n log n)| O(log n) |❤️|68.9%|
@ -52,7 +52,7 @@ weight: 14
|1636|Sort Array by Increasing Frequency|[Go]({{< relref "/ChapterFour/1600~1699/1636.Sort-Array-by-Increasing-Frequency.md" >}})|Easy||||67.1%|
|1640|Check Array Formation Through Concatenation|[Go]({{< relref "/ChapterFour/1600~1699/1640.Check-Array-Formation-Through-Concatenation.md" >}})|Easy||||55.6%|
|1647|Minimum Deletions to Make Character Frequencies Unique|[Go]({{< relref "/ChapterFour/1600~1699/1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique.md" >}})|Medium||||55.5%|
|1648|Sell Diminishing-Valued Colored Balls|[Go]({{< relref "/ChapterFour/1600~1699/1648.Sell-Diminishing-Valued-Colored-Balls.md" >}})|Medium||||30.8%|
|1648|Sell Diminishing-Valued Colored Balls|[Go]({{< relref "/ChapterFour/1600~1699/1648.Sell-Diminishing-Valued-Colored-Balls.md" >}})|Medium||||30.9%|
|1691|Maximum Height by Stacking Cuboids|[Go]({{< relref "/ChapterFour/1600~1699/1691.Maximum-Height-by-Stacking-Cuboids.md" >}})|Hard||||50.8%|
|1710|Maximum Units on a Truck|[Go]({{< relref "/ChapterFour/1700~1799/1710.Maximum-Units-on-a-Truck.md" >}})|Easy||||70.1%|
|------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------|

View File

@ -31,9 +31,9 @@ weight: 5
|0224|Basic Calculator|[Go]({{< relref "/ChapterFour/0200~0299/0224.Basic-Calculator.md" >}})|Hard| O(n)| O(n)||38.5%|
|0225|Implement Stack using Queues|[Go]({{< relref "/ChapterFour/0200~0299/0225.Implement-Stack-using-Queues.md" >}})|Easy| O(n)| O(n)||48.4%|
|0227|Basic Calculator II|[Go]({{< relref "/ChapterFour/0200~0299/0227.Basic-Calculator-II.md" >}})|Medium||||39.1%|
|0232|Implement Queue using Stacks|[Go]({{< relref "/ChapterFour/0200~0299/0232.Implement-Queue-using-Stacks.md" >}})|Easy| O(n)| O(n)||53.2%|
|0232|Implement Queue using Stacks|[Go]({{< relref "/ChapterFour/0200~0299/0232.Implement-Queue-using-Stacks.md" >}})|Easy| O(n)| O(n)||53.3%|
|0331|Verify Preorder Serialization of a Binary Tree|[Go]({{< relref "/ChapterFour/0300~0399/0331.Verify-Preorder-Serialization-of-a-Binary-Tree.md" >}})|Medium| O(n)| O(1)||41.3%|
|0341|Flatten Nested List Iterator|[Go]({{< relref "/ChapterFour/0300~0399/0341.Flatten-Nested-List-Iterator.md" >}})|Medium||||56.2%|
|0341|Flatten Nested List Iterator|[Go]({{< relref "/ChapterFour/0300~0399/0341.Flatten-Nested-List-Iterator.md" >}})|Medium||||56.3%|
|0385|Mini Parser|[Go]({{< relref "/ChapterFour/0300~0399/0385.Mini-Parser.md" >}})|Medium||||34.8%|
|0394|Decode String|[Go]({{< relref "/ChapterFour/0300~0399/0394.Decode-String.md" >}})|Medium| O(n)| O(n)||53.4%|
|0402|Remove K Digits|[Go]({{< relref "/ChapterFour/0400~0499/0402.Remove-K-Digits.md" >}})|Medium| O(n)| O(1)||28.7%|

View File

@ -28,6 +28,7 @@ weight: 2
|0076|Minimum Window Substring|[Go]({{< relref "/ChapterFour/0001~0099/0076.Minimum-Window-Substring.md" >}})|Hard| O(n)| O(n)|❤️|36.5%|
|0091|Decode Ways|[Go]({{< relref "/ChapterFour/0001~0099/0091.Decode-Ways.md" >}})|Medium| O(n)| O(n)||27.3%|
|0093|Restore IP Addresses|[Go]({{< relref "/ChapterFour/0001~0099/0093.Restore-IP-Addresses.md" >}})|Medium| O(n)| O(n)|❤️|38.3%|
|0097|Interleaving String|[Go]({{< relref "/ChapterFour/0001~0099/0097.Interleaving-String.md" >}})|Medium||||33.7%|
|0115|Distinct Subsequences|[Go]({{< relref "/ChapterFour/0100~0199/0115.Distinct-Subsequences.md" >}})|Hard||||40.3%|
|0125|Valid Palindrome|[Go]({{< relref "/ChapterFour/0100~0199/0125.Valid-Palindrome.md" >}})|Easy| O(n)| O(1)||38.9%|
|0126|Word Ladder II|[Go]({{< relref "/ChapterFour/0100~0199/0126.Word-Ladder-II.md" >}})|Hard| O(n)| O(n^2)|❤️|24.1%|
@ -36,7 +37,7 @@ weight: 2
|0344|Reverse String|[Go]({{< relref "/ChapterFour/0300~0399/0344.Reverse-String.md" >}})|Easy| O(n)| O(1)||71.1%|
|0345|Reverse Vowels of a String|[Go]({{< relref "/ChapterFour/0300~0399/0345.Reverse-Vowels-of-a-String.md" >}})|Easy| O(n)| O(1)||45.5%|
|0385|Mini Parser|[Go]({{< relref "/ChapterFour/0300~0399/0385.Mini-Parser.md" >}})|Medium||||34.8%|
|0387|First Unique Character in a String|[Go]({{< relref "/ChapterFour/0300~0399/0387.First-Unique-Character-in-a-String.md" >}})|Easy||||54.3%|
|0387|First Unique Character in a String|[Go]({{< relref "/ChapterFour/0300~0399/0387.First-Unique-Character-in-a-String.md" >}})|Easy||||54.4%|
|0537|Complex Number Multiplication|[Go]({{< relref "/ChapterFour/0500~0599/0537.Complex-Number-Multiplication.md" >}})|Medium||||68.5%|
|0541|Reverse String II|[Go]({{< relref "/ChapterFour/0500~0599/0541.Reverse-String-II.md" >}})|Easy||||49.7%|
|0557|Reverse Words in a String III|[Go]({{< relref "/ChapterFour/0500~0599/0557.Reverse-Words-in-a-String-III.md" >}})|Easy||||72.9%|
@ -46,10 +47,10 @@ weight: 2
|0647|Palindromic Substrings|[Go]({{< relref "/ChapterFour/0600~0699/0647.Palindromic-Substrings.md" >}})|Medium||||62.9%|
|0696|Count Binary Substrings|[Go]({{< relref "/ChapterFour/0600~0699/0696.Count-Binary-Substrings.md" >}})|Easy||||61.4%|
|0709|To Lower Case|[Go]({{< relref "/ChapterFour/0700~0799/0709.To-Lower-Case.md" >}})|Easy||||80.6%|
|0767|Reorganize String|[Go]({{< relref "/ChapterFour/0700~0799/0767.Reorganize-String.md" >}})|Medium| O(n log n)| O(log n) |❤️|50.5%|
|0767|Reorganize String|[Go]({{< relref "/ChapterFour/0700~0799/0767.Reorganize-String.md" >}})|Medium| O(n log n)| O(log n) |❤️|50.6%|
|0816|Ambiguous Coordinates|[Go]({{< relref "/ChapterFour/0800~0899/0816.Ambiguous-Coordinates.md" >}})|Medium||||55.6%|
|0819|Most Common Word|[Go]({{< relref "/ChapterFour/0800~0899/0819.Most-Common-Word.md" >}})|Easy||||45.4%|
|0842|Split Array into Fibonacci Sequence|[Go]({{< relref "/ChapterFour/0800~0899/0842.Split-Array-into-Fibonacci-Sequence.md" >}})|Medium| O(n^2)| O(1)|❤️|37.0%|
|0842|Split Array into Fibonacci Sequence|[Go]({{< relref "/ChapterFour/0800~0899/0842.Split-Array-into-Fibonacci-Sequence.md" >}})|Medium| O(n^2)| O(1)|❤️|37.1%|
|0856|Score of Parentheses|[Go]({{< relref "/ChapterFour/0800~0899/0856.Score-of-Parentheses.md" >}})|Medium| O(n)| O(n)||65.0%|
|0890|Find and Replace Pattern|[Go]({{< relref "/ChapterFour/0800~0899/0890.Find-and-Replace-Pattern.md" >}})|Medium||||75.5%|
|0916|Word Subsets|[Go]({{< relref "/ChapterFour/0900~0999/0916.Word-Subsets.md" >}})|Medium||||52.7%|
@ -67,7 +68,7 @@ weight: 2
|1455|Check If a Word Occurs As a Prefix of Any Word in a Sentence|[Go]({{< relref "/ChapterFour/1400~1499/1455.Check-If-a-Word-Occurs-As-a-Prefix-of-Any-Word-in-a-Sentence.md" >}})|Easy||||64.9%|
|1461|Check If a String Contains All Binary Codes of Size K|[Go]({{< relref "/ChapterFour/1400~1499/1461.Check-If-a-String-Contains-All-Binary-Codes-of-Size-K.md" >}})|Medium||||54.2%|
|1573|Number of Ways to Split a String|[Go]({{< relref "/ChapterFour/1500~1599/1573.Number-of-Ways-to-Split-a-String.md" >}})|Medium||||31.3%|
|1614|Maximum Nesting Depth of the Parentheses|[Go]({{< relref "/ChapterFour/1600~1699/1614.Maximum-Nesting-Depth-of-the-Parentheses.md" >}})|Easy||||82.7%|
|1614|Maximum Nesting Depth of the Parentheses|[Go]({{< relref "/ChapterFour/1600~1699/1614.Maximum-Nesting-Depth-of-the-Parentheses.md" >}})|Easy||||82.6%|
|1624|Largest Substring Between Two Equal Characters|[Go]({{< relref "/ChapterFour/1600~1699/1624.Largest-Substring-Between-Two-Equal-Characters.md" >}})|Easy||||58.5%|
|1653|Minimum Deletions to Make String Balanced|[Go]({{< relref "/ChapterFour/1600~1699/1653.Minimum-Deletions-to-Make-String-Balanced.md" >}})|Medium||||52.4%|
|1662|Check If Two String Arrays are Equivalent|[Go]({{< relref "/ChapterFour/1600~1699/1662.Check-If-Two-String-Arrays-are-Equivalent.md" >}})|Easy||||82.2%|

View File

@ -35,7 +35,7 @@ weight: 16
|0928|Minimize Malware Spread II|[Go]({{< relref "/ChapterFour/0900~0999/0928.Minimize-Malware-Spread-II.md" >}})|Hard| O(m\*n)| O(n)|❤️|41.6%|
|0947|Most Stones Removed with Same Row or Column|[Go]({{< relref "/ChapterFour/0900~0999/0947.Most-Stones-Removed-with-Same-Row-or-Column.md" >}})|Medium| O(n)| O(n)||55.8%|
|0952|Largest Component Size by Common Factor|[Go]({{< relref "/ChapterFour/0900~0999/0952.Largest-Component-Size-by-Common-Factor.md" >}})|Hard| O(n)| O(n)|❤️|36.5%|
|0959|Regions Cut By Slashes|[Go]({{< relref "/ChapterFour/0900~0999/0959.Regions-Cut-By-Slashes.md" >}})|Medium| O(n^2)| O(n^2)|❤️|67.4%|
|0959|Regions Cut By Slashes|[Go]({{< relref "/ChapterFour/0900~0999/0959.Regions-Cut-By-Slashes.md" >}})|Medium| O(n^2)| O(n^2)|❤️|67.5%|
|0990|Satisfiability of Equality Equations|[Go]({{< relref "/ChapterFour/0900~0999/0990.Satisfiability-of-Equality-Equations.md" >}})|Medium| O(n)| O(n)||47.3%|
|1202|Smallest String With Swaps|[Go]({{< relref "/ChapterFour/1200~1299/1202.Smallest-String-With-Swaps.md" >}})|Medium||||49.3%|
|1319|Number of Operations to Make Network Connected|[Go]({{< relref "/ChapterFour/1300~1399/1319.Number-of-Operations-to-Make-Network-Connected.md" >}})|Medium||||55.5%|