diff --git a/README.md b/README.md index 748aac45..9b420742 100755 --- a/README.md +++ b/README.md @@ -125,16 +125,16 @@ | | Easy | Medium | Hard | Total | |:--------:|:--------:|:--------:|:--------:|:--------:| -|Optimizing|39|44|16|99| +|Optimizing|39|44|15|98| |Accepted|**250**|**315**|**95**|**660**| |Total|459|903|367|1729| -|Perfection Rate|84.4%|86.0%|83.2%|85.0%| +|Perfection Rate|84.4%|86.0%|84.2%|85.2%| |Completion Rate|54.5%|34.9%|25.9%|38.2%| |------------|----------------------------|----------------------------|----------------------------|----------------------------| ## 二. 目录 -以下已经收录了 561 道题的题解,还有 12 道题在尝试优化到 beats 100% +以下已经收录了 562 道题的题解,还有 11 道题在尝试优化到 beats 100% | No. | Title | Solution | Acceptance | Difficulty | Frequency | |:--------:|:--------------------------------------------------------------|:--------:|:--------:|:--------:|:--------:| @@ -186,7 +186,7 @@ |0046|Permutations|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0046.Permutations)|66.1%|Medium|| |0047|Permutations II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0047.Permutations-II)|49.0%|Medium|| |0048|Rotate Image|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0048.Rotate-Image)|59.4%|Medium|| -|0049|Group Anagrams|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0049.Group-Anagrams)|58.8%|Medium|| +|0049|Group Anagrams|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0049.Group-Anagrams)|58.9%|Medium|| |0050|Pow(x, n)|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0050.Pow(x,-n))|30.8%|Medium|| |0051|N-Queens|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0051.N-Queens)|49.1%|Hard|| |0052|N-Queens II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0052.N-Queens-II)|59.7%|Hard|| @@ -242,7 +242,7 @@ |0102|Binary Tree Level Order Traversal|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0102.Binary-Tree-Level-Order-Traversal)|56.2%|Medium|| |0103|Binary Tree Zigzag Level Order Traversal|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0103.Binary-Tree-Zigzag-Level-Order-Traversal)|49.8%|Medium|| |0104|Maximum Depth of Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0104.Maximum-Depth-of-Binary-Tree)|67.7%|Easy|| -|0105|Construct Binary Tree from Preorder and Inorder Traversal|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0105.Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal)|51.2%|Medium|| +|0105|Construct Binary Tree from Preorder and Inorder Traversal|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0105.Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal)|51.3%|Medium|| |0106|Construct Binary Tree from Inorder and Postorder Traversal|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0106.Construct-Binary-Tree-from-Inorder-and-Postorder-Traversal)|49.2%|Medium|| |0107|Binary Tree Level Order Traversal II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0107.Binary-Tree-Level-Order-Traversal-II)|54.9%|Easy|| |0108|Convert Sorted Array to Binary Search Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0108.Convert-Sorted-Array-to-Binary-Search-Tree)|60.0%|Easy|| @@ -308,7 +308,7 @@ |0168|Excel Sheet Column Title|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0168.Excel-Sheet-Column-Title)|31.6%|Easy|| |0169|Majority Element|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0169.Majority-Element)|59.9%|Easy|| |0170|Two Sum III - Data structure design||34.7%|Easy|| -|0171|Excel Sheet Column Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0171.Excel-Sheet-Column-Number)|56.8%|Easy|| +|0171|Excel Sheet Column Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0171.Excel-Sheet-Column-Number)|56.7%|Easy|| |0172|Factorial Trailing Zeroes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0172.Factorial-Trailing-Zeroes)|38.4%|Easy|| |0173|Binary Search Tree Iterator|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0173.Binary-Search-Tree-Iterator)|59.6%|Medium|| |0174|Dungeon Game|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0174.Dungeon-Game)|33.2%|Hard|| @@ -419,7 +419,7 @@ |0279|Perfect Squares||48.6%|Medium|| |0280|Wiggle Sort||64.5%|Medium|| |0281|Zigzag Iterator||59.2%|Medium|| -|0282|Expression Add Operators||36.5%|Hard|| +|0282|Expression Add Operators||36.6%|Hard|| |0283|Move Zeroes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0283.Move-Zeroes)|58.4%|Easy|| |0284|Peeking Iterator||47.4%|Medium|| |0285|Inorder Successor in BST||42.4%|Medium|| @@ -466,7 +466,7 @@ |0326|Power of Three|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0326.Power-of-Three)|42.1%|Easy|| |0327|Count of Range Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0327.Count-of-Range-Sum)|35.9%|Hard|| |0328|Odd Even Linked List|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0328.Odd-Even-Linked-List)|56.9%|Medium|| -|0329|Longest Increasing Path in a Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0329.Longest-Increasing-Path-in-a-Matrix)|44.4%|Hard|| +|0329|Longest Increasing Path in a Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0329.Longest-Increasing-Path-in-a-Matrix)|44.5%|Hard|| |0330|Patching Array||34.9%|Hard|| |0331|Verify Preorder Serialization of a Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0331.Verify-Preorder-Serialization-of-a-Binary-Tree)|40.9%|Medium|| |0332|Reconstruct Itinerary||37.7%|Medium|| @@ -492,7 +492,7 @@ |0352|Data Stream as Disjoint Intervals||48.4%|Hard|| |0353|Design Snake Game||35.2%|Medium|| |0354|Russian Doll Envelopes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0354.Russian-Doll-Envelopes)|36.1%|Hard|| -|0355|Design Twitter||31.1%|Medium|| +|0355|Design Twitter||31.2%|Medium|| |0356|Line Reflection||32.7%|Medium|| |0357|Count Numbers with Unique Digits|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0357.Count-Numbers-with-Unique-Digits)|48.8%|Medium|| |0358|Rearrange String k Distance Apart||35.5%|Hard|| @@ -501,7 +501,7 @@ |0361|Bomb Enemy||46.5%|Medium|| |0362|Design Hit Counter||65.0%|Medium|| |0363|Max Sum of Rectangle No Larger Than K||38.3%|Hard|| -|0364|Nested List Weight Sum II||63.4%|Medium|| +|0364|Nested List Weight Sum II||63.5%|Medium|| |0365|Water and Jug Problem||31.0%|Medium|| |0366|Find Leaves of Binary Tree||71.6%|Medium|| |0367|Valid Perfect Square|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0367.Valid-Perfect-Square)|42.0%|Easy|| @@ -542,11 +542,11 @@ |0402|Remove K Digits|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0402.Remove-K-Digits)|28.6%|Medium|| |0403|Frog Jump||41.1%|Hard|| |0404|Sum of Left Leaves|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0404.Sum-of-Left-Leaves)|52.2%|Easy|| -|0405|Convert a Number to Hexadecimal|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0405.Convert-a-Number-to-Hexadecimal)|44.3%|Easy|| +|0405|Convert a Number to Hexadecimal|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0405.Convert-a-Number-to-Hexadecimal)|44.4%|Easy|| |0406|Queue Reconstruction by Height||68.1%|Medium|| |0407|Trapping Rain Water II||43.8%|Hard|| |0408|Valid Word Abbreviation||31.3%|Easy|| -|0409|Longest Palindrome|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0409.Longest-Palindrome)|52.1%|Easy|| +|0409|Longest Palindrome|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0409.Longest-Palindrome)|52.2%|Easy|| |0410|Split Array Largest Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0410.Split-Array-Largest-Sum)|46.1%|Hard|| |0411|Minimum Unique Word Abbreviation||37.0%|Hard|| |0412|Fizz Buzz|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0412.Fizz-Buzz)|63.5%|Easy|| @@ -565,7 +565,7 @@ |0425|Word Squares||49.9%|Hard|| |0426|Convert Binary Search Tree to Sorted Doubly Linked List||60.8%|Medium|| |0427|Construct Quad Tree||62.4%|Medium|| -|0428|Serialize and Deserialize N-ary Tree||61.1%|Hard|| +|0428|Serialize and Deserialize N-ary Tree||61.2%|Hard|| |0429|N-ary Tree Level Order Traversal||66.4%|Medium|| |0430|Flatten a Multilevel Doubly Linked List||56.6%|Medium|| |0431|Encode N-ary Tree to Binary Tree||74.4%|Hard|| @@ -609,9 +609,9 @@ |0469|Convex Polygon||37.4%|Medium|| |0470|Implement Rand10() Using Rand7()|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0470.Implement-Rand10()-Using-Rand7())|46.0%|Medium|| |0471|Encode String with Shortest Length||48.9%|Hard|| -|0472|Concatenated Words||44.6%|Hard|| +|0472|Concatenated Words||44.5%|Hard|| |0473|Matchsticks to Square||38.1%|Medium|| -|0474|Ones and Zeroes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0474.Ones-and-Zeroes)|43.4%|Medium|| +|0474|Ones and Zeroes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0474.Ones-and-Zeroes)|43.5%|Medium|| |0475|Heaters|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0475.Heaters)|33.5%|Medium|| |0476|Number Complement|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0476.Number-Complement)|65.1%|Easy|| |0477|Total Hamming Distance|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0477.Total-Hamming-Distance)|50.6%|Medium|| @@ -626,7 +626,7 @@ |0486|Predict the Winner||48.4%|Medium|| |0487|Max Consecutive Ones II||47.9%|Medium|| |0488|Zuma Game||38.6%|Hard|| -|0489|Robot Room Cleaner||72.1%|Hard|| +|0489|Robot Room Cleaner||72.2%|Hard|| |0490|The Maze||52.6%|Medium|| |0491|Increasing Subsequences|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0491.Increasing-Subsequences)|47.3%|Medium|| |0492|Construct the Rectangle||50.2%|Easy|| @@ -634,15 +634,15 @@ |0494|Target Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0494.Target-Sum)|45.8%|Medium|| |0495|Teemo Attacking||56.1%|Medium|| |0496|Next Greater Element I|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0496.Next-Greater-Element-I)|65.2%|Easy|| -|0497|Random Point in Non-overlapping Rectangles|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0497.Random-Point-in-Non-overlapping-Rectangles)|39.1%|Medium|| +|0497|Random Point in Non-overlapping Rectangles|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0497.Random-Point-in-Non-overlapping-Rectangles)|39.0%|Medium|| |0498|Diagonal Traverse|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0498.Diagonal-Traverse)|50.1%|Medium|| |0499|The Maze III||42.2%|Hard|| |0500|Keyboard Row|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0500.Keyboard-Row)|65.5%|Easy|| |0501|Find Mode in Binary Search Tree||43.2%|Easy|| |0502|IPO||41.3%|Hard|| -|0503|Next Greater Element II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0503.Next-Greater-Element-II)|58.1%|Medium|| +|0503|Next Greater Element II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0503.Next-Greater-Element-II)|58.2%|Medium|| |0504|Base 7||46.4%|Easy|| -|0505|The Maze II||48.3%|Medium|| +|0505|The Maze II||48.4%|Medium|| |0506|Relative Ranks||51.1%|Easy|| |0507|Perfect Number|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0507.Perfect-Number)|36.0%|Easy|| |0508|Most Frequent Subtree Sum|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0508.Most-Frequent-Subtree-Sum)|58.9%|Medium|| @@ -671,7 +671,7 @@ |0531|Lonely Pixel I||59.4%|Medium|| |0532|K-diff Pairs in an Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0532.K-diff-Pairs-in-an-Array)|34.9%|Medium|| |0533|Lonely Pixel II||48.0%|Medium|| -|0534|Game Play Analysis III||78.6%|Medium|| +|0534|Game Play Analysis III||78.7%|Medium|| |0535|Encode and Decode TinyURL||80.7%|Medium|| |0536|Construct Binary Tree from String||50.4%|Medium|| |0537|Complex Number Multiplication|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0537.Complex-Number-Multiplication)|68.3%|Medium|| @@ -697,10 +697,10 @@ |0557|Reverse Words in a String III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0557.Reverse-Words-in-a-String-III)|71.6%|Easy|| |0558|Logical OR of Two Binary Grids Represented as Quad-Trees||45.5%|Medium|| |0559|Maximum Depth of N-ary Tree||69.4%|Easy|| -|0560|Subarray Sum Equals K||43.8%|Medium|| +|0560|Subarray Sum Equals K||43.9%|Medium|| |0561|Array Partition I|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0561.Array-Partition-I)|72.9%|Easy|| |0562|Longest Line of Consecutive One in Matrix||46.2%|Medium|| -|0563|Binary Tree Tilt|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0563.Binary-Tree-Tilt)|52.6%|Easy|| +|0563|Binary Tree Tilt|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0563.Binary-Tree-Tilt)|52.7%|Easy|| |0564|Find the Closest Palindrome||20.2%|Hard|| |0565|Array Nesting||55.9%|Medium|| |0566|Reshape the Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0566.Reshape-the-Matrix)|61.0%|Easy|| @@ -768,12 +768,12 @@ |0628|Maximum Product of Three Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0628.Maximum-Product-of-Three-Numbers)|47.0%|Easy|| |0629|K Inverse Pairs Array||31.6%|Hard|| |0630|Course Schedule III||33.7%|Hard|| -|0631|Design Excel Sum Formula||32.1%|Hard|| +|0631|Design Excel Sum Formula||32.0%|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)|53.9%|Hard|| |0633|Sum of Square Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0633.Sum-of-Square-Numbers)|32.4%|Medium|| |0634|Find the Derangement of An Array||40.4%|Medium|| |0635|Design Log Storage System||59.5%|Medium|| -|0636|Exclusive Time of Functions|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0636.Exclusive-Time-of-Functions)|53.9%|Medium|| +|0636|Exclusive Time of Functions|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0636.Exclusive-Time-of-Functions)|54.0%|Medium|| |0637|Average of Levels in Binary Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0637.Average-of-Levels-in-Binary-Tree)|64.5%|Easy|| |0638|Shopping Offers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0638.Shopping-Offers)|52.6%|Medium|| |0639|Decode Ways II||27.5%|Hard|| @@ -792,7 +792,7 @@ |0652|Find Duplicate Subtrees||52.0%|Medium|| |0653|Two Sum IV - Input is a BST|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0653.Two-Sum-IV---Input-is-a-BST)|56.1%|Easy|| |0654|Maximum Binary Tree||80.9%|Medium|| -|0655|Print Binary Tree||55.8%|Medium|| +|0655|Print Binary Tree||55.9%|Medium|| |0656|Coin Path||29.5%|Hard|| |0657|Robot Return to Origin||73.6%|Easy|| |0658|Find K Closest Elements|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0658.Find-K-Closest-Elements)|41.8%|Medium|| @@ -834,7 +834,7 @@ |0694|Number of Distinct Islands||57.4%|Medium|| |0695|Max Area of Island|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0695.Max-Area-of-Island)|64.3%|Medium|| |0696|Count Binary Substrings||57.3%|Easy|| -|0697|Degree of an Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0697.Degree-of-an-Array)|54.3%|Easy|| +|0697|Degree of an Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0697.Degree-of-an-Array)|54.4%|Easy|| |0698|Partition to K Equal Sum Subsets||45.5%|Medium|| |0699|Falling Squares|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0699.Falling-Squares)|42.4%|Hard|| |0700|Search in a Binary Search Tree||73.4%|Easy|| @@ -860,7 +860,7 @@ |0720|Longest Word in Dictionary|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0720.Longest-Word-in-Dictionary)|49.1%|Easy|| |0721|Accounts Merge|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0721.Accounts-Merge)|51.2%|Medium|| |0722|Remove Comments||35.8%|Medium|| -|0723|Candy Crush||72.3%|Medium|| +|0723|Candy Crush||72.4%|Medium|| |0724|Find Pivot Index|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0724.Find-Pivot-Index)|45.0%|Easy|| |0725|Split Linked List in Parts|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0725.Split-Linked-List-in-Parts)|52.8%|Medium|| |0726|Number of Atoms|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0726.Number-of-Atoms)|51.0%|Hard|| @@ -895,11 +895,11 @@ |0755|Pour Water||44.0%|Medium|| |0756|Pyramid Transition Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0756.Pyramid-Transition-Matrix)|55.5%|Medium|| |0757|Set Intersection Size At Least Two||42.1%|Hard|| -|0758|Bold Words in String||47.1%|Easy|| +|0758|Bold Words in String||47.2%|Easy|| |0759|Employee Free Time||67.9%|Hard|| |0760|Find Anagram Mappings||81.7%|Easy|| |0761|Special Binary String||58.5%|Hard|| -|0762|Prime Number of Set Bits in Binary Representation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0762.Prime-Number-of-Set-Bits-in-Binary-Representation)|64.1%|Easy|| +|0762|Prime Number of Set Bits in Binary Representation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0762.Prime-Number-of-Set-Bits-in-Binary-Representation)|64.2%|Easy|| |0763|Partition Labels|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0763.Partition-Labels)|77.9%|Medium|| |0764|Largest Plus Sign||46.3%|Medium|| |0765|Couples Holding Hands|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0765.Couples-Holding-Hands)|55.3%|Hard|| @@ -943,8 +943,8 @@ |0803|Bricks Falling When Hit|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0803.Bricks-Falling-When-Hit)|31.3%|Hard|| |0804|Unique Morse Code Words||78.8%|Easy|| |0805|Split Array With Same Average||26.7%|Hard|| -|0806|Number of Lines To Write String||65.4%|Easy|| -|0807|Max Increase to Keep City Skyline||84.2%|Medium|| +|0806|Number of Lines To Write String||65.5%|Easy|| +|0807|Max Increase to Keep City Skyline||84.3%|Medium|| |0808|Soup Servings||40.8%|Medium|| |0809|Expressive Words||46.6%|Medium|| |0810|Chalkboard XOR Game||49.4%|Hard|| @@ -966,7 +966,7 @@ |0826|Most Profit Assigning Work|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0826.Most-Profit-Assigning-Work)|38.9%|Medium|| |0827|Making A Large Island||47.1%|Hard|| |0828|Count Unique Characters of All Substrings of a Given String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0828.Count-Unique-Characters-of-All-Substrings-of-a-Given-String)|46.8%|Hard|| -|0829|Consecutive Numbers Sum||39.4%|Hard|| +|0829|Consecutive Numbers Sum||39.3%|Hard|| |0830|Positions of Large Groups|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0830.Positions-of-Large-Groups)|50.2%|Easy|| |0831|Masking Personal Information||44.7%|Medium|| |0832|Flipping an Image|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0832.Flipping-an-Image)|77.9%|Easy|| @@ -996,14 +996,14 @@ |0856|Score of Parentheses|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0856.Score-of-Parentheses)|62.2%|Medium|| |0857|Minimum Cost to Hire K Workers||50.3%|Hard|| |0858|Mirror Reflection||59.5%|Medium|| -|0859|Buddy Strings||29.7%|Easy|| -|0860|Lemonade Change||51.8%|Easy|| +|0859|Buddy Strings||29.6%|Easy|| +|0860|Lemonade Change||51.9%|Easy|| |0861|Score After Flipping Matrix||73.4%|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.1%|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)|57.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)|41.5%|Hard|| |0865|Smallest Subtree with all the Deepest Nodes||64.6%|Medium|| -|0866|Prime Palindrome||25.0%|Medium|| +|0866|Prime Palindrome||25.1%|Medium|| |0867|Transpose Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0867.Transpose-Matrix)|62.2%|Easy|| |0868|Binary Gap||60.8%|Easy|| |0869|Reordered Power of 2||54.1%|Medium|| @@ -1031,8 +1031,8 @@ |0891|Sum of Subsequence Widths|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0891.Sum-of-Subsequence-Widths)|32.8%|Hard|| |0892|Surface Area of 3D Shapes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0892.Surface-Area-of-3D-Shapes)|59.6%|Easy|| |0893|Groups of Special-Equivalent Strings||68.2%|Easy|| -|0894|All Possible Full Binary Trees||76.9%|Medium|| -|0895|Maximum Frequency Stack|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0895.Maximum-Frequency-Stack)|62.1%|Hard|| +|0894|All Possible Full Binary Trees||77.0%|Medium|| +|0895|Maximum Frequency Stack|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0895.Maximum-Frequency-Stack)|62.2%|Hard|| |0896|Monotonic Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0896.Monotonic-Array)|58.0%|Easy|| |0897|Increasing Order Search Tree|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0897.Increasing-Order-Search-Tree)|74.3%|Easy|| |0898|Bitwise ORs of Subarrays|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0898.Bitwise-ORs-of-Subarrays)|34.0%|Medium|| @@ -1042,7 +1042,7 @@ |0902|Numbers At Most N Given Digit Set||36.1%|Hard|| |0903|Valid Permutations for DI Sequence||54.1%|Hard|| |0904|Fruit Into Baskets|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0904.Fruit-Into-Baskets)|42.9%|Medium|| -|0905|Sort Array By Parity||74.9%|Easy|| +|0905|Sort Array By Parity||75.0%|Easy|| |0906|Super Palindromes||32.9%|Hard|| |0907|Sum of Subarray Minimums|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0907.Sum-of-Subarray-Minimums)|33.2%|Medium|| |0908|Smallest Range I||66.4%|Easy|| @@ -1082,7 +1082,7 @@ |0942|DI String Match|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0942.DI-String-Match)|73.4%|Easy|| |0943|Find the Shortest Superstring||43.5%|Hard|| |0944|Delete Columns to Make Sorted||71.1%|Easy|| -|0945|Minimum Increment to Make Array Unique||46.6%|Medium|| +|0945|Minimum Increment to Make Array Unique||46.7%|Medium|| |0946|Validate Stack Sequences|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0946.Validate-Stack-Sequences)|63.4%|Medium|| |0947|Most Stones Removed with Same Row or Column|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0947.Most-Stones-Removed-with-Same-Row-or-Column)|55.4%|Medium|| |0948|Bag of Tokens||46.1%|Medium|| @@ -1102,7 +1102,7 @@ |0962|Maximum Width Ramp||46.3%|Medium|| |0963|Minimum Area Rectangle II||51.7%|Medium|| |0964|Least Operators to Express Number||44.9%|Hard|| -|0965|Univalued Binary Tree||67.7%|Easy|| +|0965|Univalued Binary Tree||67.8%|Easy|| |0966|Vowel Spellchecker||47.7%|Medium|| |0967|Numbers With Same Consecutive Differences||44.5%|Medium|| |0968|Binary Tree Cameras|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0968.Binary-Tree-Cameras)|38.5%|Hard|| @@ -1174,13 +1174,13 @@ |1034|Coloring A Border||45.5%|Medium|| |1035|Uncrossed Lines||56.0%|Medium|| |1036|Escape a Large Maze||34.8%|Hard|| -|1037|Valid Boomerang|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1037.Valid-Boomerang)|37.8%|Easy|| +|1037|Valid Boomerang|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1037.Valid-Boomerang)|37.9%|Easy|| |1038|Binary Search Tree to Greater Sum Tree||82.0%|Medium|| |1039|Minimum Score Triangulation of Polygon||50.0%|Medium|| |1040|Moving Stones Until Consecutive II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1040.Moving-Stones-Until-Consecutive-II)|53.9%|Medium|| |1041|Robot Bounded In Circle||54.7%|Medium|| |1042|Flower Planting With No Adjacent||48.7%|Medium|| -|1043|Partition Array for Maximum Sum||66.8%|Medium|| +|1043|Partition Array for Maximum Sum||66.7%|Medium|| |1044|Longest Duplicate Substring||31.5%|Hard|| |1045|Customers Who Bought All Products||68.3%|Medium|| |1046|Last Stone Weight||62.4%|Easy|| @@ -1188,7 +1188,7 @@ |1048|Longest String Chain||55.3%|Medium|| |1049|Last Stone Weight II|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1049.Last-Stone-Weight-II)|45.0%|Medium|| |1050|Actors and Directors Who Cooperated At Least Three Times||72.1%|Easy|| -|1051|Height Checker|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1051.Height-Checker)|71.8%|Easy|| +|1051|Height Checker|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1051.Height-Checker)|71.9%|Easy|| |1052|Grumpy Bookstore Owner|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1052.Grumpy-Bookstore-Owner)|55.7%|Medium|| |1053|Previous Permutation With One Swap||50.8%|Medium|| |1054|Distant Barcodes|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1054.Distant-Barcodes)|44.2%|Medium|| @@ -1196,14 +1196,14 @@ |1056|Confusing Number||47.1%|Easy|| |1057|Campus Bikes||57.6%|Medium|| |1058|Minimize Rounding Error to Meet Target||43.2%|Medium|| -|1059|All Paths from Source Lead to Destination||43.3%|Medium|| +|1059|All Paths from Source Lead to Destination||43.2%|Medium|| |1060|Missing Element in Sorted Array||54.7%|Medium|| -|1061|Lexicographically Smallest Equivalent String||66.6%|Medium|| +|1061|Lexicographically Smallest Equivalent String||66.7%|Medium|| |1062|Longest Repeating Substring||58.0%|Medium|| |1063|Number of Valid Subarrays||72.2%|Hard|| -|1064|Fixed Point||65.5%|Easy|| +|1064|Fixed Point||65.4%|Easy|| |1065|Index Pairs of a String||61.0%|Easy|| -|1066|Campus Bikes II||54.1%|Medium|| +|1066|Campus Bikes II||54.0%|Medium|| |1067|Digit Count in Range||41.0%|Hard|| |1068|Product Sales Analysis I||82.3%|Easy|| |1069|Product Sales Analysis II||83.2%|Easy|| @@ -1230,15 +1230,15 @@ |1090|Largest Values From Labels||60.1%|Medium|| |1091|Shortest Path in Binary Matrix||39.0%|Medium|| |1092|Shortest Common Supersequence ||52.8%|Hard|| -|1093|Statistics from a Large Sample|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1093.Statistics-from-a-Large-Sample)|49.4%|Medium|| +|1093|Statistics from a Large Sample|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1093.Statistics-from-a-Large-Sample)|49.3%|Medium|| |1094|Car Pooling||59.0%|Medium|| |1095|Find in Mountain Array||36.0%|Hard|| |1096|Brace Expansion II||62.4%|Hard|| -|1097|Game Play Analysis V||56.4%|Hard|| +|1097|Game Play Analysis V||56.3%|Hard|| |1098|Unpopular Books||45.5%|Medium|| |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.5%|Medium|| +|1101|The Earliest Moment When Everyone Become Friends||67.6%|Medium|| |1102|Path With Maximum Minimum Value||50.2%|Medium|| |1103|Distribute Candies to People||63.6%|Easy|| |1104|Path In Zigzag Labelled Binary Tree||73.0%|Medium|| @@ -1252,7 +1252,7 @@ |1112|Highest Grade For Each Student||71.7%|Medium|| |1113|Reported Posts||65.4%|Easy|| |1114|Print in Order||67.0%|Easy|| -|1115|Print FooBar Alternately||59.0%|Medium|| +|1115|Print FooBar Alternately||59.1%|Medium|| |1116|Print Zero Even Odd||57.6%|Medium|| |1117|Building H2O||53.2%|Medium|| |1118|Number of Days in a Month||57.5%|Easy|| @@ -1260,7 +1260,7 @@ |1120|Maximum Average Subtree||63.5%|Medium|| |1121|Divide Array Into Increasing Sequences||57.9%|Hard|| |1122|Relative Sort Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1122.Relative-Sort-Array)|67.7%|Easy|| -|1123|Lowest Common Ancestor of Deepest Leaves|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1123.Lowest-Common-Ancestor-of-Deepest-Leaves)|67.8%|Medium|| +|1123|Lowest Common Ancestor of Deepest Leaves|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1123.Lowest-Common-Ancestor-of-Deepest-Leaves)|67.9%|Medium|| |1124|Longest Well-Performing Interval||33.2%|Medium|| |1125|Smallest Sufficient Team||47.0%|Hard|| |1126|Active Businesses||68.7%|Medium|| @@ -1289,7 +1289,7 @@ |1149|Article Views II||48.4%|Medium|| |1150|Check If a Number Is Majority Element in a Sorted Array||57.9%|Easy|| |1151|Minimum Swaps to Group All 1's Together||58.2%|Medium|| -|1152|Analyze User Website Visit Pattern||43.3%|Medium|| +|1152|Analyze User Website Visit Pattern||43.4%|Medium|| |1153|String Transforms Into Another String||36.0%|Hard|| |1154|Day of the Year|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1154.Day-of-the-Year)|49.3%|Easy|| |1155|Number of Dice Rolls With Target Sum||47.5%|Medium|| @@ -1301,12 +1301,12 @@ |1161|Maximum Level Sum of a Binary Tree||70.1%|Medium|| |1162|As Far from Land as Possible||45.0%|Medium|| |1163|Last Substring in Lexicographical Order||36.3%|Hard|| -|1164|Product Price at a Given Date||68.0%|Medium|| +|1164|Product Price at a Given Date||68.1%|Medium|| |1165|Single-Row Keyboard||84.8%|Easy|| |1166|Design File System||58.3%|Medium|| |1167|Minimum Cost to Connect Sticks||64.2%|Medium|| |1168|Optimize Water Distribution in a Village||62.1%|Hard|| -|1169|Invalid Transactions||31.6%|Medium|| +|1169|Invalid Transactions||31.5%|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)|59.5%|Easy|| |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.4%|Medium|| |1172|Dinner Plate Stacks||37.8%|Hard|| @@ -1324,15 +1324,15 @@ |1184|Distance Between Bus Stops|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1184.Distance-Between-Bus-Stops)|54.1%|Easy|| |1185|Day of the Week|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1185.Day-of-the-Week)|61.9%|Easy|| |1186|Maximum Subarray Sum with One Deletion||38.5%|Medium|| -|1187|Make Array Strictly Increasing||41.6%|Hard|| -|1188|Design Bounded Blocking Queue||72.6%|Medium|| +|1187|Make Array Strictly Increasing||41.7%|Hard|| +|1188|Design Bounded Blocking Queue||72.5%|Medium|| |1189|Maximum Number of Balloons|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1189.Maximum-Number-of-Balloons)|61.8%|Easy|| |1190|Reverse Substrings Between Each Pair of Parentheses||64.0%|Medium|| |1191|K-Concatenation Maximum Sum||25.4%|Medium|| |1192|Critical Connections in a Network||49.9%|Hard|| |1193|Monthly Transactions I||69.1%|Medium|| |1194|Tournament Winners||52.2%|Hard|| -|1195|Fizz Buzz Multithreaded||70.4%|Medium|| +|1195|Fizz Buzz Multithreaded||70.5%|Medium|| |1196|How Many Apples Can You Put into the Basket||68.2%|Easy|| |1197|Minimum Knight Moves||37.1%|Medium|| |1198|Find Smallest Common Element in All Rows||75.2%|Medium|| @@ -1340,14 +1340,14 @@ |1200|Minimum Absolute Difference|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1200.Minimum-Absolute-Difference)|66.8%|Easy|| |1201|Ugly Number III|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1201.Ugly-Number-III)|26.3%|Medium|| |1202|Smallest String With Swaps|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1202.Smallest-String-With-Swaps)|48.4%|Medium|| -|1203|Sort Items by Groups Respecting Dependencies||49.0%|Hard|| +|1203|Sort Items by Groups Respecting Dependencies|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1203.Sort-Items-by-Groups-Respecting-Dependencies)|49.1%|Hard|| |1204|Last Person to Fit in the Elevator||71.5%|Medium|| |1205|Monthly Transactions II||45.9%|Medium|| -|1206|Design Skiplist||58.9%|Hard|| +|1206|Design Skiplist||59.0%|Hard|| |1207|Unique Number of Occurrences|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1207.Unique-Number-of-Occurrences)|71.6%|Easy|| |1208|Get Equal Substrings Within Budget|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1208.Get-Equal-Substrings-Within-Budget)|43.6%|Medium|| |1209|Remove All Adjacent Duplicates in String II||57.3%|Medium|| -|1210|Minimum Moves to Reach Target with Rotations||46.2%|Hard|| +|1210|Minimum Moves to Reach Target with Rotations||46.3%|Hard|| |1211|Queries Quality and Percentage||69.8%|Easy|| |1212|Team Scores in Football Tournament||56.7%|Medium|| |1213|Intersection of Three Sorted Arrays||79.2%|Easy|| @@ -1363,16 +1363,16 @@ |1223|Dice Roll Simulation||46.7%|Medium|| |1224|Maximum Equal Frequency||34.5%|Hard|| |1225|Report Contiguous Dates||62.4%|Hard|| -|1226|The Dining Philosophers||59.8%|Medium|| -|1227|Airplane Seat Assignment Probability||62.0%|Medium|| +|1226|The Dining Philosophers||59.7%|Medium|| +|1227|Airplane Seat Assignment Probability||62.1%|Medium|| |1228|Missing Number In Arithmetic Progression||51.6%|Easy|| -|1229|Meeting Scheduler||54.2%|Medium|| +|1229|Meeting Scheduler||54.3%|Medium|| |1230|Toss Strange Coins||49.7%|Medium|| |1231|Divide Chocolate||53.3%|Hard|| |1232|Check If It Is a Straight Line|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1232.Check-If-It-Is-a-Straight-Line)|43.8%|Easy|| |1233|Remove Sub-Folders from the Filesystem||61.7%|Medium|| |1234|Replace the Substring for Balanced String|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1234.Replace-the-Substring-for-Balanced-String)|34.4%|Medium|| -|1235|Maximum Profit in Job Scheduling|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1235.Maximum-Profit-in-Job-Scheduling)|46.9%|Hard|| +|1235|Maximum Profit in Job Scheduling|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1235.Maximum-Profit-in-Job-Scheduling)|47.0%|Hard|| |1236|Web Crawler||64.5%|Medium|| |1237|Find Positive Integer Solution for a Given Equation||69.7%|Easy|| |1238|Circular Permutation in Binary Representation||65.8%|Medium|| @@ -1383,8 +1383,8 @@ |1243|Array Transformation||50.3%|Easy|| |1244|Design A Leaderboard||65.9%|Medium|| |1245|Tree Diameter||61.2%|Medium|| -|1246|Palindrome Removal||45.7%|Hard|| -|1247|Minimum Swaps to Make Strings Equal||62.4%|Medium|| +|1246|Palindrome Removal||45.8%|Hard|| +|1247|Minimum Swaps to Make Strings Equal||62.3%|Medium|| |1248|Count Number of Nice Subarrays||56.3%|Medium|| |1249|Minimum Remove to Make Valid Parentheses||63.5%|Medium|| |1250|Check If It Is a Good Array||56.3%|Hard|| @@ -1407,7 +1407,7 @@ |1267|Count Servers that Communicate||57.8%|Medium|| |1268|Search Suggestions System||64.5%|Medium|| |1269|Number of Ways to Stay in the Same Place After Some Steps||43.2%|Hard|| -|1270|All People Report to the Given Manager||88.3%|Medium|| +|1270|All People Report to the Given Manager||88.4%|Medium|| |1271|Hexspeak||55.3%|Easy|| |1272|Remove Interval||57.8%|Medium|| |1273|Delete Tree Nodes||62.5%|Medium|| @@ -1421,7 +1421,7 @@ |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.3%|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)|49.2%|Medium|| -|1284|Minimum Number of Flips to Convert Binary Matrix to Zero Matrix||70.1%|Hard|| +|1284|Minimum Number of Flips to Convert Binary Matrix to Zero Matrix||70.2%|Hard|| |1285|Find the Start and End Number of Continuous Ranges||86.9%|Medium|| |1286|Iterator for Combination||70.9%|Medium|| |1287|Element Appearing More Than 25% In Sorted Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1287.Element-Appearing-More-Than-25%-In-Sorted-Array)|60.2%|Easy|| @@ -1434,7 +1434,7 @@ |1294|Weather Type in Each Country||66.1%|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)|79.3%|Easy|| |1296|Divide Array in Sets of K Consecutive Numbers||55.3%|Medium|| -|1297|Maximum Number of Occurrences of a Substring||49.2%|Medium|| +|1297|Maximum Number of Occurrences of a Substring||49.3%|Medium|| |1298|Maximum Candies You Can Get from Boxes||59.6%|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.2%|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)|43.3%|Medium|| @@ -1459,7 +1459,7 @@ |1319|Number of Operations to Make Network Connected||54.8%|Medium|| |1320|Minimum Distance to Type a Word Using Two Fingers||62.8%|Hard|| |1321|Restaurant Growth||70.6%|Medium|| -|1322|Ads Performance||57.9%|Easy|| +|1322|Ads Performance||57.8%|Easy|| |1323|Maximum 69 Number||78.0%|Easy|| |1324|Print Words Vertically||58.7%|Medium|| |1325|Delete Leaves With a Given Value||73.5%|Medium|| @@ -1472,13 +1472,13 @@ |1332|Remove Palindromic Subsequences||62.8%|Easy|| |1333|Filter Restaurants by Vegan-Friendly, Price and Distance||57.0%|Medium|| |1334|Find the City With the Smallest Number of Neighbors at a Threshold Distance||46.6%|Medium|| -|1335|Minimum Difficulty of a Job Schedule||57.3%|Hard|| +|1335|Minimum Difficulty of a Job Schedule||57.4%|Hard|| |1336|Number of Transactions per Visit||47.4%|Hard|| |1337|The K Weakest Rows in a Matrix||69.7%|Easy|| |1338|Reduce Array Size to The Half||66.7%|Medium|| |1339|Maximum Product of Splitted Binary Tree||38.0%|Medium|| |1340|Jump Game V||59.0%|Hard|| -|1341|Movie Rating||58.5%|Medium|| +|1341|Movie Rating||58.6%|Medium|| |1342|Number of Steps to Reduce a Number to Zero||85.7%|Easy|| |1343|Number of Sub-arrays of Size K and Average Greater than or Equal to Threshold||64.6%|Medium|| |1344|Angle Between Hands of a Clock||61.2%|Medium|| @@ -1498,14 +1498,14 @@ |1358|Number of Substrings Containing All Three Characters||60.4%|Medium|| |1359|Count All Valid Pickup and Delivery Options||56.8%|Hard|| |1360|Number of Days Between Two Dates||46.9%|Easy|| -|1361|Validate Binary Tree Nodes||44.2%|Medium|| +|1361|Validate Binary Tree Nodes||44.3%|Medium|| |1362|Closest Divisors||57.5%|Medium|| |1363|Largest Multiple of Three||33.9%|Hard|| -|1364|Number of Trusted Contacts of a Customer||78.0%|Medium|| +|1364|Number of Trusted Contacts of a Customer||78.1%|Medium|| |1365|How Many Numbers Are Smaller Than the Current Number||85.9%|Easy|| -|1366|Rank Teams by Votes||54.9%|Medium|| +|1366|Rank Teams by Votes||55.0%|Medium|| |1367|Linked List in Binary Tree||41.1%|Medium|| -|1368|Minimum Cost to Make at Least One Valid Path in a Grid||56.8%|Hard|| +|1368|Minimum Cost to Make at Least One Valid Path in a Grid||56.9%|Hard|| |1369|Get the Second Most Recent Activity||68.4%|Hard|| |1370|Increasing Decreasing String||76.4%|Easy|| |1371|Find the Longest Substring Containing Vowels in Even Counts||61.2%|Medium|| @@ -1517,14 +1517,14 @@ |1377|Frog Position After T Seconds||34.8%|Hard|| |1378|Replace Employee ID With The Unique Identifier||89.8%|Easy|| |1379|Find a Corresponding Node of a Binary Tree in a Clone of That Tree||85.0%|Medium|| -|1380|Lucky Numbers in a Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1380.Lucky-Numbers-in-a-Matrix)|70.9%|Easy|| +|1380|Lucky Numbers in a Matrix|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1380.Lucky-Numbers-in-a-Matrix)|70.8%|Easy|| |1381|Design a Stack With Increment Operation||75.8%|Medium|| |1382|Balance a Binary Search Tree||76.0%|Medium|| -|1383|Maximum Performance of a Team||35.1%|Hard|| +|1383|Maximum Performance of a Team||35.2%|Hard|| |1384|Total Sales Amount by Year||64.4%|Hard|| |1385|Find the Distance Value Between Two Arrays|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1385.Find-the-Distance-Value-Between-Two-Arrays)|66.4%|Easy|| |1386|Cinema Seat Allocation||35.5%|Medium|| -|1387|Sort Integers by The Power Value||70.5%|Medium|| +|1387|Sort Integers by The Power Value||70.6%|Medium|| |1388|Pizza With 3n Slices||45.4%|Hard|| |1389|Create Target Array in the Given Order|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1389.Create-Target-Array-in-the-Given-Order)|84.7%|Easy|| |1390|Four Divisors||39.0%|Medium|| @@ -1532,7 +1532,7 @@ |1392|Longest Happy Prefix||41.3%|Hard|| |1393|Capital Gain/Loss||90.6%|Medium|| |1394|Find Lucky Integer in an Array||63.2%|Easy|| -|1395|Count Number of Teams||81.0%|Medium|| +|1395|Count Number of Teams||80.9%|Medium|| |1396|Design Underground System||69.0%|Medium|| |1397|Find All Good Strings||38.1%|Hard|| |1398|Customers Who Bought Products A and B but Not C||82.1%|Medium|| @@ -1549,13 +1549,13 @@ |1409|Queries on a Permutation With Key||81.4%|Medium|| |1410|HTML Entity Parser||54.4%|Medium|| |1411|Number of Ways to Paint N × 3 Grid||60.4%|Hard|| -|1412|Find the Quiet Students in All Exams||65.4%|Hard|| +|1412|Find the Quiet Students in All Exams||65.5%|Hard|| |1413|Minimum Value to Get Positive Step by Step Sum||65.4%|Easy|| |1414|Find the Minimum Number of Fibonacci Numbers Whose Sum Is K||63.8%|Medium|| |1415|The k-th Lexicographical String of All Happy Strings of Length n||70.1%|Medium|| |1416|Restore The Array||36.3%|Hard|| |1417|Reformat The String||55.4%|Easy|| -|1418|Display Table of Food Orders in a Restaurant||68.3%|Medium|| +|1418|Display Table of Food Orders in a Restaurant||68.4%|Medium|| |1419|Minimum Number of Frogs Croaking||47.3%|Medium|| |1420|Build Array Where You Can Find The Maximum Exactly K Comparisons||64.3%|Hard|| |1421|NPV Queries||81.9%|Medium|| @@ -1587,7 +1587,7 @@ |1447|Simplified Fractions||62.2%|Medium|| |1448|Count Good Nodes in Binary Tree||70.3%|Medium|| |1449|Form Largest Integer With Digits That Add up to Target||43.8%|Hard|| -|1450|Number of Students Doing Homework at a Given Time||76.9%|Easy|| +|1450|Number of Students Doing Homework at a Given Time||77.0%|Easy|| |1451|Rearrange Words in a Sentence||59.1%|Medium|| |1452|People Whose List of Favorite Companies Is Not a Subset of Another List||54.9%|Medium|| |1453|Maximum Number of Darts Inside of a Circular Dartboard||35.2%|Hard|| @@ -1602,7 +1602,7 @@ |1462|Course Schedule IV||44.4%|Medium|| |1463|Cherry Pickup II||69.4%|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)|76.9%|Easy|| -|1465|Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts||31.8%|Medium|| +|1465|Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts||31.7%|Medium|| |1466|Reorder Routes to Make All Paths Lead to the City Zero||61.3%|Medium|| |1467|Probability of a Two Boxes Having The Same Number of Distinct Balls||60.9%|Hard|| |1468|Calculate Salaries||81.3%|Medium|| @@ -1619,7 +1619,7 @@ |1479|Sales by Day of the Week||83.9%|Hard|| |1480|Running Sum of 1d Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1480.Running-Sum-of-1d-Array)|89.5%|Easy|| |1481|Least Number of Unique Integers after K Removals||55.5%|Medium|| -|1482|Minimum Number of Days to Make m Bouquets||49.7%|Medium|| +|1482|Minimum Number of Days to Make m Bouquets||49.8%|Medium|| |1483|Kth Ancestor of a Tree Node||30.3%|Hard|| |1484|Group Sold Products By The Date||85.9%|Easy|| |1485|Clone Binary Tree With Random Pointer||79.5%|Medium|| @@ -1637,10 +1637,10 @@ |1497|Check If Array Pairs Are Divisible by k||40.5%|Medium|| |1498|Number of Subsequences That Satisfy the Given Sum Condition||38.3%|Medium|| |1499|Max Value of Equation||45.2%|Hard|| -|1500|Design a File Sharing System||46.0%|Medium|| +|1500|Design a File Sharing System||46.1%|Medium|| |1501|Countries You Can Safely Invest In||60.1%|Medium|| |1502|Can Make Arithmetic Progression From Sequence||70.7%|Easy|| -|1503|Last Moment Before All Ants Fall Out of a Plank||53.1%|Medium|| +|1503|Last Moment Before All Ants Fall Out of a Plank||53.0%|Medium|| |1504|Count Submatrices With All Ones||60.9%|Medium|| |1505|Minimum Possible Integer After at Most K Adjacent Swaps On Digits||36.0%|Hard|| |1506|Find Root of N-Ary Tree||80.7%|Medium|| @@ -1657,19 +1657,19 @@ |1517|Find Users With Valid E-Mails||71.8%|Easy|| |1518|Water Bottles||60.7%|Easy|| |1519|Number of Nodes in the Sub-Tree With the Same Label||36.9%|Medium|| -|1520|Maximum Number of Non-Overlapping Substrings||36.0%|Hard|| +|1520|Maximum Number of Non-Overlapping Substrings||36.1%|Hard|| |1521|Find a Value of a Mysterious Function Closest to Target||44.4%|Hard|| -|1522|Diameter of N-Ary Tree||68.9%|Medium|| +|1522|Diameter of N-Ary Tree||68.8%|Medium|| |1523|Count Odd Numbers in an Interval Range||55.0%|Easy|| |1524|Number of Sub-arrays With Odd Sum||39.5%|Medium|| |1525|Number of Good Ways to Split a String||66.7%|Medium|| |1526|Minimum Number of Increments on Subarrays to Form a Target Array||59.8%|Hard|| -|1527|Patients With a Condition||75.0%|Easy|| +|1527|Patients With a Condition||74.9%|Easy|| |1528|Shuffle String||85.7%|Easy|| |1529|Bulb Switcher IV||70.9%|Medium|| |1530|Number of Good Leaf Nodes Pairs||55.8%|Medium|| |1531|String Compression II||33.3%|Hard|| -|1532|The Most Recent Three Orders||73.1%|Medium|| +|1532|The Most Recent Three Orders||73.0%|Medium|| |1533|Find the Index of the Large Integer||54.6%|Medium|| |1534|Count Good Triplets||80.2%|Easy|| |1535|Find the Winner of an Array Game||47.2%|Medium|| @@ -1685,8 +1685,8 @@ |1545|Find Kth Bit in Nth Binary String||57.3%|Medium|| |1546|Maximum Number of Non-Overlapping Subarrays With Sum Equals Target||43.8%|Medium|| |1547|Minimum Cost to Cut a Stick||52.1%|Hard|| -|1548|The Most Similar Path in a Graph||53.8%|Hard|| -|1549|The Most Recent Orders for Each Product||66.3%|Medium|| +|1548|The Most Similar Path in a Graph||53.9%|Hard|| +|1549|The Most Recent Orders for Each Product||66.2%|Medium|| |1550|Three Consecutive Odds||65.3%|Easy|| |1551|Minimum Operations to Make Array Equal||77.8%|Medium|| |1552|Magnetic Force Between Two Balls||48.6%|Medium|| @@ -1695,7 +1695,7 @@ |1555|Bank Account Summary||52.8%|Medium|| |1556|Thousand Separator||58.1%|Easy|| |1557|Minimum Number of Vertices to Reach All Nodes||75.4%|Medium|| -|1558|Minimum Numbers of Function Calls to Make Target Array||62.6%|Medium|| +|1558|Minimum Numbers of Function Calls to Make Target Array||62.5%|Medium|| |1559|Detect Cycles in 2D Grid||44.8%|Hard|| |1560|Most Visited Sector in a Circular Track||57.0%|Easy|| |1561|Maximum Number of Coins You Can Get||78.0%|Medium|| @@ -1722,18 +1722,18 @@ |1582|Special Positions in a Binary Matrix||64.3%|Easy|| |1583|Count Unhappy Friends||53.8%|Medium|| |1584|Min Cost to Connect All Points||50.5%|Medium|| -|1585|Check If String Is Transformable With Substring Sort Operations||48.2%|Hard|| +|1585|Check If String Is Transformable With Substring Sort Operations||48.1%|Hard|| |1586|Binary Search Tree Iterator II||66.3%|Medium|| -|1587|Bank Account Summary II||90.2%|Easy|| -|1588|Sum of All Odd Length Subarrays||81.9%|Easy|| +|1587|Bank Account Summary II||90.3%|Easy|| +|1588|Sum of All Odd Length Subarrays||82.0%|Easy|| |1589|Maximum Sum Obtained of Any Permutation||34.7%|Medium|| |1590|Make Sum Divisible by P||27.3%|Medium|| -|1591|Strange Printer II||55.5%|Hard|| +|1591|Strange Printer II||55.4%|Hard|| |1592|Rearrange Spaces Between Words||43.8%|Easy|| |1593|Split a String Into the Max Number of Unique Substrings||48.3%|Medium|| |1594|Maximum Non Negative Product in a Matrix||31.8%|Medium|| |1595|Minimum Cost to Connect Two Groups of Points||42.8%|Hard|| -|1596|The Most Frequently Ordered Products for Each Customer||84.5%|Medium|| +|1596|The Most Frequently Ordered Products for Each Customer||84.6%|Medium|| |1597|Build Binary Expression Tree From Infix Expression||65.7%|Hard|| |1598|Crawler Log Folder||64.3%|Easy|| |1599|Maximum Profit of Operating a Centennial Wheel||43.5%|Medium|| @@ -1745,22 +1745,22 @@ |1605|Find Valid Matrix Given Row and Column Sums||77.7%|Medium|| |1606|Find Servers That Handled Most Number of Requests||36.8%|Hard|| |1607|Sellers With No Sales||55.9%|Easy|| -|1608|Special Array With X Elements Greater Than or Equal X||61.8%|Easy|| +|1608|Special Array With X Elements Greater Than or Equal X||61.9%|Easy|| |1609|Even Odd Tree||53.2%|Medium|| |1610|Maximum Number of Visible Points||28.6%|Hard|| |1611|Minimum One Bit Operations to Make Integers Zero||57.1%|Hard|| -|1612|Check If Two Expression Trees are Equivalent||69.7%|Medium|| +|1612|Check If Two Expression Trees are Equivalent||69.9%|Medium|| |1613|Find the Missing IDs||72.4%|Medium|| |1614|Maximum Nesting Depth of the Parentheses||83.5%|Easy|| |1615|Maximal Network Rank||51.7%|Medium|| |1616|Split Two Strings to Make Palindrome||36.4%|Medium|| |1617|Count Subtrees With Max Distance Between Cities||63.5%|Hard|| -|1618|Maximum Font to Fit a Sentence in a Screen||58.1%|Medium|| +|1618|Maximum Font to Fit a Sentence in a Screen||58.0%|Medium|| |1619|Mean of Array After Removing Some Elements||65.5%|Easy|| |1620|Coordinate With Maximum Network Quality||37.0%|Medium|| |1621|Number of Sets of K Non-Overlapping Line Segments||41.2%|Medium|| |1622|Fancy Sequence||15.6%|Hard|| -|1623|All Valid Triplets That Can Represent a Country||89.1%|Easy|| +|1623|All Valid Triplets That Can Represent a Country||89.0%|Easy|| |1624|Largest Substring Between Two Equal Characters||59.1%|Easy|| |1625|Lexicographically Smallest String After Applying Operations||63.5%|Medium|| |1626|Best Team With No Conflicts||37.3%|Medium|| @@ -1768,27 +1768,27 @@ |1628|Design an Expression Tree With Evaluate Function||80.5%|Medium|| |1629|Slowest Key||58.9%|Easy|| |1630|Arithmetic Subarrays||77.7%|Medium|| -|1631|Path With Minimum Effort||43.6%|Medium|| -|1632|Rank Transform of a Matrix||30.4%|Hard|| -|1633|Percentage of Users Attended a Contest||73.4%|Easy|| +|1631|Path With Minimum Effort||43.5%|Medium|| +|1632|Rank Transform of a Matrix||30.5%|Hard|| +|1633|Percentage of Users Attended a Contest||73.5%|Easy|| |1634|Add Two Polynomials Represented as Linked Lists||55.7%|Medium|| -|1635|Hopper Company Queries I||56.1%|Hard|| +|1635|Hopper Company Queries I||56.0%|Hard|| |1636|Sort Array by Increasing Frequency||66.7%|Easy|| -|1637|Widest Vertical Area Between Two Points Containing No Points||83.7%|Medium|| -|1638|Count Substrings That Differ by One Character||68.0%|Medium|| +|1637|Widest Vertical Area Between Two Points Containing No Points||83.8%|Medium|| +|1638|Count Substrings That Differ by One Character||68.1%|Medium|| |1639|Number of Ways to Form a Target String Given a Dictionary||39.3%|Hard|| -|1640|Check Array Formation Through Concatenation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1640.Check-Array-Formation-Through-Concatenation)|62.1%|Easy|| -|1641|Count Sorted Vowel Strings|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1641.Count-Sorted-Vowel-Strings)|77.5%|Medium|| +|1640|Check Array Formation Through Concatenation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1640.Check-Array-Formation-Through-Concatenation)|62.2%|Easy|| +|1641|Count Sorted Vowel Strings|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1641.Count-Sorted-Vowel-Strings)|77.7%|Medium|| |1642|Furthest Building You Can Reach||51.3%|Medium|| -|1643|Kth Smallest Instructions||42.9%|Hard|| +|1643|Kth Smallest Instructions||43.0%|Hard|| |1644|Lowest Common Ancestor of a Binary Tree II||57.6%|Medium|| -|1645|Hopper Company Queries II||41.1%|Hard|| -|1646|Get Maximum in Generated Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1646.Get-Maximum-in-Generated-Array)|53.8%|Easy|| +|1645|Hopper Company Queries II||41.2%|Hard|| +|1646|Get Maximum in Generated Array|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1646.Get-Maximum-in-Generated-Array)|53.7%|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)|53.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.2%|Hard|| -|1650|Lowest Common Ancestor of a Binary Tree III||77.5%|Medium|| -|1651|Hopper Company Queries III||67.1%|Hard|| +|1650|Lowest Common Ancestor of a Binary Tree III||77.4%|Medium|| +|1651|Hopper Company Queries III||67.0%|Hard|| |1652|Defuse the Bomb|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1652.Defuse-the-Bomb)|64.2%|Easy|| |1653|Minimum Deletions to Make String Balanced|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1653.Minimum-Deletions-to-Make-String-Balanced)|49.9%|Medium|| |1654|Minimum Jumps to Reach Home|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1654.Minimum-Jumps-to-Reach-Home)|26.3%|Medium|| @@ -1797,17 +1797,17 @@ |1657|Determine if Two Strings Are Close|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1657.Determine-if-Two-Strings-Are-Close)|51.3%|Medium|| |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.4%|Medium|| |1659|Maximize Grid Happiness|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1659.Maximize-Grid-Happiness)|35.1%|Hard|| -|1660|Correct a Binary Tree||79.4%|Medium|| -|1661|Average Time of Process per Machine||79.5%|Easy|| +|1660|Correct a Binary Tree||79.3%|Medium|| +|1661|Average Time of Process per Machine||79.3%|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)|83.6%|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)|60.1%|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)|60.6%|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)|67.8%|Hard|| -|1666|Change the Root of a Binary Tree||68.7%|Medium|| +|1666|Change the Root of a Binary Tree||68.6%|Medium|| |1667|Fix Names in a Table||64.1%|Easy|| -|1668|Maximum Repeating Substring|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1668.Maximum-Repeating-Substring)|38.7%|Easy|| +|1668|Maximum Repeating Substring|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1668.Maximum-Repeating-Substring)|38.8%|Easy|| |1669|Merge In Between Linked Lists|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1669.Merge-In-Between-Linked-Lists)|78.2%|Medium|| -|1670|Design Front Middle Back Queue|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1670.Design-Front-Middle-Back-Queue)|54.6%|Medium|| +|1670|Design Front Middle Back Queue|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1670.Design-Front-Middle-Back-Queue)|54.7%|Medium|| |1671|Minimum Number of Removals to Make Mountain Array||45.7%|Hard|| |1672|Richest Customer Wealth|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1672.Richest-Customer-Wealth)|88.5%|Easy|| |1673|Find the Most Competitive Subsequence|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1673.Find-the-Most-Competitive-Subsequence)|38.3%|Medium|| @@ -1816,15 +1816,15 @@ |1676|Lowest Common Ancestor of a Binary Tree IV||77.9%|Medium|| |1677|Product's Worth Over Invoices||74.7%|Easy|| |1678|Goal Parser Interpretation|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1678.Goal-Parser-Interpretation)|86.7%|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)|51.8%|Medium|| +|1679|Max Number of K-Sum Pairs|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1679.Max-Number-of-K-Sum-Pairs)|54.1%|Medium|| |1680|Concatenation of Consecutive Binary Numbers|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1680.Concatenation-of-Consecutive-Binary-Numbers)|45.1%|Medium|| |1681|Minimum Incompatibility|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1681.Minimum-Incompatibility)|35.0%|Hard|| -|1682|Longest Palindromic Subsequence II||51.5%|Medium|| +|1682|Longest Palindromic Subsequence II||51.7%|Medium|| |1683|Invalid Tweets||91.2%|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)|84.3%|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)|84.1%|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)|61.8%|Medium|| |1686|Stone Game VI||48.8%|Medium|| -|1687|Delivering Boxes from Storage to Ports||34.7%|Hard|| +|1687|Delivering Boxes from Storage to Ports||34.8%|Hard|| |1688|Count of Matches in Tournament|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1688.Count-of-Matches-in-Tournament)|83.1%|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.0%|Medium|| |1690|Stone Game VII|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1690.Stone-Game-VII)|46.6%|Medium|| @@ -1835,38 +1835,38 @@ |1695|Maximum Erasure Value|[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/1695.Maximum-Erasure-Value)|49.5%|Medium|| |1696|Jump Game VI||55.3%|Medium|| |1697|Checking Existence of Edge Length Limited Paths||56.3%|Hard|| -|1698|Number of Distinct Substrings in a String||55.4%|Medium|| -|1699|Number of Calls Between Two Persons||86.1%|Medium|| -|1700|Number of Students Unable to Eat Lunch||70.0%|Easy|| +|1698|Number of Distinct Substrings in a String||55.5%|Medium|| +|1699|Number of Calls Between Two Persons||86.2%|Medium|| +|1700|Number of Students Unable to Eat Lunch||70.1%|Easy|| |1701|Average Waiting Time||61.6%|Medium|| -|1702|Maximum Binary String After Change||61.6%|Medium|| +|1702|Maximum Binary String After Change||61.5%|Medium|| |1703|Minimum Adjacent Swaps for K Consecutive Ones||40.8%|Hard|| |1704|Determine if String Halves Are Alike||78.2%|Easy|| |1705|Maximum Number of Eaten Apples||42.3%|Medium|| -|1706|Where Will the Ball Fall||58.3%|Medium|| -|1707|Maximum XOR With an Element From Array||48.1%|Hard|| -|1708|Largest Subarray Length K||64.0%|Easy|| +|1706|Where Will the Ball Fall||58.4%|Medium|| +|1707|Maximum XOR With an Element From Array||48.0%|Hard|| +|1708|Largest Subarray Length K||64.2%|Easy|| |1709|Biggest Window Between Visits||82.0%|Medium|| |1710|Maximum Units on a Truck||71.6%|Easy|| |1711|Count Good Meals||25.5%|Medium|| |1712|Ways to Split Array Into Three Subarrays||29.7%|Medium|| -|1713|Minimum Operations to Make a Subsequence||45.4%|Hard|| +|1713|Minimum Operations to Make a Subsequence||45.5%|Hard|| |1714|Sum Of Special Evenly-Spaced Elements In Array||47.2%|Hard|| |1715|Count Apples and Oranges||78.2%|Medium|| -|1716|Calculate Money in Leetcode Bank||69.4%|Easy|| +|1716|Calculate Money in Leetcode Bank||69.5%|Easy|| |1717|Maximum Score From Removing Substrings||38.0%|Medium|| -|1718|Construct the Lexicographically Largest Valid Sequence||42.9%|Medium|| -|1719|Number Of Ways To Reconstruct A Tree||39.8%|Hard|| -|1720|Decode XORed Array||86.3%|Easy|| -|1721|Swapping Nodes in a Linked List||65.7%|Medium|| +|1718|Construct the Lexicographically Largest Valid Sequence||43.1%|Medium|| +|1719|Number Of Ways To Reconstruct A Tree||39.9%|Hard|| +|1720|Decode XORed Array||86.4%|Easy|| +|1721|Swapping Nodes in a Linked List||65.8%|Medium|| |1722|Minimize Hamming Distance After Swap Operations||56.8%|Medium|| |1723|Find Minimum Time to Finish All Jobs||44.5%|Hard|| -|1724|Checking Existence of Edge Length Limited Paths II||58.5%|Hard|| +|1724|Checking Existence of Edge Length Limited Paths II||58.2%|Hard|| |1725|Number Of Rectangles That Can Form The Largest Square||77.4%|Easy|| -|1726|Tuple with Same Product||50.3%|Medium|| -|1727|Largest Submatrix With Rearrangements||53.9%|Medium|| -|1728|Cat and Mouse II||33.9%|Hard|| -|1729|Find Followers Count||68.3%|Easy|| +|1726|Tuple with Same Product||51.2%|Medium|| +|1727|Largest Submatrix With Rearrangements||54.8%|Medium|| +|1728|Cat and Mouse II||34.9%|Hard|| +|1729|Find Followers Count||70.2%|Easy|| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------| ------------------------------------------------------------------ diff --git a/leetcode/1203.Sort-Items-by-Groups-Respecting-Dependencies/1203. Sort Items by Groups Respecting Dependencies.go b/leetcode/1203.Sort-Items-by-Groups-Respecting-Dependencies/1203. Sort Items by Groups Respecting Dependencies.go new file mode 100644 index 00000000..07a715b8 --- /dev/null +++ b/leetcode/1203.Sort-Items-by-Groups-Respecting-Dependencies/1203. Sort Items by Groups Respecting Dependencies.go @@ -0,0 +1,123 @@ +package leetcode + +// 解法一 拓扑排序版的 DFS +func sortItems(n int, m int, group []int, beforeItems [][]int) []int { + groups, inDegrees := make([][]int, n+m), make([]int, n+m) + for i, g := range group { + if g > -1 { + g += n + groups[g] = append(groups[g], i) + inDegrees[i]++ + } + } + for i, ancestors := range beforeItems { + gi := group[i] + if gi == -1 { + gi = i + } else { + gi += n + } + for _, ancestor := range ancestors { + ga := group[ancestor] + if ga == -1 { + ga = ancestor + } else { + ga += n + } + if gi == ga { + groups[ancestor] = append(groups[ancestor], i) + inDegrees[i]++ + } else { + groups[ga] = append(groups[ga], gi) + inDegrees[gi]++ + } + } + } + res := []int{} + for i, d := range inDegrees { + if d == 0 { + sortItemsDFS(i, n, &res, &inDegrees, &groups) + } + } + if len(res) != n { + return nil + } + return res +} + +func sortItemsDFS(i, n int, res, inDegrees *[]int, groups *[][]int) { + if i < n { + *res = append(*res, i) + } + (*inDegrees)[i] = -1 + for _, ch := range (*groups)[i] { + if (*inDegrees)[ch]--; (*inDegrees)[ch] == 0 { + sortItemsDFS(ch, n, res, inDegrees, groups) + } + } +} + +// 解法二 二维拓扑排序 时间复杂度 O(m+n),空间复杂度 O(m+n) +func sortItems1(n int, m int, group []int, beforeItems [][]int) []int { + groupItems, res := map[int][]int{}, []int{} + for i := 0; i < len(group); i++ { + if group[i] == -1 { + group[i] = m + i + } + groupItems[group[i]] = append(groupItems[group[i]], i) + } + groupGraph, groupDegree, itemGraph, itemDegree := make([][]int, m+n), make([]int, m+n), make([][]int, n), make([]int, n) + for i := 0; i < len(beforeItems); i++ { + for j := 0; j < len(beforeItems[i]); j++ { + if group[beforeItems[i][j]] != group[i] { + // 不同组项目,确定组间依赖关系 + groupGraph[group[beforeItems[i][j]]] = append(groupGraph[group[beforeItems[i][j]]], group[i]) + groupDegree[group[i]]++ + } else { + // 同组项目,确定组内依赖关系 + itemGraph[beforeItems[i][j]] = append(itemGraph[beforeItems[i][j]], i) + itemDegree[i]++ + } + } + } + items := []int{} + for i := 0; i < m+n; i++ { + items = append(items, i) + } + // 组间拓扑 + groupOrders := topSort(groupGraph, groupDegree, items) + if len(groupOrders) < len(items) { + return nil + } + for i := 0; i < len(groupOrders); i++ { + items := groupItems[groupOrders[i]] + // 组内拓扑 + orders := topSort(itemGraph, itemDegree, items) + if len(orders) < len(items) { + return nil + } + res = append(res, orders...) + } + return res +} + +func topSort(graph [][]int, deg, items []int) (orders []int) { + q := []int{} + for _, i := range items { + if deg[i] == 0 { + q = append(q, i) + } + } + for len(q) > 0 { + from := q[0] + q = q[1:] + orders = append(orders, from) + for _, to := range graph[from] { + deg[to]-- + if deg[to] == 0 { + q = append(q, to) + } + } + } + return +} diff --git a/leetcode/1203.Sort-Items-by-Groups-Respecting-Dependencies/1203. Sort Items by Groups Respecting Dependencies_test.go b/leetcode/1203.Sort-Items-by-Groups-Respecting-Dependencies/1203. Sort Items by Groups Respecting Dependencies_test.go new file mode 100644 index 00000000..6abb3b54 --- /dev/null +++ b/leetcode/1203.Sort-Items-by-Groups-Respecting-Dependencies/1203. Sort Items by Groups Respecting Dependencies_test.go @@ -0,0 +1,50 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question1203 struct { + para1203 + ans1203 +} + +// para 是参数 +// one 代表第一个参数 +type para1203 struct { + n int + m int + group []int + beforeItems [][]int +} + +// ans 是答案 +// one 代表第一个答案 +type ans1203 struct { + one []int +} + +func Test_Problem1203(t *testing.T) { + + qs := []question1203{ + + { + para1203{8, 2, []int{-1, -1, 1, 0, 0, 1, 0, -1}, [][]int{{}, {6}, {5}, {6}, {3, 6}, {}, {}, {}}}, + ans1203{[]int{6, 3, 4, 5, 2, 0, 7, 1}}, + }, + + { + para1203{8, 2, []int{-1, -1, 1, 0, 0, 1, 0, -1}, [][]int{{}, {6}, {5}, {6}, {3}, {}, {4}, {}}}, + ans1203{[]int{}}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 1203------------------------\n") + + for _, q := range qs { + _, p := q.ans1203, q.para1203 + fmt.Printf("【input】:%v 【output】:%v\n", p, sortItems1(p.n, p.m, p.group, p.beforeItems)) + } + fmt.Printf("\n\n\n") +} diff --git a/leetcode/1203.Sort-Items-by-Groups-Respecting-Dependencies/README.md b/leetcode/1203.Sort-Items-by-Groups-Respecting-Dependencies/README.md new file mode 100644 index 00000000..3fec764b --- /dev/null +++ b/leetcode/1203.Sort-Items-by-Groups-Respecting-Dependencies/README.md @@ -0,0 +1,191 @@ +# [1203. Sort Items by Groups Respecting Dependencies](https://leetcode.com/problems/sort-items-by-groups-respecting-dependencies/) + + +## 题目 + +There are `n` items each belonging to zero or one of `m` groups where `group[i]` is the group that the `i`-th item belongs to and it's equal to `-1` if the `i`-th item belongs to no group. The items and the groups are zero indexed. A group can have no item belonging to it. + +Return a sorted list of the items such that: + +- The items that belong to the same group are next to each other in the sorted list. +- There are some relations between these items where `beforeItems[i]` is a list containing all the items that should come before the `i`th item in the sorted array (to the left of the `i`th item). + +Return any solution if there is more than one solution and return an **empty list** if there is no solution. + +**Example 1:** + + + +``` +Input: n = 8, m = 2, group = [-1,-1,1,0,0,1,0,-1], beforeItems = [[],[6],[5],[6],[3,6],[],[],[]] +Output: [6,3,4,1,5,2,0,7] + +``` + +**Example 2:** + +``` +Input: n = 8, m = 2, group = [-1,-1,1,0,0,1,0,-1], beforeItems = [[],[6],[5],[6],[3],[],[4],[]] +Output: [] +Explanation: This is the same as example 1 except that 4 needs to be before 6 in the sorted list. + +``` + +**Constraints:** + +- `1 <= m <= n <= 3 * 104` +- `group.length == beforeItems.length == n` +- `1 <= group[i] <= m - 1` +- `0 <= beforeItems[i].length <= n - 1` +- `0 <= beforeItems[i][j] <= n - 1` +- `i != beforeItems[i][j]` +- `beforeItems[i]` does not contain duplicates elements. + +## 题目大意 + +有 n 个项目,每个项目或者不属于任何小组,或者属于 m 个小组之一。group[i] 表示第 i 个小组所属的小组,如果第 i 个项目不属于任何小组,则 group[i] 等于 -1。项目和小组都是从零开始编号的。可能存在小组不负责任何项目,即没有任何项目属于这个小组。 + +请你帮忙按要求安排这些项目的进度,并返回排序后的项目列表: + +- 同一小组的项目,排序后在列表中彼此相邻。 +- 项目之间存在一定的依赖关系,我们用一个列表 beforeItems 来表示,其中 beforeItems[i] 表示在进行第 i 个项目前(位于第 i 个项目左侧)应该完成的所有项目。 + +如果存在多个解决方案,只需要返回其中任意一个即可。如果没有合适的解决方案,就请返回一个 空列表 。 + +## 解题思路 + +- 读完题能确定这一题是拓扑排序。但是和单纯的拓扑排序有区别的是,同一小组内的项目需要彼此相邻。用 2 次拓扑排序即可解决。第一次拓扑排序排出组间的顺序,第二次拓扑排序排出组内的顺序。为了实现方便,用 map 给虚拟分组标记编号。如下图,将 3,4,6 三个任务打包到 0 号分组里面,将 2,5 两个任务打包到 1 号分组里面,其他任务单独各自为一组。组间的依赖是 6 号任务依赖 1 号任务。由于 6 号任务封装在 0 号分组里,所以 3 号分组依赖 0 号分组。先组间排序,确定分组顺序,再组内拓扑排序,排出最终顺序。 + +  + +- 上面的解法可以 AC,但是时间太慢了。因为做了一些不必要的操作。有没有可能只用一次拓扑排序呢?将必须要在一起的结点统一依赖一个虚拟结点,例如下图中的虚拟结点 8 和 9 。3,4,6 都依赖 8 号任务,2 和 5 都依赖 9 号任务。1 号任务本来依赖 6 号任务,由于 6 由依赖 8 ,所以添加 1 依赖 8 的边。通过增加虚拟结点,增加了需要打包在一起结点的入度。构建出以上关系以后,按照入度为 0 的原则,依次进行 DFS。8 号和 9 号两个虚拟结点的入度都为 0 ,对它们进行 DFS,必定会使得与它关联的节点都被安排在一起,这样就满足了题意:同一小组的项目,排序后在列表中彼此相邻。一遍扫完,满足题意的顺序就排出来了。这个解法 beat 100%! + +  + +## 代码 + +```go +package leetcode + +// 解法一 拓扑排序版的 DFS +func sortItems(n int, m int, group []int, beforeItems [][]int) []int { + groups, inDegrees := make([][]int, n+m), make([]int, n+m) + for i, g := range group { + if g > -1 { + g += n + groups[g] = append(groups[g], i) + inDegrees[i]++ + } + } + for i, ancestors := range beforeItems { + gi := group[i] + if gi == -1 { + gi = i + } else { + gi += n + } + for _, ancestor := range ancestors { + ga := group[ancestor] + if ga == -1 { + ga = ancestor + } else { + ga += n + } + if gi == ga { + groups[ancestor] = append(groups[ancestor], i) + inDegrees[i]++ + } else { + groups[ga] = append(groups[ga], gi) + inDegrees[gi]++ + } + } + } + res := []int{} + for i, d := range inDegrees { + if d == 0 { + sortItemsDFS(i, n, &res, &inDegrees, &groups) + } + } + if len(res) != n { + return nil + } + return res +} + +func sortItemsDFS(i, n int, res, inDegrees *[]int, groups *[][]int) { + if i < n { + *res = append(*res, i) + } + (*inDegrees)[i] = -1 + for _, ch := range (*groups)[i] { + if (*inDegrees)[ch]--; (*inDegrees)[ch] == 0 { + sortItemsDFS(ch, n, res, inDegrees, groups) + } + } +} + +// 解法二 二维拓扑排序 时间复杂度 O(m+n),空间复杂度 O(m+n) +func sortItems1(n int, m int, group []int, beforeItems [][]int) []int { + groupItems, res := map[int][]int{}, []int{} + for i := 0; i < len(group); i++ { + if group[i] == -1 { + group[i] = m + i + } + groupItems[group[i]] = append(groupItems[group[i]], i) + } + groupGraph, groupDegree, itemGraph, itemDegree := make([][]int, m+n), make([]int, m+n), make([][]int, n), make([]int, n) + for i := 0; i < len(beforeItems); i++ { + for j := 0; j < len(beforeItems[i]); j++ { + if group[beforeItems[i][j]] != group[i] { + // 不同组项目,确定组间依赖关系 + groupGraph[group[beforeItems[i][j]]] = append(groupGraph[group[beforeItems[i][j]]], group[i]) + groupDegree[group[i]]++ + } else { + // 同组项目,确定组内依赖关系 + itemGraph[beforeItems[i][j]] = append(itemGraph[beforeItems[i][j]], i) + itemDegree[i]++ + } + } + } + items := []int{} + for i := 0; i < m+n; i++ { + items = append(items, i) + } + // 组间拓扑 + groupOrders := topSort(groupGraph, groupDegree, items) + if len(groupOrders) < len(items) { + return nil + } + for i := 0; i < len(groupOrders); i++ { + items := groupItems[groupOrders[i]] + // 组内拓扑 + orders := topSort(itemGraph, itemDegree, items) + if len(orders) < len(items) { + return nil + } + res = append(res, orders...) + } + return res +} + +func topSort(graph [][]int, deg, items []int) (orders []int) { + q := []int{} + for _, i := range items { + if deg[i] == 0 { + q = append(q, i) + } + } + for len(q) > 0 { + from := q[0] + q = q[1:] + orders = append(orders, from) + for _, to := range graph[from] { + deg[to]-- + if deg[to] == 0 { + q = append(q, to) + } + } + } + return +} +``` \ No newline at end of file diff --git a/website/content/ChapterFour/1202.Smallest-String-With-Swaps.md b/website/content/ChapterFour/1202.Smallest-String-With-Swaps.md index f82a83f8..903771e8 100755 --- a/website/content/ChapterFour/1202.Smallest-String-With-Swaps.md +++ b/website/content/ChapterFour/1202.Smallest-String-With-Swaps.md @@ -105,5 +105,5 @@ func smallestStringWithSwaps(s string, pairs [][]int) string { ----------------------------------------------
diff --git a/website/content/ChapterFour/1203.Sort-Items-by-Groups-Respecting-Dependencies.md b/website/content/ChapterFour/1203.Sort-Items-by-Groups-Respecting-Dependencies.md new file mode 100644 index 00000000..4e8cd26c --- /dev/null +++ b/website/content/ChapterFour/1203.Sort-Items-by-Groups-Respecting-Dependencies.md @@ -0,0 +1,198 @@ +# [1203. Sort Items by Groups Respecting Dependencies](https://leetcode.com/problems/sort-items-by-groups-respecting-dependencies/) + + +## 题目 + +There are `n` items each belonging to zero or one of `m` groups where `group[i]` is the group that the `i`-th item belongs to and it's equal to `-1` if the `i`-th item belongs to no group. The items and the groups are zero indexed. A group can have no item belonging to it. + +Return a sorted list of the items such that: + +- The items that belong to the same group are next to each other in the sorted list. +- There are some relations between these items where `beforeItems[i]` is a list containing all the items that should come before the `i`th item in the sorted array (to the left of the `i`th item). + +Return any solution if there is more than one solution and return an **empty list** if there is no solution. + +**Example 1:** + + + +``` +Input: n = 8, m = 2, group = [-1,-1,1,0,0,1,0,-1], beforeItems = [[],[6],[5],[6],[3,6],[],[],[]] +Output: [6,3,4,1,5,2,0,7] + +``` + +**Example 2:** + +``` +Input: n = 8, m = 2, group = [-1,-1,1,0,0,1,0,-1], beforeItems = [[],[6],[5],[6],[3],[],[4],[]] +Output: [] +Explanation: This is the same as example 1 except that 4 needs to be before 6 in the sorted list. + +``` + +**Constraints:** + +- `1 <= m <= n <= 3 * 104` +- `group.length == beforeItems.length == n` +- `1 <= group[i] <= m - 1` +- `0 <= beforeItems[i].length <= n - 1` +- `0 <= beforeItems[i][j] <= n - 1` +- `i != beforeItems[i][j]` +- `beforeItems[i]` does not contain duplicates elements. + +## 题目大意 + +有 n 个项目,每个项目或者不属于任何小组,或者属于 m 个小组之一。group[i] 表示第 i 个小组所属的小组,如果第 i 个项目不属于任何小组,则 group[i] 等于 -1。项目和小组都是从零开始编号的。可能存在小组不负责任何项目,即没有任何项目属于这个小组。 + +请你帮忙按要求安排这些项目的进度,并返回排序后的项目列表: + +- 同一小组的项目,排序后在列表中彼此相邻。 +- 项目之间存在一定的依赖关系,我们用一个列表 beforeItems 来表示,其中 beforeItems[i] 表示在进行第 i 个项目前(位于第 i 个项目左侧)应该完成的所有项目。 + +如果存在多个解决方案,只需要返回其中任意一个即可。如果没有合适的解决方案,就请返回一个 空列表 。 + +## 解题思路 + +- 读完题能确定这一题是拓扑排序。但是和单纯的拓扑排序有区别的是,同一小组内的项目需要彼此相邻。用 2 次拓扑排序即可解决。第一次拓扑排序排出组间的顺序,第二次拓扑排序排出组内的顺序。为了实现方便,用 map 给虚拟分组标记编号。如下图,将 3,4,6 三个任务打包到 0 号分组里面,将 2,5 两个任务打包到 1 号分组里面,其他任务单独各自为一组。组间的依赖是 6 号任务依赖 1 号任务。由于 6 号任务封装在 0 号分组里,所以 3 号分组依赖 0 号分组。先组间排序,确定分组顺序,再组内拓扑排序,排出最终顺序。 + +  + +- 上面的解法可以 AC,但是时间太慢了。因为做了一些不必要的操作。有没有可能只用一次拓扑排序呢?将必须要在一起的结点统一依赖一个虚拟结点,例如下图中的虚拟结点 8 和 9 。3,4,6 都依赖 8 号任务,2 和 5 都依赖 9 号任务。1 号任务本来依赖 6 号任务,由于 6 由依赖 8 ,所以添加 1 依赖 8 的边。通过增加虚拟结点,增加了需要打包在一起结点的入度。构建出以上关系以后,按照入度为 0 的原则,依次进行 DFS。8 号和 9 号两个虚拟结点的入度都为 0 ,对它们进行 DFS,必定会使得与它关联的节点都被安排在一起,这样就满足了题意:同一小组的项目,排序后在列表中彼此相邻。一遍扫完,满足题意的顺序就排出来了。这个解法 beat 100%! + +  + +## 代码 + +```go +package leetcode + +// 解法一 拓扑排序版的 DFS +func sortItems(n int, m int, group []int, beforeItems [][]int) []int { + groups, inDegrees := make([][]int, n+m), make([]int, n+m) + for i, g := range group { + if g > -1 { + g += n + groups[g] = append(groups[g], i) + inDegrees[i]++ + } + } + for i, ancestors := range beforeItems { + gi := group[i] + if gi == -1 { + gi = i + } else { + gi += n + } + for _, ancestor := range ancestors { + ga := group[ancestor] + if ga == -1 { + ga = ancestor + } else { + ga += n + } + if gi == ga { + groups[ancestor] = append(groups[ancestor], i) + inDegrees[i]++ + } else { + groups[ga] = append(groups[ga], gi) + inDegrees[gi]++ + } + } + } + res := []int{} + for i, d := range inDegrees { + if d == 0 { + sortItemsDFS(i, n, &res, &inDegrees, &groups) + } + } + if len(res) != n { + return nil + } + return res +} + +func sortItemsDFS(i, n int, res, inDegrees *[]int, groups *[][]int) { + if i < n { + *res = append(*res, i) + } + (*inDegrees)[i] = -1 + for _, ch := range (*groups)[i] { + if (*inDegrees)[ch]--; (*inDegrees)[ch] == 0 { + sortItemsDFS(ch, n, res, inDegrees, groups) + } + } +} + +// 解法二 二维拓扑排序 时间复杂度 O(m+n),空间复杂度 O(m+n) +func sortItems1(n int, m int, group []int, beforeItems [][]int) []int { + groupItems, res := map[int][]int{}, []int{} + for i := 0; i < len(group); i++ { + if group[i] == -1 { + group[i] = m + i + } + groupItems[group[i]] = append(groupItems[group[i]], i) + } + groupGraph, groupDegree, itemGraph, itemDegree := make([][]int, m+n), make([]int, m+n), make([][]int, n), make([]int, n) + for i := 0; i < len(beforeItems); i++ { + for j := 0; j < len(beforeItems[i]); j++ { + if group[beforeItems[i][j]] != group[i] { + // 不同组项目,确定组间依赖关系 + groupGraph[group[beforeItems[i][j]]] = append(groupGraph[group[beforeItems[i][j]]], group[i]) + groupDegree[group[i]]++ + } else { + // 同组项目,确定组内依赖关系 + itemGraph[beforeItems[i][j]] = append(itemGraph[beforeItems[i][j]], i) + itemDegree[i]++ + } + } + } + items := []int{} + for i := 0; i < m+n; i++ { + items = append(items, i) + } + // 组间拓扑 + groupOrders := topSort(groupGraph, groupDegree, items) + if len(groupOrders) < len(items) { + return nil + } + for i := 0; i < len(groupOrders); i++ { + items := groupItems[groupOrders[i]] + // 组内拓扑 + orders := topSort(itemGraph, itemDegree, items) + if len(orders) < len(items) { + return nil + } + res = append(res, orders...) + } + return res +} + +func topSort(graph [][]int, deg, items []int) (orders []int) { + q := []int{} + for _, i := range items { + if deg[i] == 0 { + q = append(q, i) + } + } + for len(q) > 0 { + from := q[0] + q = q[1:] + orders = append(orders, from) + for _, to := range graph[from] { + deg[to]-- + if deg[to] == 0 { + q = append(q, to) + } + } + } + return +} +``` + + +---------------------------------------------- + diff --git a/website/content/ChapterFour/1207.Unique-Number-of-Occurrences.md b/website/content/ChapterFour/1207.Unique-Number-of-Occurrences.md index a4d435fe..1b3aff67 100755 --- a/website/content/ChapterFour/1207.Unique-Number-of-Occurrences.md +++ b/website/content/ChapterFour/1207.Unique-Number-of-Occurrences.md @@ -70,6 +70,6 @@ func uniqueOccurrences(arr []int) bool { ---------------------------------------------- diff --git a/website/content/ChapterTwo/Array.md b/website/content/ChapterTwo/Array.md index 02480245..82110657 100644 --- a/website/content/ChapterTwo/Array.md +++ b/website/content/ChapterTwo/Array.md @@ -42,7 +42,7 @@ type: docs |0084|Largest Rectangle in Histogram|[Go]({{< relref "/ChapterFour/0084.Largest-Rectangle-in-Histogram.md" >}})|Hard| O(n)| O(n)|❤️|36.8%| |0088|Merge Sorted Array|[Go]({{< relref "/ChapterFour/0088.Merge-Sorted-Array.md" >}})|Easy| O(n)| O(1)|❤️|40.6%| |0090|Subsets II|[Go]({{< relref "/ChapterFour/0090.Subsets-II.md" >}})|Medium| O(n^2)| O(n)|❤️|48.5%| -|0105|Construct Binary Tree from Preorder and Inorder Traversal|[Go]({{< relref "/ChapterFour/0105.Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.md" >}})|Medium||||51.2%| +|0105|Construct Binary Tree from Preorder and Inorder Traversal|[Go]({{< relref "/ChapterFour/0105.Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.md" >}})|Medium||||51.3%| |0106|Construct Binary Tree from Inorder and Postorder Traversal|[Go]({{< relref "/ChapterFour/0106.Construct-Binary-Tree-from-Inorder-and-Postorder-Traversal.md" >}})|Medium||||49.2%| |0118|Pascal's Triangle|[Go]({{< relref "/ChapterFour/0118.Pascals-Triangle.md" >}})|Easy||||54.4%| |0120|Triangle|[Go]({{< relref "/ChapterFour/0120.Triangle.md" >}})|Medium| O(n^2)| O(n)||45.5%| @@ -78,7 +78,7 @@ type: docs |0628|Maximum Product of Three Numbers|[Go]({{< relref "/ChapterFour/0628.Maximum-Product-of-Three-Numbers.md" >}})|Easy| O(n)| O(1)||47.0%| |0661|Image Smoother|[Go]({{< relref "/ChapterFour/0661.Image-Smoother.md" >}})|Easy||||52.2%| |0695|Max Area of Island|[Go]({{< relref "/ChapterFour/0695.Max-Area-of-Island.md" >}})|Medium||||64.3%| -|0697|Degree of an Array|[Go]({{< relref "/ChapterFour/0697.Degree-of-an-Array.md" >}})|Easy||||54.3%| +|0697|Degree of an Array|[Go]({{< relref "/ChapterFour/0697.Degree-of-an-Array.md" >}})|Easy||||54.4%| |0713|Subarray Product Less Than K|[Go]({{< relref "/ChapterFour/0713.Subarray-Product-Less-Than-K.md" >}})|Medium| O(n)| O(1)||40.4%| |0714|Best Time to Buy and Sell Stock with Transaction Fee|[Go]({{< relref "/ChapterFour/0714.Best-Time-to-Buy-and-Sell-Stock-with-Transaction-Fee.md" >}})|Medium| O(n)| O(1)||55.9%| |0717|1-bit and 2-bit Characters|[Go]({{< relref "/ChapterFour/0717.1-bit-and-2-bit-Characters.md" >}})|Easy||||47.6%| @@ -107,7 +107,7 @@ type: docs |1011|Capacity To Ship Packages Within D Days|[Go]({{< relref "/ChapterFour/1011.Capacity-To-Ship-Packages-Within-D-Days.md" >}})|Medium||||59.5%| |1018|Binary Prefix Divisible By 5|[Go]({{< relref "/ChapterFour/1018.Binary-Prefix-Divisible-By-5.md" >}})|Easy||||47.9%| |1040|Moving Stones Until Consecutive II|[Go]({{< relref "/ChapterFour/1040.Moving-Stones-Until-Consecutive-II.md" >}})|Medium||||53.9%| -|1051|Height Checker|[Go]({{< relref "/ChapterFour/1051.Height-Checker.md" >}})|Easy||||71.8%| +|1051|Height Checker|[Go]({{< relref "/ChapterFour/1051.Height-Checker.md" >}})|Easy||||71.9%| |1052|Grumpy Bookstore Owner|[Go]({{< relref "/ChapterFour/1052.Grumpy-Bookstore-Owner.md" >}})|Medium||||55.7%| |1074|Number of Submatrices That Sum to Target|[Go]({{< relref "/ChapterFour/1074.Number-of-Submatrices-That-Sum-to-Target.md" >}})|Hard||||61.5%| |1089|Duplicate Zeros|[Go]({{< relref "/ChapterFour/1089.Duplicate-Zeros.md" >}})|Easy||||52.0%| @@ -133,7 +133,7 @@ type: docs |1300|Sum of Mutated Array Closest to Target|[Go]({{< relref "/ChapterFour/1300.Sum-of-Mutated-Array-Closest-to-Target.md" >}})|Medium||||43.3%| |1304|Find N Unique Integers Sum up to Zero|[Go]({{< relref "/ChapterFour/1304.Find-N-Unique-Integers-Sum-up-to-Zero.md" >}})|Easy||||76.6%| |1313|Decompress Run-Length Encoded List|[Go]({{< relref "/ChapterFour/1313.Decompress-Run-Length-Encoded-List.md" >}})|Easy||||85.3%| -|1380|Lucky Numbers in a Matrix|[Go]({{< relref "/ChapterFour/1380.Lucky-Numbers-in-a-Matrix.md" >}})|Easy||||70.9%| +|1380|Lucky Numbers in a Matrix|[Go]({{< relref "/ChapterFour/1380.Lucky-Numbers-in-a-Matrix.md" >}})|Easy||||70.8%| |1385|Find the Distance Value Between Two Arrays|[Go]({{< relref "/ChapterFour/1385.Find-the-Distance-Value-Between-Two-Arrays.md" >}})|Easy||||66.4%| |1389|Create Target Array in the Given Order|[Go]({{< relref "/ChapterFour/1389.Create-Target-Array-in-the-Given-Order.md" >}})|Easy||||84.7%| |1464|Maximum Product of Two Elements in an Array|[Go]({{< relref "/ChapterFour/1464.Maximum-Product-of-Two-Elements-in-an-Array.md" >}})|Easy||||76.9%| @@ -141,8 +141,8 @@ type: docs |1480|Running Sum of 1d Array|[Go]({{< relref "/ChapterFour/1480.Running-Sum-of-1d-Array.md" >}})|Easy||||89.5%| |1512|Number of Good Pairs|[Go]({{< relref "/ChapterFour/1512.Number-of-Good-Pairs.md" >}})|Easy||||87.9%| |1539|Kth Missing Positive Number|[Go]({{< relref "/ChapterFour/1539.Kth-Missing-Positive-Number.md" >}})|Easy||||55.3%| -|1640|Check Array Formation Through Concatenation|[Go]({{< relref "/ChapterFour/1640.Check-Array-Formation-Through-Concatenation.md" >}})|Easy||||62.1%| -|1646|Get Maximum in Generated Array|[Go]({{< relref "/ChapterFour/1646.Get-Maximum-in-Generated-Array.md" >}})|Easy||||53.8%| +|1640|Check Array Formation Through Concatenation|[Go]({{< relref "/ChapterFour/1640.Check-Array-Formation-Through-Concatenation.md" >}})|Easy||||62.2%| +|1646|Get Maximum in Generated Array|[Go]({{< relref "/ChapterFour/1646.Get-Maximum-in-Generated-Array.md" >}})|Easy||||53.7%| |1652|Defuse the Bomb|[Go]({{< relref "/ChapterFour/1652.Defuse-the-Bomb.md" >}})|Easy||||64.2%| |1656|Design an Ordered Stream|[Go]({{< relref "/ChapterFour/1656.Design-an-Ordered-Stream.md" >}})|Easy||||82.4%| |1672|Richest Customer Wealth|[Go]({{< relref "/ChapterFour/1672.Richest-Customer-Wealth.md" >}})|Easy||||88.5%| diff --git a/website/content/ChapterTwo/Backtracking.md b/website/content/ChapterTwo/Backtracking.md index bb044419..746f23ee 100644 --- a/website/content/ChapterTwo/Backtracking.md +++ b/website/content/ChapterTwo/Backtracking.md @@ -129,7 +129,7 @@ func updateMatrix_BFS(matrix [][]int) [][]int { |0980|Unique Paths III|[Go]({{< relref "/ChapterFour/0980.Unique-Paths-III.md" >}})|Hard| O(n log n)| O(n)||77.2%| |0996|Number of Squareful Arrays|[Go]({{< relref "/ChapterFour/0996.Number-of-Squareful-Arrays.md" >}})|Hard| O(n log n)| O(n) ||48.0%| |1079|Letter Tile Possibilities|[Go]({{< relref "/ChapterFour/1079.Letter-Tile-Possibilities.md" >}})|Medium| O(n^2)| O(1)|❤️|75.8%| -|1641|Count Sorted Vowel Strings|[Go]({{< relref "/ChapterFour/1641.Count-Sorted-Vowel-Strings.md" >}})|Medium||||77.6%| +|1641|Count Sorted Vowel Strings|[Go]({{< relref "/ChapterFour/1641.Count-Sorted-Vowel-Strings.md" >}})|Medium||||77.7%| |1655|Distribute Repeating Integers|[Go]({{< relref "/ChapterFour/1655.Distribute-Repeating-Integers.md" >}})|Hard||||40.5%| |1659|Maximize Grid Happiness|[Go]({{< relref "/ChapterFour/1659.Maximize-Grid-Happiness.md" >}})|Hard||||35.1%| |1681|Minimum Incompatibility|[Go]({{< relref "/ChapterFour/1681.Minimum-Incompatibility.md" >}})|Hard||||35.0%| diff --git a/website/content/ChapterTwo/Binary_Search.md b/website/content/ChapterTwo/Binary_Search.md index d02f81bc..1244690e 100644 --- a/website/content/ChapterTwo/Binary_Search.md +++ b/website/content/ChapterTwo/Binary_Search.md @@ -166,7 +166,7 @@ func peakIndexInMountainArray(A []int) int { |0475|Heaters|[Go]({{< relref "/ChapterFour/0475.Heaters.md" >}})|Medium||||33.5%| |0483|Smallest Good Base|[Go]({{< relref "/ChapterFour/0483.Smallest-Good-Base.md" >}})|Hard||||36.2%| |0493|Reverse Pairs|[Go]({{< relref "/ChapterFour/0493.Reverse-Pairs.md" >}})|Hard||||26.6%| -|0497|Random Point in Non-overlapping Rectangles|[Go]({{< relref "/ChapterFour/0497.Random-Point-in-Non-overlapping-Rectangles.md" >}})|Medium||||39.1%| +|0497|Random Point in Non-overlapping Rectangles|[Go]({{< relref "/ChapterFour/0497.Random-Point-in-Non-overlapping-Rectangles.md" >}})|Medium||||39.0%| |0528|Random Pick with Weight|[Go]({{< relref "/ChapterFour/0528.Random-Pick-with-Weight.md" >}})|Medium||||44.5%| |0658|Find K Closest Elements|[Go]({{< relref "/ChapterFour/0658.Find-K-Closest-Elements.md" >}})|Medium||||41.8%| |0668|Kth Smallest Number in Multiplication Table|[Go]({{< relref "/ChapterFour/0668.Kth-Smallest-Number-in-Multiplication-Table.md" >}})|Hard||||47.7%| @@ -190,7 +190,7 @@ func peakIndexInMountainArray(A []int) int { |1111|Maximum Nesting Depth of Two Valid Parentheses Strings|[Go]({{< relref "/ChapterFour/1111.Maximum-Nesting-Depth-of-Two-Valid-Parentheses-Strings.md" >}})|Medium||||72.4%| |1157|Online Majority Element In Subarray|[Go]({{< relref "/ChapterFour/1157.Online-Majority-Element-In-Subarray.md" >}})|Hard||||39.5%| |1201|Ugly Number III|[Go]({{< relref "/ChapterFour/1201.Ugly-Number-III.md" >}})|Medium||||26.3%| -|1235|Maximum Profit in Job Scheduling|[Go]({{< relref "/ChapterFour/1235.Maximum-Profit-in-Job-Scheduling.md" >}})|Hard||||46.9%| +|1235|Maximum Profit in Job Scheduling|[Go]({{< relref "/ChapterFour/1235.Maximum-Profit-in-Job-Scheduling.md" >}})|Hard||||47.0%| |1283|Find the Smallest Divisor Given a Threshold|[Go]({{< relref "/ChapterFour/1283.Find-the-Smallest-Divisor-Given-a-Threshold.md" >}})|Medium||||49.2%| |1300|Sum of Mutated Array Closest to Target|[Go]({{< relref "/ChapterFour/1300.Sum-of-Mutated-Array-Closest-to-Target.md" >}})|Medium||||43.3%| |1649|Create Sorted Array through Instructions|[Go]({{< relref "/ChapterFour/1649.Create-Sorted-Array-through-Instructions.md" >}})|Hard||||36.2%| diff --git a/website/content/ChapterTwo/Bit_Manipulation.md b/website/content/ChapterTwo/Bit_Manipulation.md index aba365bf..029fa3fd 100644 --- a/website/content/ChapterTwo/Bit_Manipulation.md +++ b/website/content/ChapterTwo/Bit_Manipulation.md @@ -62,14 +62,14 @@ X & ~X = 0 |0393|UTF-8 Validation|[Go]({{< relref "/ChapterFour/0393.UTF-8-Validation.md" >}})|Medium| O(n)| O(1)||37.9%| |0397|Integer Replacement|[Go]({{< relref "/ChapterFour/0397.Integer-Replacement.md" >}})|Medium| O(n)| O(1)||33.4%| |0401|Binary Watch|[Go]({{< relref "/ChapterFour/0401.Binary-Watch.md" >}})|Easy| O(1)| O(1)||48.3%| -|0405|Convert a Number to Hexadecimal|[Go]({{< relref "/ChapterFour/0405.Convert-a-Number-to-Hexadecimal.md" >}})|Easy| O(n)| O(1)||44.3%| +|0405|Convert a Number to Hexadecimal|[Go]({{< relref "/ChapterFour/0405.Convert-a-Number-to-Hexadecimal.md" >}})|Easy| O(n)| O(1)||44.4%| |0421|Maximum XOR of Two Numbers in an Array|[Go]({{< relref "/ChapterFour/0421.Maximum-XOR-of-Two-Numbers-in-an-Array.md" >}})|Medium| O(n)| O(1)|❤️|53.9%| |0461|Hamming Distance|[Go]({{< relref "/ChapterFour/0461.Hamming-Distance.md" >}})|Easy| O(n)| O(1)||73.1%| |0476|Number Complement|[Go]({{< relref "/ChapterFour/0476.Number-Complement.md" >}})|Easy| O(n)| O(1)||65.1%| |0477|Total Hamming Distance|[Go]({{< relref "/ChapterFour/0477.Total-Hamming-Distance.md" >}})|Medium| O(n)| O(1)||50.6%| |0693|Binary Number with Alternating Bits|[Go]({{< relref "/ChapterFour/0693.Binary-Number-with-Alternating-Bits.md" >}})|Easy| O(n)| O(1)|❤️|59.7%| |0756|Pyramid Transition Matrix|[Go]({{< relref "/ChapterFour/0756.Pyramid-Transition-Matrix.md" >}})|Medium| O(n log n)| O(n)||55.5%| -|0762|Prime Number of Set Bits in Binary Representation|[Go]({{< relref "/ChapterFour/0762.Prime-Number-of-Set-Bits-in-Binary-Representation.md" >}})|Easy| O(n)| O(1)||64.1%| +|0762|Prime Number of Set Bits in Binary Representation|[Go]({{< relref "/ChapterFour/0762.Prime-Number-of-Set-Bits-in-Binary-Representation.md" >}})|Easy| O(n)| O(1)||64.2%| |0784|Letter Case Permutation|[Go]({{< relref "/ChapterFour/0784.Letter-Case-Permutation.md" >}})|Medium| O(n)| O(1)||66.2%| |0898|Bitwise ORs of Subarrays|[Go]({{< relref "/ChapterFour/0898.Bitwise-ORs-of-Subarrays.md" >}})|Medium| O(n)| O(1)||34.0%| |1290|Convert Binary Number in a Linked List to Integer|[Go]({{< relref "/ChapterFour/1290.Convert-Binary-Number-in-a-Linked-List-to-Integer.md" >}})|Easy||||81.7%| diff --git a/website/content/ChapterTwo/Depth_First_Search.md b/website/content/ChapterTwo/Depth_First_Search.md index dfcc5865..053f1690 100644 --- a/website/content/ChapterTwo/Depth_First_Search.md +++ b/website/content/ChapterTwo/Depth_First_Search.md @@ -14,7 +14,7 @@ type: docs |0100|Same Tree|[Go]({{< relref "/ChapterFour/0100.Same-Tree.md" >}})|Easy| O(n)| O(1)||54.0%| |0101|Symmetric Tree|[Go]({{< relref "/ChapterFour/0101.Symmetric-Tree.md" >}})|Easy| O(n)| O(1)||47.9%| |0104|Maximum Depth of Binary Tree|[Go]({{< relref "/ChapterFour/0104.Maximum-Depth-of-Binary-Tree.md" >}})|Easy| O(n)| O(1)||67.7%| -|0105|Construct Binary Tree from Preorder and Inorder Traversal|[Go]({{< relref "/ChapterFour/0105.Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.md" >}})|Medium||||51.2%| +|0105|Construct Binary Tree from Preorder and Inorder Traversal|[Go]({{< relref "/ChapterFour/0105.Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.md" >}})|Medium||||51.3%| |0106|Construct Binary Tree from Inorder and Postorder Traversal|[Go]({{< relref "/ChapterFour/0106.Construct-Binary-Tree-from-Inorder-and-Postorder-Traversal.md" >}})|Medium||||49.2%| |0108|Convert Sorted Array to Binary Search Tree|[Go]({{< relref "/ChapterFour/0108.Convert-Sorted-Array-to-Binary-Search-Tree.md" >}})|Easy| O(n)| O(1)||60.0%| |0109|Convert Sorted List to Binary Search Tree|[Go]({{< relref "/ChapterFour/0109.Convert-Sorted-List-to-Binary-Search-Tree.md" >}})|Medium| O(log n)| O(n)||49.8%| @@ -33,7 +33,7 @@ type: docs |0210|Course Schedule II|[Go]({{< relref "/ChapterFour/0210.Course-Schedule-II.md" >}})|Medium| O(n^2)| O(n^2)||42.3%| |0211|Design Add and Search Words Data Structure|[Go]({{< relref "/ChapterFour/0211.Design-Add-and-Search-Words-Data-Structure.md" >}})|Medium||||39.8%| |0257|Binary Tree Paths|[Go]({{< relref "/ChapterFour/0257.Binary-Tree-Paths.md" >}})|Easy| O(n)| O(1)||53.2%| -|0329|Longest Increasing Path in a Matrix|[Go]({{< relref "/ChapterFour/0329.Longest-Increasing-Path-in-a-Matrix.md" >}})|Hard||||44.4%| +|0329|Longest Increasing Path in a Matrix|[Go]({{< relref "/ChapterFour/0329.Longest-Increasing-Path-in-a-Matrix.md" >}})|Hard||||44.5%| |0337|House Robber III|[Go]({{< relref "/ChapterFour/0337.House-Robber-III.md" >}})|Medium||||51.7%| |0394|Decode String|[Go]({{< relref "/ChapterFour/0394.Decode-String.md" >}})|Medium| O(n)| O(n)||52.4%| |0491|Increasing Subsequences|[Go]({{< relref "/ChapterFour/0491.Increasing-Subsequences.md" >}})|Medium||||47.3%| @@ -44,7 +44,7 @@ type: docs |0529|Minesweeper|[Go]({{< relref "/ChapterFour/0529.Minesweeper.md" >}})|Medium||||60.7%| |0542|01 Matrix|[Go]({{< relref "/ChapterFour/0542.01-Matrix.md" >}})|Medium| O(n)| O(1)||40.6%| |0547|Number of Provinces|[Go]({{< relref "/ChapterFour/0547.Number-of-Provinces.md" >}})|Medium||||60.1%| -|0563|Binary Tree Tilt|[Go]({{< relref "/ChapterFour/0563.Binary-Tree-Tilt.md" >}})|Easy||||52.6%| +|0563|Binary Tree Tilt|[Go]({{< relref "/ChapterFour/0563.Binary-Tree-Tilt.md" >}})|Easy||||52.7%| |0638|Shopping Offers|[Go]({{< relref "/ChapterFour/0638.Shopping-Offers.md" >}})|Medium||||52.6%| |0685|Redundant Connection II|[Go]({{< relref "/ChapterFour/0685.Redundant-Connection-II.md" >}})|Hard||||32.9%| |0695|Max Area of Island|[Go]({{< relref "/ChapterFour/0695.Max-Area-of-Island.md" >}})|Medium||||64.3%| @@ -73,15 +73,15 @@ type: docs |1026|Maximum Difference Between Node and Ancestor|[Go]({{< relref "/ChapterFour/1026.Maximum-Difference-Between-Node-and-Ancestor.md" >}})|Medium||||69.2%| |1028|Recover a Tree From Preorder Traversal|[Go]({{< relref "/ChapterFour/1028.Recover-a-Tree-From-Preorder-Traversal.md" >}})|Hard||||70.7%| |1110|Delete Nodes And Return Forest|[Go]({{< relref "/ChapterFour/1110.Delete-Nodes-And-Return-Forest.md" >}})|Medium||||67.6%| -|1123|Lowest Common Ancestor of Deepest Leaves|[Go]({{< relref "/ChapterFour/1123.Lowest-Common-Ancestor-of-Deepest-Leaves.md" >}})|Medium||||67.8%| +|1123|Lowest Common Ancestor of Deepest Leaves|[Go]({{< relref "/ChapterFour/1123.Lowest-Common-Ancestor-of-Deepest-Leaves.md" >}})|Medium||||67.9%| |1145|Binary Tree Coloring Game|[Go]({{< relref "/ChapterFour/1145.Binary-Tree-Coloring-Game.md" >}})|Medium||||51.4%| +|1203|Sort Items by Groups Respecting Dependencies|[Go]({{< relref "/ChapterFour/1203.Sort-Items-by-Groups-Respecting-Dependencies.md" >}})|Hard||||49.1%| |1254|Number of Closed Islands|[Go]({{< relref "/ChapterFour/1254.Number-of-Closed-Islands.md" >}})|Medium||||61.5%| |1302|Deepest Leaves Sum|[Go]({{< relref "/ChapterFour/1302.Deepest-Leaves-Sum.md" >}})|Medium||||84.1%| |1306|Jump Game III|[Go]({{< relref "/ChapterFour/1306.Jump-Game-III.md" >}})|Medium||||62.5%| |------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------| - ----------------------------------------------