Showing preview only (1,265K chars total). Download the full file or copy to clipboard to get everything.
Repository: gzc/leetcode
Branch: master
Commit: 0bdefea63a22
Files: 1143
Total size: 1003.6 KB
Directory structure:
gitextract_k9u05cp_/
├── .gitignore
├── LICENSE
├── README.md
├── Solve the Equation.cpp
├── TODO
├── cpp/
│ ├── 001-010/
│ │ ├── Add Two Numbers.cpp
│ │ ├── Longest Palindromic Substring.cpp
│ │ ├── Longest Substring Without Repeating Characters.cpp
│ │ ├── Median of Two Sorted Arrays.cpp
│ │ ├── Palindrome Number.cpp
│ │ ├── Regular Expression Matching.cpp
│ │ ├── Reverse Integer.cpp
│ │ ├── String to Integer (atoi).cpp
│ │ ├── Two Sum.cpp
│ │ └── ZigZag Conversion.cpp
│ ├── 011-020/
│ │ ├── 3Sum Closest.cpp
│ │ ├── 3Sum.cpp
│ │ ├── 4Sum.cpp
│ │ ├── Container With Most Water.cpp
│ │ ├── Integer to Roman.cpp
│ │ ├── Letter Combinations of a Phone Number.cpp
│ │ ├── Longest Common Prefix.cpp
│ │ ├── Remove Nth Node From End of List.cpp
│ │ ├── Roman to Integer.cpp
│ │ └── Valid Parentheses.cpp
│ ├── 021-030/
│ │ ├── Divide Two Integers.cpp
│ │ ├── Generate Parentheses.cpp
│ │ ├── Implement strStr().cpp
│ │ ├── Merge Two Sorted Lists.cpp
│ │ ├── Merge k Sorted Lists.cpp
│ │ ├── Remove Duplicates from Sorted Array.cpp
│ │ ├── Remove Element.cpp
│ │ ├── Reverse Nodes in k-Group.cpp
│ │ ├── Substring with Concatenation of All Words.cpp
│ │ └── Swap Nodes in Pairs.cpp
│ ├── 031-040/
│ │ ├── Combination Sum II.cpp
│ │ ├── Combination Sum.cpp
│ │ ├── Count and Say.cpp
│ │ ├── Longest Valid Parentheses.cpp
│ │ ├── Next Permutation.cpp
│ │ ├── Search Insert Position.cpp
│ │ ├── Search for a Range.cpp
│ │ ├── Search in Rotated Sorted Array.cpp
│ │ ├── Sudoku Solver.cpp
│ │ └── Valid Sudoku.cpp
│ ├── 041-050/
│ │ ├── First Missing Positive.cpp
│ │ ├── Group Anagrams.cpp
│ │ ├── Jump Game II.cpp
│ │ ├── Multiply Strings.cpp
│ │ ├── Permutations II.cpp
│ │ ├── Permutations.cpp
│ │ ├── Pow.cpp
│ │ ├── Rotate Image.cpp
│ │ ├── Trapping Rain Water.cpp
│ │ └── Wildcard Matching.cpp
│ ├── 051-060/
│ │ ├── Insert Interval.cpp
│ │ ├── Jump Game.cpp
│ │ ├── Length of Last Word.cpp
│ │ ├── Maximum_Subarray.cpp
│ │ ├── Merge Intervals.cpp
│ │ ├── N-Queens II.cpp
│ │ ├── N-Queens.cpp
│ │ ├── Permutation Sequence.cpp
│ │ ├── Spiral Matrix II.cpp
│ │ └── Spiral Matrix.cpp
│ ├── 061-070/
│ │ ├── Add Binary.cpp
│ │ ├── Climbing Stairs.cpp
│ │ ├── Minimum Path Sum .cpp
│ │ ├── Plus One.cpp
│ │ ├── Rotate List.cpp
│ │ ├── Sqrt.cpp
│ │ ├── Text Justification.cpp
│ │ ├── Unique Paths II .cpp
│ │ ├── Unique Paths.cpp
│ │ └── Valid Number.cpp
│ ├── 071-080/
│ │ ├── Combinations.cpp
│ │ ├── Edit Distance.cpp
│ │ ├── Minimum Window Substring.cpp
│ │ ├── Remove Duplicates from Sorted Array II.cpp
│ │ ├── Search a 2D Matrix.cpp
│ │ ├── Set Matrix Zeroes.cpp
│ │ ├── Simplify Path.cpp
│ │ ├── Sort Colors.cpp
│ │ ├── Subsets.cpp
│ │ └── Word Search.cpp
│ ├── 081-090/
│ │ ├── Gray Code.cpp
│ │ ├── Largest Rectangle in Histogram.cpp
│ │ ├── Maximal Rectangle.cpp
│ │ ├── Merge Sorted Array.cpp
│ │ ├── Partition List.cpp
│ │ ├── Remove Duplicates from Sorted List II.cpp
│ │ ├── Remove Duplicates from Sorted List.cpp
│ │ ├── Scramble String.cpp
│ │ ├── Search in Rotated Sorted Array II.cpp
│ │ └── Subsets II.cpp
│ ├── 091-100/
│ │ ├── Binary Tree Inorder Traversal.cpp
│ │ ├── Decode Ways.cpp
│ │ ├── Interleaving String.cpp
│ │ ├── Recover Binary Search Tree.cpp
│ │ ├── Restore IP Addresses.cpp
│ │ ├── Reverse Linked List II.cpp
│ │ ├── Same Tree.cpp
│ │ ├── Unique Binary Search Trees II.cpp
│ │ ├── Unique Binary Search Trees.cpp
│ │ └── Validate Binary Search Tree.cpp
│ ├── 1001-10000/
│ │ ├── 1001-1010/
│ │ │ └── Construct Binary Search Tree from Preorder Traversal.cpp
│ │ ├── 1011-1020/
│ │ │ ├── Best Sightseeing Pair.cpp
│ │ │ ├── Binary Prefix Divisible By 5.cpp
│ │ │ ├── Binary String With Substrings Representing 1 To N.cpp
│ │ │ ├── Convert to Base -2.cpp
│ │ │ ├── Next Greater Node In Linked List.cpp
│ │ │ ├── Number of Enclaves.cpp
│ │ │ └── Partition Array Into Three Parts With Equal Sum.cpp
│ │ ├── 1021-1030/
│ │ │ ├── Camelcase Matching.cpp
│ │ │ ├── Divisor Game.cpp
│ │ │ ├── Longest Arithmetic Sequence.cpp
│ │ │ ├── Matrix Cells in Distance Order.cpp
│ │ │ ├── Maximum Difference Between Node and Ancestor.cpp
│ │ │ ├── Recover a Tree From Preorder Traversal.cpp
│ │ │ ├── Remove Outermost Parentheses.cpp
│ │ │ ├── Sum of Root To Leaf Binary Numbers.cpp
│ │ │ ├── Two City Scheduling.cpp
│ │ │ └── Video Stitching.cpp
│ │ ├── 1031-1040/
│ │ │ ├── Binary Search Tree to Greater Sum Tree.cpp
│ │ │ ├── Coloring A Border.cpp
│ │ │ ├── Escape a Large Maze.cpp
│ │ │ ├── Maximum Sum of Two Non-Overlapping Subarrays.cpp
│ │ │ ├── Minimum Score Triangulation of Polygon.cpp
│ │ │ ├── Moving Stones Until Consecutive.cpp
│ │ │ ├── Stream of Characters.cpp
│ │ │ ├── Uncrossed Lines.cpp
│ │ │ └── Valid Boomerang.cpp
│ │ ├── 1041-1050/
│ │ │ ├── Flower Planting With No Adjacent.cpp
│ │ │ ├── Last Stone Weight II.cpp
│ │ │ ├── Last Stone Weight.cpp
│ │ │ ├── Longest String Chain.cpp
│ │ │ ├── Partition Array for Maximum Sum.cpp
│ │ │ ├── Remove All Adjacent Duplicates In String.cpp
│ │ │ └── Robot Bounded In Circle.cpp
│ │ ├── 1051-1060/
│ │ │ ├── Distant Barcodes.cpp
│ │ │ ├── Grumpy Bookstore Owner.cpp
│ │ │ ├── Height Checker.cpp
│ │ │ └── Previous Permutation With One Swap.cpp
│ │ ├── 1071-1080/
│ │ │ ├── Adding Two Negabinary Numbers.cpp
│ │ │ ├── Flip Columns For Maximum Number of Equal Rows.cpp
│ │ │ ├── Greatest Common Divisor of Strings.cpp
│ │ │ ├── Insufficient Nodes in Root to Leaf Paths.cpp
│ │ │ ├── Letter Tile Possibilities.cpp
│ │ │ ├── Number of Submatrices That Sum to Target.cpp
│ │ │ └── Occurrences After Bigram.cpp
│ │ ├── 1081-1090/
│ │ │ ├── Duplicate Zeros.cpp
│ │ │ ├── Largest Values From Labels.cpp
│ │ │ └── Smallest Subsequence of Distinct Characters.cpp
│ │ ├── 1091-1100/
│ │ │ ├── Brace Expansion II.cpp
│ │ │ ├── Car Pooling.cpp
│ │ │ ├── Find in Mountain Array.cpp
│ │ │ ├── Shortest Common Supersequence.cpp
│ │ │ ├── Shortest Path in Binary Matrix.cpp
│ │ │ ├── Statistics from a Large Sample.cpp
│ │ │ └── Two Sum Less Than K.cpp
│ │ ├── 1101-1110/
│ │ │ ├── Corporate Flight Bookings.cpp
│ │ │ ├── Defanging an IP Address.cpp
│ │ │ ├── Delete Nodes And Return Forest.cpp
│ │ │ ├── Distribute Candies to People.cpp
│ │ │ ├── Filling Bookcase Shelves.cpp
│ │ │ ├── Parsing A Boolean Expression.cpp
│ │ │ └── Path In Zigzag Labelled Binary Tree.cpp
│ │ ├── 1111-1120/
│ │ │ ├── Maximum Nesting Depth of Two Valid Parentheses Strings.cpp
│ │ │ ├── Print FooBar Alternately.cpp
│ │ │ └── Print in Order.cpp
│ │ ├── 1121-1130/
│ │ │ ├── Lowest Common Ancestor of Deepest Leaves.cpp
│ │ │ ├── Minimum Cost Tree From Leaf Values.cpp
│ │ │ ├── Number of Equivalent Domino Pairs.cpp
│ │ │ ├── Relative Sort Array.cpp
│ │ │ └── Smallest Sufficient Team.cpp
│ │ ├── 1131-1140/
│ │ │ └── N-th Tribonacci Number.cpp
│ │ ├── 1141-1150/
│ │ │ ├── Binary Tree Coloring Game.cpp
│ │ │ ├── Decrease Elements To Make Array Zigzag.cpp
│ │ │ ├── Longest Chunked Palindrome Decomposition.cpp
│ │ │ ├── Longest Common Subsequence.cpp
│ │ │ └── Snapshot Array.cpp
│ │ ├── 1151-1160/
│ │ │ ├── Day of the Year.cpp
│ │ │ ├── Find Words That Can Be Formed by Characters.cpp
│ │ │ └── Number of Dice Rolls With Target Sum.cpp
│ │ ├── 1161-1170/
│ │ │ ├── As Far from Land as Possible.cpp
│ │ │ ├── Compare Strings by Frequency of the Smallest Character.cpp
│ │ │ ├── Design File System.cpp
│ │ │ ├── Invalid Transactions.cpp
│ │ │ ├── Maximum Level Sum of a Binary Tree.cpp
│ │ │ ├── Minimum Cost to Connect Sticks.cpp
│ │ │ ├── Optimize Water Distribution in a Village.cpp
│ │ │ └── Single-Row Keyboard.cpp
│ │ ├── 1171-1180/
│ │ │ ├── Can Make Palindrome from Substring.cpp
│ │ │ ├── Count Substrings with Only One Distinct Letter.cpp
│ │ │ ├── Diet Plan Performance.cpp
│ │ │ ├── Dinner Plate Stacks.cpp
│ │ │ ├── Prime Arrangements.cpp
│ │ │ └── Remove Zero Sum Consecutive Nodes from Linked List.cpp
│ │ ├── 1181-1190/
│ │ │ ├── Before and After Puzzle.cpp
│ │ │ ├── Day of the Week.cpp
│ │ │ ├── Design Bounded Blocking Queue.cpp
│ │ │ ├── Distance Between Bus Stops.cpp
│ │ │ ├── Make Array Strictly Increasing.cpp
│ │ │ ├── Maximum Subarray Sum with One Deletion.cpp
│ │ │ └── Shortest Distance to Target Color.cpp
│ │ ├── 1191-1200/
│ │ │ └── Minimum Knight Moves.cpp
│ │ ├── 1201-1210/
│ │ │ ├── Design Skiplist.cpp
│ │ │ └── Smallest String With Swaps.cpp
│ │ ├── 1221-1230/
│ │ │ ├── Dice Roll Simulation.cpp
│ │ │ ├── Queens That Can Attack the King.cpp
│ │ │ └── Split a String in Balanced Strings.cpp
│ │ ├── 1231-1240/
│ │ │ ├── Maximum Profit in Job Scheduling.cpp
│ │ │ └── Replace the Substring for Balanced String.cpp
│ │ ├── 1241-1250/
│ │ │ ├── Minimum Remove to Make Valid Parentheses.cpp
│ │ │ └── Web Crawler Multithreaded.cpp
│ │ ├── 1261-1270/
│ │ │ └── Greatest Sum Divisible by Three.cpp
│ │ ├── 1281-1290/
│ │ │ ├── Convert Binary Number in a Linked List to Integer.cpp
│ │ │ ├── Element Appearing More Than 25% In Sorted Array.cpp
│ │ │ └── Remove Covered Intervals.cpp
│ │ ├── 1291-1300/
│ │ │ ├── Maximum Side Length of a Square with Sum Less than or Equal to Threshold.cpp
│ │ │ └── Sequential Digits.cpp
│ │ ├── 1311-1320/
│ │ │ └── Minimum Distance to Type a Word Using Two Fingers.cpp
│ │ ├── 1411-1420/
│ │ │ └── Minimum Value to Get Positive Step by Step Sum.cpp
│ │ ├── 1421-1430/
│ │ │ └── Leftmost Column with at Least a One.cpp
│ │ ├── 1481-1490/
│ │ │ ├── Avoid Flood in The City.cpp
│ │ │ ├── Find Critical and Pseudo-Critical Edges in Minimum Spanning Tree.cpp
│ │ │ ├── Making File Names Unique.cpp
│ │ │ └── XOR Operation in an Array.cpp
│ │ ├── 1501-1510/
│ │ │ └── Stone Game IV.cpp
│ │ ├── 1541-1550/
│ │ │ └── Minimum Insertions to Balance a Parentheses String.cpp
│ │ ├── 1561-1570/
│ │ │ └── Dot Product of Two Sparse Vectors.cpp
│ │ ├── 1621-1630/
│ │ │ ├── Arithmetic Subarrays.cpp
│ │ │ └── Slowest Key.cpp
│ │ ├── 1631-1640/
│ │ │ ├── Check Array Formation Through Concatenation.cpp
│ │ │ ├── Number of Ways to Form a Target String Given a Dictionary.cpp
│ │ │ ├── Path With Minimum Effort.cpp
│ │ │ └── Rank Transform of a Matrix.cpp
│ │ ├── 1641-1650/
│ │ │ ├── Count Sorted Vowel Strings.cpp
│ │ │ ├── Create Sorted Array through Instructions.cpp
│ │ │ ├── Furthest Building You Can Reach.cpp
│ │ │ ├── Get Maximum in Generated Array.cpp
│ │ │ ├── Kth Smallest Instructions.cpp
│ │ │ ├── Lowest Common Ancestor of a Binary Tree II.cpp
│ │ │ ├── Lowest Common Ancestor of a Binary Tree III.cpp
│ │ │ ├── Minimum Deletions to Make Character Frequencies Unique.cpp
│ │ │ └── Sell Diminishing-Valued Colored Balls.cpp
│ │ ├── 1671-1680/
│ │ │ ├── Lowest Common Ancestor of a Binary Tree IV.cpp
│ │ │ └── Minimum Moves to Make Array Complementary.cpp
│ │ ├── 1681-1690/
│ │ │ ├── Delivering Boxes from Storage to Ports.cpp
│ │ │ ├── Stone Game VI.cpp
│ │ │ └── Sum of Absolute Differences in a Sorted Array.cpp
│ │ ├── 1701-1710/
│ │ │ ├── Determine if String Halves Are Alike.cpp
│ │ │ ├── Maximum Number of Eaten Apples.cpp
│ │ │ ├── Maximum Units on a Truck.cpp
│ │ │ ├── Maximum XOR With an Element From Array.cpp
│ │ │ └── Where Will the Ball Fall.cpp
│ │ ├── 1711-1720/
│ │ │ ├── Count Good Meals.cpp
│ │ │ ├── Decode XORed Array.cpp
│ │ │ ├── Minimum Operations to Make a Subsequence.cpp
│ │ │ └── Ways to Split Array Into Three Subarrays.cpp
│ │ ├── 1721-1730/
│ │ │ ├── Find Minimum Time to Finish All Jobs.cpp
│ │ │ ├── Largest Submatrix With Rearrangements.cpp
│ │ │ ├── Minimize Hamming Distance After Swap Operations.cpp
│ │ │ ├── Number Of Rectangles That Can Form The Largest Square.cpp
│ │ │ ├── Swapping Nodes in a Linked List.cpp
│ │ │ └── Tuple with Same Product.cpp
│ │ ├── 1731-1740/
│ │ │ └── Building Boxes.cpp
│ │ ├── 1751-1760/
│ │ │ ├── Closest Subsequence Sum.cpp
│ │ │ ├── Largest Merge Of Two Strings.cpp
│ │ │ ├── Maximum Number of Events That Can Be Attended II.cpp
│ │ │ └── Minimum Limit of Balls in a Bag.cpp
│ │ ├── 1761-1770/
│ │ │ ├── Form Array by Concatenating Subarrays of Another Array.cpp
│ │ │ ├── Map of Highest Peak.cpp
│ │ │ ├── Maximum Score from Performing Multiplication Operations.cpp
│ │ │ ├── Minimum Degree of a Connected Trio in a Graph.cpp
│ │ │ └── Tree of Coprimes.cpp
│ │ ├── 1771-1780/
│ │ │ ├── Car Fleet II.cpp
│ │ │ ├── Check if Number is a Sum of Powers of Three.cpp
│ │ │ ├── Closest Dessert Cost.cpp
│ │ │ ├── Equal Sum Arrays With Minimum Number of Operations.cpp
│ │ │ ├── Find Nearest Point That Has the Same X or Y Coordinate.cpp
│ │ │ ├── Maximize Palindrome Length From Subsequences.cpp
│ │ │ └── Shortest Path in a Hidden Grid.cpp
│ │ ├── 1781-1790/
│ │ │ ├── Check if Binary String Has at Most One Segment of Ones.cpp
│ │ │ ├── Check if One String Swap Can Make Strings Equal.cpp
│ │ │ ├── Count Pairs Of Nodes.cpp
│ │ │ ├── Make the XOR of All Segments Equal to Zero.cpp
│ │ │ ├── Maximize the Beauty of the Garden.cpp
│ │ │ ├── Minimum Elements to Add to Form a Given Sum.cpp
│ │ │ ├── Number of Restricted Paths From First to Last Node.cpp
│ │ │ └── Sum of Beauty of All Substrings.cpp
│ │ ├── 1791-1800/
│ │ │ ├── Count Pairs of Equal Substrings With Minimum Difference.cpp
│ │ │ ├── Design Authentication Manager.cpp
│ │ │ ├── Find Center of Star Graph.cpp
│ │ │ ├── Maximize Score After N Operations.cpp
│ │ │ ├── Maximum Ascending Subarray Sum.cpp
│ │ │ ├── Maximum Average Pass Ratio.cpp
│ │ │ ├── Maximum Number of Consecutive Values You Can Make.cpp
│ │ │ ├── Maximum Score of a Good Subarray.cpp
│ │ │ └── Second Largest Digit in a String.cpp
│ │ ├── 1801-1810/
│ │ │ ├── Count Pairs With XOR in a Range.cpp
│ │ │ ├── Evaluate the Bracket Pairs of a String.cpp
│ │ │ ├── Implement Trie II (Prefix Tree).cpp
│ │ │ ├── Maximize Number of Nice Divisors.cpp
│ │ │ ├── Maximum Value at a Given Index in a Bounded Array.cpp
│ │ │ ├── Minimum Path Cost in a Hidden Grid.cpp
│ │ │ ├── Number of Different Integers in a String.cpp
│ │ │ └── Number of Orders in the Backlog.cpp
│ │ ├── 1811-1820/
│ │ │ ├── Count Nice Pairs in an Array.cpp
│ │ │ ├── Determine Color of a Chessboard Square.cpp
│ │ │ ├── Finding the Users Active Minutes.cpp
│ │ │ ├── Maximum Number of Accepted Invitations.cpp
│ │ │ ├── Maximum Number of Groups Getting Fresh Donuts.cpp
│ │ │ ├── Minimum Absolute Sum Difference.cpp
│ │ │ ├── Number of Different Subsequences GCDs.cpp
│ │ │ ├── Sentence Similarity III.cpp
│ │ │ └── Truncate Sentence.cpp
│ │ ├── 1821-1830/
│ │ │ ├── Faulty Sensor.cpp
│ │ │ ├── Finding MK Average.cpp
│ │ │ ├── Maximum XOR for Each Query.cpp
│ │ │ ├── Minimum Number of Operations to Make String Sorted.cpp
│ │ │ ├── Minimum Operations to Make the Array Increasing.cpp
│ │ │ ├── Minimum Sideway Jumps.cpp
│ │ │ ├── Queries on Number of Points Inside a Circle.cpp
│ │ │ └── Sign of the Product of an Array.cpp
│ │ ├── 1831-1840/
│ │ │ ├── Check if the Sentence Is Pangram.cpp
│ │ │ ├── Find XOR Sum of All Pairs Bitwise AND.cpp
│ │ │ ├── Longest Substring Of All Vowels in Order.cpp
│ │ │ ├── Maximum Building Height.cpp
│ │ │ ├── Maximum Ice Cream Bars.cpp
│ │ │ ├── Remove Duplicates From an Unsorted Linked List.cpp
│ │ │ ├── Single-Threaded CPU.cpp
│ │ │ └── Sum of Digits in Base K.cpp
│ │ ├── 1841-1850/
│ │ │ ├── Closest Room.cpp
│ │ │ └── Minimum Adjacent Swaps to Reach the Kth Smallest Number.cpp
│ │ └── 1851-1860/
│ │ └── Minimum Interval to Include Each Query.cpp
│ ├── 101-110/
│ │ ├── Balanced Binary Tree.cpp
│ │ ├── Binary Tree Level Order Traversal II.cpp
│ │ ├── Binary Tree Level Order Traversal.cpp
│ │ ├── Binary Tree Zigzag Level Order Traversal.cpp
│ │ ├── Construct Binary Tree from Inorder and Postorder Traversal.cpp
│ │ ├── Construct Binary Tree from Preorder and Inorder Traversal.cpp
│ │ ├── Convert Sorted Array to Binary Search Tree.cpp
│ │ ├── Convert Sorted List to Binary Search Tree.cpp
│ │ ├── Maximum Depth of Binary Tree.cpp
│ │ └── Symmetric Tree.cpp
│ ├── 111-120/
│ │ ├── Distinct Subsequences.cpp
│ │ ├── Flatten Binary Tree to Linked List.cpp
│ │ ├── Minimum Depth of Binary Tree.cpp
│ │ ├── Pascal's Triangle II.cpp
│ │ ├── Pascal's Triangle.cpp
│ │ ├── Path Sum II.cpp
│ │ ├── Path Sum.cpp
│ │ ├── Populating Next Right Pointers in Each Node II.cpp
│ │ ├── Populating Next Right Pointers in Each Node.cpp
│ │ └── Triangle.cpp
│ ├── 121-130/
│ │ ├── Best Time to Buy and Sell Stock II.cpp
│ │ ├── Best Time to Buy and Sell Stock III.cpp
│ │ ├── Best Time to Buy and Sell Stock.cpp
│ │ ├── Binary Tree Maximum Path Sum.cpp
│ │ ├── Longest Consecutive Sequence.cpp
│ │ ├── Sum Root to Leaf Numbers.cpp
│ │ ├── Surrounded Regions.cpp
│ │ ├── Valid Palindrome.cpp
│ │ ├── Word Ladder II.cpp
│ │ └── Word Ladder.cpp
│ ├── 131-140/
│ │ ├── Candy.cpp
│ │ ├── Clone Graph.cpp
│ │ ├── Copy List with Random Pointer.cpp
│ │ ├── Gas Station.cpp
│ │ ├── Palindrome Partitioning II.cpp
│ │ ├── Palindrome Partitioning.cpp
│ │ ├── Single Number II.cpp
│ │ ├── Single Number.cpp
│ │ ├── Word Break II.cpp
│ │ └── Word Break.cpp
│ ├── 141-150/
│ │ ├── Binary Tree Postorder Traversal.cpp
│ │ ├── Evaluate Reverse Polish Notation.cpp
│ │ ├── Insertion Sort List.cpp
│ │ ├── LRU Cache.cpp
│ │ ├── Linked List Cycle II.cpp
│ │ ├── Linked List Cycle.cpp
│ │ ├── Max Points on a Line.cpp
│ │ ├── Reorder List.cpp
│ │ ├── Sort List.cpp
│ │ └── Tree Preorder Traversal.cpp
│ ├── 151-160/
│ │ ├── Binary Tree Upside Down.cpp
│ │ ├── Find Minimum in Rotated Sorted Array II.cpp
│ │ ├── Find Minimum in Rotated Sorted Array.cpp
│ │ ├── Intersection of Two Linked Lists.cpp
│ │ ├── Longest Substring with At Most Two Distinct Characters.cpp
│ │ ├── Maximum Product Subarray.cpp
│ │ ├── Min Stack.cpp
│ │ ├── Read N Characters Given Read4 II - Call multiple times.cpp
│ │ ├── Read N Characters Given Read4.cpp
│ │ └── Reverse Words in a String.cpp
│ ├── 161-170/
│ │ ├── Compare Version Numbers.cpp
│ │ ├── Excel Sheet Column Title.cpp
│ │ ├── Find Peak Element.cpp
│ │ ├── Fraction to Recurring Decimal.cpp
│ │ ├── Majority Element.cpp
│ │ ├── Maximum Gap.cpp
│ │ ├── Missing Ranges.cpp
│ │ ├── One Edit Distance.cpp
│ │ ├── Two Sum II - Input array is sorted.cpp
│ │ └── Two Sum III - Data structure design.cpp
│ ├── 171-180/
│ │ ├── Binary Search Tree Iterator.cpp
│ │ ├── Dungeon Game.cpp
│ │ ├── Excel Sheet Column Number.cpp
│ │ ├── Factorial Trailing Zeroes.cpp
│ │ └── Largest Number.cpp
│ ├── 181-190/
│ │ ├── Best Time to Buy and Sell Stock IV.cpp
│ │ ├── Repeated DNA Sequences.cpp
│ │ ├── Reverse Bits.cpp
│ │ ├── Reverse Words in a String II.cpp
│ │ └── Rotate Array.cpp
│ ├── 191-200/
│ │ ├── Binary Tree Right Side View.cpp
│ │ ├── House Robber.cpp
│ │ ├── Number of 1 Bits.cpp
│ │ ├── Number of Islands.cpp
│ │ └── Reverse Bits.cpp
│ ├── 201-210/
│ │ ├── Bitwise AND of Numbers Range.cpp
│ │ ├── Count Primes.cpp
│ │ ├── Course Schedule II.cpp
│ │ ├── Course Schedule.cpp
│ │ ├── Happy Number.cpp
│ │ ├── Implement Trie (Prefix Tree).cpp
│ │ ├── Isomorphic Strings.cpp
│ │ ├── Minimum Size Subarray Sum.cpp
│ │ ├── Remove Linked List Elements.cpp
│ │ └── Reverse Linked List.cpp
│ ├── 211-220/
│ │ ├── Add and Search Word - Data structure design.cpp
│ │ ├── Combination Sum III.cpp
│ │ ├── Contains Duplicate II.cpp
│ │ ├── Contains Duplicate III.cpp
│ │ ├── Contains Duplicate.cpp
│ │ ├── House Robber II.cpp
│ │ ├── Kth Largest Element in an Array.cpp
│ │ ├── Shortest Palindrome.cpp
│ │ ├── The Skyline Problem.cpp
│ │ └── Word Search II.cpp
│ ├── 221-230/
│ │ ├── Basic Calculator II.cpp
│ │ ├── Basic Calculator.cpp
│ │ ├── Count Complete Tree Nodes.cpp
│ │ ├── Implement Stack using Queues.cpp
│ │ ├── Invert Binary Tree.cpp
│ │ ├── Kth Smallest Element in a BST.cpp
│ │ ├── Majority Element II.cpp
│ │ ├── Maximal Square.cpp
│ │ ├── Rectangle Area.cpp
│ │ └── Summary Ranges.cpp
│ ├── 231-240/
│ │ ├── Delete Node in a Linked List.cpp
│ │ ├── Implement Queue using Stacks.cpp
│ │ ├── Lowest Common Ancestor of a Binary Search Tree.cpp
│ │ ├── Lowest Common Ancestor of a Binary Tree.cpp
│ │ ├── Number of Digit One.cpp
│ │ ├── Palindrome Linked List.cpp
│ │ ├── Power of Two.cpp
│ │ ├── Product of Array Except Self.cpp
│ │ ├── Search a 2D Matrix II.cpp
│ │ └── Sliding Window Maximum.cpp
│ ├── 241-250/
│ │ ├── Count Univalue Subtrees.cpp
│ │ ├── Different Ways to Add Parentheses.cpp
│ │ ├── Group Shifted Strings.cpp
│ │ ├── Shortest Word Distance II.cpp
│ │ ├── Shortest Word Distance III.cpp
│ │ ├── Shortest Word Distance.cpp
│ │ ├── Strobogrammatic Number II.cpp
│ │ ├── Strobogrammatic Number III.cpp
│ │ ├── Strobogrammatic Number.cpp
│ │ └── Valid Anagram.cpp
│ ├── 251-260/
│ │ ├── 3Sum Smaller.cpp
│ │ ├── Add Digits.cpp
│ │ ├── Binary Tree Paths.cpp
│ │ ├── Factor Combinations.cpp
│ │ ├── Flatten 2D Vector.cpp
│ │ ├── Meeting Rooms II.cpp
│ │ ├── Meeting Rooms.cpp
│ │ ├── Paint House.cpp
│ │ ├── Single Number III.cpp
│ │ └── Verify Preorder Sequence in Binary Search Tree.cpp
│ ├── 261-270/
│ │ ├── Alien Dictionary.cpp
│ │ ├── Closest Binary Search Tree Value.cpp
│ │ ├── Factor Combinations.cpp
│ │ ├── Graph Valid Tree.cpp
│ │ ├── Missing Number.cpp
│ │ ├── Paint House II.cpp
│ │ ├── Palindrome Permutation II.cpp
│ │ ├── Palindrome Permutation.cpp
│ │ ├── Ugly Number II.cpp
│ │ └── Ugly Number.cpp
│ ├── 271-280/
│ │ ├── Closest Binary Search Tree Value II.cpp
│ │ ├── Encode and Decode Strings.cpp
│ │ ├── Find the Celebrity.cpp
│ │ ├── First Bad Version.cpp
│ │ ├── H-Index II.cpp
│ │ ├── H-Index.cpp
│ │ ├── Integer to English Words.cpp
│ │ ├── Paint Fence.cpp
│ │ ├── Perfect Squares.cpp
│ │ └── Wiggle Sort.cpp
│ ├── 281-290/
│ │ ├── Expression Add Operators.cpp
│ │ ├── Find the Duplicate Number.cpp
│ │ ├── Game of Life.cpp
│ │ ├── Inorder Successor in BST.cpp
│ │ ├── Move Zeroes.cpp
│ │ ├── Peeking Iterator.cpp
│ │ ├── Unique Word Abbreviation.cpp
│ │ ├── Walls and Gates.cpp
│ │ ├── Word Pattern.cpp
│ │ └── Zigzag Iterator.cpp
│ ├── 291-300/
│ │ ├── Best Meeting Point.cpp
│ │ ├── Binary Tree Longest Consecutive Sequence.cpp
│ │ ├── Bulls and Cows.cpp
│ │ ├── Find Median from Data Stream.cpp
│ │ ├── Flip Game II.cpp
│ │ ├── Flip Game.cpp
│ │ ├── Longest Increasing Subsequence.cpp
│ │ ├── Nim Game.cpp
│ │ ├── Serialize and Deserialize Binary Tree.cpp
│ │ └── Word Pattern II.cpp
│ ├── 301-310/
│ │ ├── Additive Number.cpp
│ │ ├── Best Time to Buy and Sell Stock with Cooldown.cpp
│ │ ├── Minimum Height Trees.cpp
│ │ ├── Number of Islands II.cpp
│ │ ├── Range Sum Query - Immutable.cpp
│ │ ├── Range Sum Query - Mutable.cpp
│ │ ├── Range Sum Query 2D - Immutable.cpp
│ │ ├── Range Sum Query 2D - Mutable.cpp
│ │ ├── Remove Invalid Parentheses.cpp
│ │ └── Smallest Rectangle Enclosing Black Pixels.cpp
│ ├── 311-320/
│ │ ├── Binary Tree Vertical Order Traversal.cpp
│ │ ├── Bulb Switcher.cpp
│ │ ├── Burst Balloons.cpp
│ │ ├── Count of Smaller Numbers After Self.cpp
│ │ ├── Generalized Abbreviation.cpp
│ │ ├── Maximum Product of Word Lengths.cpp
│ │ ├── Remove Duplicate Letters.cpp
│ │ ├── Shortest Distance from All Buildings.cpp
│ │ ├── Sparse Matrix Multiplication.cpp
│ │ └── Super Ugly Number.cpp
│ ├── 321-330/
│ │ ├── Coin Change.cpp
│ │ ├── Count of Range Sum.cpp
│ │ ├── Create Maximum Number.cpp
│ │ ├── Longest Increasing Path in a Matrix.cpp
│ │ ├── Maximum Size Subarray Sum Equals k.cpp
│ │ ├── Number of Connected Components in an Undirected Graph.cpp
│ │ ├── Odd Even Linked List.cpp
│ │ ├── Patching Array.cpp
│ │ ├── Power of Three.cpp
│ │ └── Wiggle Sort II.cpp
│ ├── 331-340/
│ │ ├── Counting Bits.cpp
│ │ ├── House Robber III.cpp
│ │ ├── Increasing Triplet Subsequence.cpp
│ │ ├── Largest BST Subtree.cpp
│ │ ├── Longest Substring with At Most K Distinct Characters.cpp
│ │ ├── Nested List Weight Sum.cpp
│ │ ├── Palindrome Pairs.cpp
│ │ ├── Reconstruct Itinerary.cpp
│ │ ├── Self Crossing.cpp
│ │ └── Verify Preorder Serialization of a Binary Tree.cpp
│ ├── 341-350/
│ │ ├── Design Tic-Tac-Toe.cpp
│ │ ├── Flatten Nested List Iterator.cpp
│ │ ├── Integer Break.cpp
│ │ ├── Intersection of Two Arrays II.cpp
│ │ ├── Intersection of Two Arrays.cpp
│ │ ├── Moving Average from Data Stream.cpp
│ │ ├── Power of Four.cpp
│ │ ├── Reverse String.cpp
│ │ ├── Reverse Vowels of a String.cpp
│ │ └── Top K Frequent Elements.cpp
│ ├── 351-360/
│ │ ├── Android Unlock Patterns.cpp
│ │ ├── Count Numbers with Unique Digits.cpp
│ │ ├── Data Stream as Disjoint Intervals.cpp
│ │ ├── Design Snake Game.cpp
│ │ ├── Design Twitter.cpp
│ │ ├── Line Reflection.cpp
│ │ ├── Logger Rate Limiter.cpp
│ │ ├── Rearrange String k Distance Apart.cpp
│ │ ├── Russian Doll Envelopes.cpp
│ │ └── Sort Transformed Array.cpp
│ ├── 361-370/
│ │ ├── Bomb Enemy.cpp
│ │ ├── Design Hit Counter.cpp
│ │ ├── Find Leaves of Binary Tree.cpp
│ │ ├── Largest Divisible Subset.cpp
│ │ ├── Max Sum of Rectangle No Larger Than K.cpp
│ │ ├── Nested List Weight Sum II.cpp
│ │ ├── Plus One Linked List.cpp
│ │ ├── Range Addition.cpp
│ │ ├── Valid Perfect Square.cpp
│ │ └── Water and Jug Problem.cpp
│ ├── 371-380/
│ │ ├── Combination Sum IV.cpp
│ │ ├── Design Phone Directory.cpp
│ │ ├── Find K Pairs with Smallest Sums.cpp
│ │ ├── Guess Number Higher or Lower II.cpp
│ │ ├── Guess Number Higher or Lower.cpp
│ │ ├── Insert Delete GetRandom O(1).cpp
│ │ ├── Kth Smallest Element in a Sorted Matrix.cpp
│ │ ├── Sum of Two Integers.cpp
│ │ ├── Super Pow.cpp
│ │ └── Wiggle Subsequence.cpp
│ ├── 381-390/
│ │ ├── Elimination Game.cpp
│ │ ├── Find the Difference.cpp
│ │ ├── First Unique Character in a String.cpp
│ │ ├── Insert Delete GetRandom O(1) - Duplicates allowed.cpp
│ │ ├── Lexicographical Numbers.cpp
│ │ ├── Linked List Random Node.cpp
│ │ ├── Longest Absolute File Path.cpp
│ │ ├── Mini Parser.cpp
│ │ ├── Ransom Note.cpp
│ │ └── Shuffle an Array.cpp
│ ├── 391-400/
│ │ ├── Decode String.cpp
│ │ ├── Evaluate Division.cpp
│ │ ├── Integer Replacement.cpp
│ │ ├── Is Subsequence.cpp
│ │ ├── Longest Substring with At Least K Repeating Characters.cpp
│ │ ├── Nth Digit.cpp
│ │ ├── Perfect Rectangle.cpp
│ │ ├── Random Pick Index.cpp
│ │ ├── Rotate Function.cpp
│ │ └── UTF-8 Validation.cpp
│ ├── 401-410/
│ │ ├── Binary Watch.cpp
│ │ ├── Convert a Number to Hexadecimal.cpp
│ │ ├── Frog Jump.cpp
│ │ ├── Longest Palindrome.cpp
│ │ ├── Queue Reconstruction by Height.cpp
│ │ ├── Remove K Digits.cpp
│ │ ├── Split Array Largest Sum.cpp
│ │ ├── Sum of Left Leaves.cpp
│ │ ├── Trapping Rain Water II.cpp
│ │ └── Valid Word Abbreviation.cpp
│ ├── 411-420/
│ │ ├── Add Strings.cpp
│ │ ├── Arithmetic Slices.cpp
│ │ ├── Battleships in a Board.cpp
│ │ ├── Fizz Buzz.cpp
│ │ ├── Minimum Unique Word Abbreviation.cpp
│ │ ├── Pacific Atlantic Water Flow.cpp
│ │ ├── Partition Equal Subset Sum.cpp
│ │ ├── Sentence Screen Fitting.cpp
│ │ └── Third Maximum Number.cpp
│ ├── 421-430/
│ │ ├── Convert Binary Search Tree to Sorted Doubly Linked List.cpp
│ │ ├── Maximum XOR of Two Numbers in an Array.cpp
│ │ ├── Serialize and Deserialize N-ary Tree.cpp
│ │ ├── Valid Word Square.cpp
│ │ └── Word Squares.cpp
│ ├── 431-440/
│ │ ├── All O`one Data Structure.cpp
│ │ ├── Find All Anagrams in a String.cpp
│ │ ├── Find Right Interval.cpp
│ │ ├── K-th Smallest in Lexicographical Order.cpp
│ │ ├── Minimum Genetic Mutation.cpp
│ │ ├── Number of Segments in a String.cpp
│ │ ├── Path Sum III.cpp
│ │ └── Ternary Expression Parser.cpp
│ ├── 441-450/
│ │ ├── Add Two Numbers II.cpp
│ │ ├── Arithmetic Slices II - Subsequence.cpp
│ │ ├── Arranging Coins.cpp
│ │ ├── Delete Node in a BST.cpp
│ │ ├── Find All Duplicates in an Array.cpp
│ │ ├── Number of Boomerangs.cpp
│ │ ├── Sequence Reconstruction.cpp
│ │ ├── Serialize and Deserialize BST.cpp
│ │ └── String Compression.cpp
│ ├── 451-460/
│ │ ├── 132 Pattern.cpp
│ │ ├── 4Sum II.cpp
│ │ ├── Assign Cookies.cpp
│ │ ├── LFU Cache.cpp
│ │ ├── Minimum Moves to Equal Array Elements.cpp
│ │ ├── Minimum Number of Arrows to Burst Balloons.cpp
│ │ ├── Repeated Substring Pattern.cpp
│ │ └── Sort Characters By Frequency.cpp
│ ├── 461-470/
│ │ ├── Can I Win.cpp
│ │ ├── Convex Polygon.cpp
│ │ ├── Count The Repetitions.cpp
│ │ ├── Hamming Distance.cpp
│ │ ├── Island Perimeter.cpp
│ │ ├── Minimum Moves to Equal Array Elements II.cpp
│ │ ├── Optimal Account Balancing.cpp
│ │ ├── Unique Substrings in Wraparound String.cpp
│ │ └── Validate IP Address.cpp
│ ├── 471-480/
│ │ ├── Concatenated Words.cpp
│ │ ├── Encode String with Shortest Length.cpp
│ │ ├── Heaters.cpp
│ │ ├── Largest Palindrome Product.cpp
│ │ ├── Matchsticks to Square.cpp
│ │ ├── Number Complement.cpp
│ │ ├── Ones and Zeroes.cpp
│ │ ├── Sliding Window Median.cpp
│ │ └── Total Hamming Distance.cpp
│ ├── 481-490/
│ │ ├── Find Permutation.cpp
│ │ ├── License Key Formatting.cpp
│ │ ├── Magical String.cpp
│ │ ├── Max Consecutive Ones II.cpp
│ │ ├── Max Consecutive Ones.cpp
│ │ ├── Predict the Winner.cpp
│ │ ├── Robot Room Cleaner.cpp
│ │ ├── Smallest Good Base.cpp
│ │ ├── The Maze.cpp
│ │ └── Zuma Game.cpp
│ ├── 491-500/
│ │ ├── Construct the Rectangle.cpp
│ │ ├── Diagonal Traverse.cpp
│ │ ├── Increasing Subsequences.cpp
│ │ ├── Keyboard Row.cpp
│ │ ├── Next Greater Element I.cpp
│ │ ├── Reverse Pairs.cpp
│ │ ├── Target Sum.cpp
│ │ ├── Teemo Attacking.cpp
│ │ └── The Maze III.cpp
│ ├── 501-510/
│ │ ├── Base 7.cpp
│ │ ├── Find Mode in Binary Search Tree.cpp
│ │ ├── IPO.cpp
│ │ ├── Most Frequent Subtree Sum.cpp
│ │ ├── Next Greater Element II.cpp
│ │ ├── Perfect Number.cpp
│ │ ├── Relative Ranks.cpp
│ │ └── The Maze II.cpp
│ ├── 511-520/
│ │ ├── Coin Change 2.cpp
│ │ ├── Detect Capital.cpp
│ │ ├── Find Bottom Left Tree Value.cpp
│ │ ├── Find Largest Value in Each Tree Row.cpp
│ │ ├── Freedom Trail.cpp
│ │ ├── Longest Palindromic Subsequence.cpp
│ │ └── Super Washing Machines.cpp
│ ├── 521-530/
│ │ ├── Beautiful Arrangement.cpp
│ │ ├── Contiguous Array.cpp
│ │ ├── Continuous Subarray Sum.cpp
│ │ ├── Longest Uncommon Subsequence I.cpp
│ │ ├── Longest Uncommon Subsequence II.cpp
│ │ ├── Longest Word in Dictionary through Deleting.cpp
│ │ ├── Minimum Distance Between BST Nodes.cpp
│ │ └── Word Abbreviation.cpp
│ ├── 531-540/
│ │ ├── Complex Number Multiplication.cpp
│ │ ├── Convert BST to Greater Tree.cpp
│ │ ├── Encode and Decode TinyURL.cpp
│ │ ├── Lonely Pixel I.cpp
│ │ ├── Lonely Pixel II.cpp
│ │ └── Single Element in a Sorted Array.cpp
│ ├── 541-550/
│ │ ├── 01 Matrix.cpp
│ │ ├── Binary Tree Longest Consecutive Sequence II.cpp
│ │ ├── Boundary of Binary Tree.cpp
│ │ ├── Diameter of Binary Tree.cpp
│ │ ├── Friend Circles.cpp
│ │ ├── Output Contest Matches.cpp
│ │ ├── Reverse String II.cpp
│ │ └── Split Array with Equal Sum.cpp
│ ├── 551-560/
│ │ ├── Brick Wall.cpp
│ │ ├── Next Greater Element III.cpp
│ │ ├── Optimal Division.cpp
│ │ ├── Reverse Words in a String III.cpp
│ │ ├── Split Concatenated Strings.cpp
│ │ ├── Student Attendance Record I.cpp
│ │ ├── Student Attendance Record II.cpp
│ │ └── Subarray Sum Equals K.cpp
│ ├── 561-570/
│ │ ├── Array Nesting.cpp
│ │ ├── Array Partition I.cpp
│ │ ├── Binary Tree Tilt.cpp
│ │ ├── Longest Line of Consecutive One in Matrix.cpp
│ │ ├── Maximum Vacation Days.cpp
│ │ ├── Permutation in String.cpp
│ │ └── Reshape the Matrix.cpp
│ ├── 571-580/
│ │ ├── Distribute Candies.cpp
│ │ ├── Out of Boundary Paths.cpp
│ │ ├── Squirrel Simulation.cpp
│ │ └── Subtree of Another Tree.cpp
│ ├── 581-590/
│ │ ├── Delete Operation for Two Strings.cpp
│ │ ├── Design In-Memory File System.cpp
│ │ ├── Erect the Fence.cpp
│ │ ├── Kill Process.cpp
│ │ └── Shortest Unsorted Continuous Subarray.cpp
│ ├── 591-600/
│ │ ├── Fraction Addition and Subtraction.cpp
│ │ ├── Longest Harmonious Subsequence.cpp
│ │ ├── Minimum Index Sum of Two Lists.cpp
│ │ ├── Non-negative Integers without Consecutive Ones.cpp
│ │ ├── Range Addition II.cpp
│ │ ├── Tag Validator.cpp
│ │ └── Valid Square.cpp
│ ├── 601-610/
│ │ ├── Can Place Flowers.cpp
│ │ ├── Construct String from Binary Tree.cpp
│ │ ├── Design Compressed String Iterator.cpp
│ │ └── Find Duplicate File in System.cpp
│ ├── 611-620/
│ │ ├── Add Bold Tag in String.cpp
│ │ ├── Merge Two Binary Trees.cpp
│ │ └── Valid Triangle Number.cpp
│ ├── 621-630/
│ │ ├── Add One Row to Tree.cpp
│ │ ├── Course Schedule III.cpp
│ │ ├── Design Circular Queue.cpp
│ │ ├── K Inverse Pairs Array.cpp
│ │ ├── Maximum Distance in Arrays.cpp
│ │ ├── Maximum Product of Three Numbers.cpp
│ │ ├── Minimum Factorization.cpp
│ │ └── Task Scheduler.cpp
│ ├── 631-640/
│ │ ├── Average of Levels in Binary Tree.cpp
│ │ ├── Decode Ways II.cpp
│ │ ├── Design Excel Sum Formula.cpp
│ │ ├── Design Log Storage System.cpp
│ │ ├── Exclusive Time of Functions.cpp
│ │ ├── Find the Derangement of An Array.cpp
│ │ ├── Shopping Offers.cpp
│ │ ├── Smallest Range.cpp
│ │ ├── Solve the Equation.cpp
│ │ └── Sum of Square Numbers.cpp
│ ├── 641-650/
│ │ ├── 2 Keys Keyboard.cpp
│ │ ├── Design Search Autocomplete System.cpp
│ │ ├── Dota2 Senate.cpp
│ │ ├── Maximum Average Subarray I.cpp
│ │ ├── Maximum Average Subarray II.cpp
│ │ ├── Maximum Length of Pair Chain.cpp
│ │ ├── Palindromic Substrings.cpp
│ │ ├── Replace Words.cpp
│ │ └── Set Mismatch.cpp
│ ├── 651-660/
│ │ ├── 4 Keys Keyboard.cpp
│ │ ├── Coin Path.cpp
│ │ ├── Find Duplicate Subtrees.cpp
│ │ ├── Find K Closest Elements.cpp
│ │ ├── Judge Route Circle.cpp
│ │ ├── Maximum Binary Tree.cpp
│ │ ├── Print Binary Tree.cpp
│ │ ├── Remove 9.cpp
│ │ ├── Split Array into Consecutive Subsequences.cpp
│ │ └── Two Sum IV - Input is a BST.cpp
│ ├── 661-670/
│ │ ├── Beautiful Arrangement II.cpp
│ │ ├── Equal Tree Partition.cpp
│ │ ├── Image Smoother.cpp
│ │ ├── Kth largest Number in Multiplication Table.cpp
│ │ ├── Maximum Swap.cpp
│ │ ├── Maximum Width of Binary Tree.cpp
│ │ ├── Non-decreasing Array.cpp
│ │ ├── Path Sum IV.cpp
│ │ ├── Strange Printer.cpp
│ │ └── Trim a Binary Search Tree.cpp
│ ├── 671-680/
│ │ ├── 24 Game.cpp
│ │ ├── Cut Off Trees for Golf Event.cpp
│ │ ├── Implement Magic Dictionary.cpp
│ │ ├── Longest Continuous Increasing Subsequence.cpp
│ │ ├── Map Sum Pairs.cpp
│ │ ├── Number of Longest Increasing Subsequence.cpp
│ │ ├── Second Minimum Node In a Binary Tree.cpp
│ │ ├── Valid Palindrome II.cpp
│ │ └── Valid Parenthesis String.cpp
│ ├── 681-690/
│ │ ├── Baseball Game.cpp
│ │ ├── Employee Importance.cpp
│ │ ├── K Empty Slots.cpp
│ │ ├── Knight Probability in Chessboard.cpp
│ │ ├── Longest Univalue Path.cpp
│ │ ├── Maximum Sum of 3 Non-Overlapping Subarrays.cpp
│ │ ├── Next Closest Time.cpp
│ │ ├── Redundant Connection II.cpp
│ │ ├── Redundant Connection.cpp
│ │ └── Repeated String Match.cpp
│ ├── 691-700/
│ │ ├── Binary Number with Alternating Bits.cpp
│ │ ├── Count Binary Substrings.cpp
│ │ ├── Degree of an Array.cpp
│ │ ├── Falling Squares.cpp
│ │ ├── Max Area of Island.cpp
│ │ ├── Number of Distinct Islands.cpp
│ │ ├── Partition to K Equal Sum Subsets.cpp
│ │ └── Top K Frequent Words.cpp
│ ├── 701-710/
│ │ ├── Insert into a Binary Search Tree.cpp
│ │ ├── Random Pick with Blacklist.cpp
│ │ └── To Lower Case.cpp
│ ├── 711-720/
│ │ ├── 1-bit and 2-bit Characters.cpp
│ │ ├── Best Time to Buy and Sell Stock with Transaction Fee.cpp
│ │ ├── Find K-th Smallest Pair Distance.cpp
│ │ ├── Longest Word in Dictionary.cpp
│ │ ├── Max Stack.cpp
│ │ ├── Maximum Length of Repeated Subarray.cpp
│ │ ├── Minimum ASCII Delete Sum for Two Strings.cpp
│ │ ├── Number of Distinct Islands II.cpp
│ │ ├── Range Module.cpp
│ │ └── Subarray Product Less Than K.cpp
│ ├── 721-730/
│ │ ├── Accounts Merge.cpp
│ │ ├── Candy Crush.cpp
│ │ ├── Count Different Palindromic Subsequences.cpp
│ │ ├── Find Pivot Index.cpp
│ │ ├── My Calendar I.cpp
│ │ ├── Number of Atoms.cpp
│ │ ├── Remove Comments.cpp
│ │ ├── Self Dividing Numbers.cpp
│ │ └── Split Linked List in Parts.cpp
│ ├── 731-740/
│ │ ├── Asteroid Collision.cpp
│ │ ├── Daily Temperatures.cpp
│ │ ├── Delete and Earn.cpp
│ │ ├── Flood Fill.cpp
│ │ ├── Monotone Increasing Digits.cpp
│ │ ├── My Calendar II.cpp
│ │ ├── My Calendar III.cpp
│ │ ├── Parse Lisp Expression.cpp
│ │ ├── Sentence Similarity II.cpp
│ │ └── Sentence Similarity.cpp
│ ├── 741-750/
│ │ ├── Closest Leaf in a Binary Tree.cpp
│ │ ├── Find Smallest Letter Greater Than Target.cpp
│ │ ├── Largest Number At Least Twice of Others.cpp
│ │ ├── Min Cost Climbing Stairs.cpp
│ │ ├── Network Delay Time.cpp
│ │ ├── Number Of Corner Rectangles.cpp
│ │ ├── Prefix and Suffix Search.cpp
│ │ └── Shortest Completing Word.cpp
│ ├── 751-760/
│ │ ├── Bold Words in String.cpp
│ │ ├── Cracking the Safe.cpp
│ │ ├── Employee Free Time.cpp
│ │ ├── Find Anagram Mappings.cpp
│ │ ├── IP to CIDR.cpp
│ │ ├── Open the Lock.cpp
│ │ ├── Pour Water.cpp
│ │ ├── Pyramid Transition Matrix.cpp
│ │ ├── Reach a Number.cpp
│ │ └── Set Intersection Size At Least Two.cpp
│ ├── 761-770/
│ │ ├── Couples Holding Hands.cpp
│ │ ├── Largest Plus Sign.cpp
│ │ ├── Max Chunks To Make Sorted II.cpp
│ │ ├── Max Chunks To Make Sorted.cpp
│ │ ├── Partition Labels.cpp
│ │ ├── Prime Number of Set Bits in Binary Representation.cpp
│ │ ├── Reorganize String.cpp
│ │ ├── Special Binary String.cpp
│ │ └── Toeplitz Marix.cpp
│ ├── 771-780/
│ │ ├── Basic Calculator III.cpp
│ │ ├── Global and Local Inversions.cpp
│ │ ├── Jewels and Stones.cpp
│ │ ├── K-th Symbol in Grammar.cpp
│ │ ├── Minimize Max Distance to Gas Station.cpp
│ │ ├── Sliding Puzzle.cpp
│ │ ├── Split BST.cpp
│ │ ├── Swap Adjacent in LR String.cpp
│ │ └── Swim in Rising Water.cpp
│ ├── 781-790/
│ │ ├── Cheapest Flights Within K Stops.cpp
│ │ ├── Escape The Ghosts.cpp
│ │ ├── Is Graph Bipartite?.cpp
│ │ ├── K-th Smallest Prime Fraction.cpp
│ │ ├── Letter Case Permutation.cpp
│ │ ├── Minimum Distance Between BST Nodes.cpp
│ │ ├── Rabbits in Forest.cpp
│ │ ├── Rotated Digits.cpp
│ │ └── Transform to Chessboard.cpp
│ ├── 791-800/
│ │ ├── All Paths From Source to Target.cpp
│ │ ├── Champagne Tower.cpp
│ │ ├── Custom Sort String.cpp
│ │ ├── Number of Matching Subsequences.cpp
│ │ ├── Number of Subarrays with Bounded Maximum.cpp
│ │ ├── Preimage Size of Factorial Zeroes Function.cpp
│ │ ├── Rotate String
│ │ ├── Similar RGB Color.cpp
│ │ └── Valid Tic-Tac-Toe State.cpp
│ ├── 801-810/
│ │ ├── Bricks Falling When Hit.cpp
│ │ ├── Chalkboard XOR Game.cpp
│ │ ├── Expressive Words.cpp
│ │ ├── Find Eventual Safe States.cpp
│ │ ├── Max Increase to Keep City Skyline.cpp
│ │ ├── Minimum Swaps To Make Sequences Increasing.cpp
│ │ ├── Number of Lines To Write String.cpp
│ │ ├── Soup Servings.cpp
│ │ └── Unique Morse Code Words.cpp
│ ├── 811-820/
│ │ ├── Ambiguous Coordinates.cpp
│ │ ├── Binary Tree Pruning.cpp
│ │ ├── Bus Routes.cpp
│ │ ├── Largest Sum of Averages.cpp
│ │ ├── Linked List Components.cpp
│ │ ├── Most Common Word.cpp
│ │ ├── Race Car.cpp
│ │ ├── Short Encoding of Words.cpp
│ │ └── Subdomain Visit Count.cpp
│ ├── 821-830/
│ │ ├── Binary Trees With Factors.cpp
│ │ ├── Card Flipping Game.cpp
│ │ ├── Consecutive Numbers Sum.cpp
│ │ ├── Friends Of Appropriate Ages.cpp
│ │ ├── Goat Latin.cpp
│ │ ├── Making A Large Island.cpp
│ │ ├── Most Profit Assigning Work.cpp
│ │ ├── Positions of Large Groups.cpp
│ │ ├── Shortest Distance to a Character.cpp
│ │ └── Unique Letter String.cpp
│ ├── 831-840/
│ │ ├── Find And Replace in String.cpp
│ │ ├── Flipping an Image.cpp
│ │ ├── Image Overlap.cpp
│ │ ├── Magic Squares In Grid.cpp
│ │ ├── Masking Personal Information.cpp
│ │ ├── New 21 Game.cpp
│ │ ├── Push Dominoes.cpp
│ │ ├── Rectangle Overlap.cpp
│ │ ├── Similar String Groups.cpp
│ │ └── Sum of Distances in Tree.cpp
│ ├── 841-850/
│ │ ├── Backspace String Compare.cpp
│ │ ├── Guess the Word.cpp
│ │ ├── Hand of Straights.cpp
│ │ ├── Keys and Rooms.cpp
│ │ ├── Longest Mountain in Array.cpp
│ │ ├── Maximize Distance to Closest Person.cpp
│ │ ├── Shifting Letters.cpp
│ │ ├── Shortest Path Visiting All Nodes.cpp
│ │ └── Split Array into Fibonacci Sequence.cpp
│ ├── 851-860/
│ │ ├── Buddy Strings.cpp
│ │ ├── Car Fleet.cpp
│ │ ├── Exam Room.cpp
│ │ ├── K-Similar Strings.cpp
│ │ ├── Lemonade Change.cpp
│ │ ├── Loud and Rich.cpp
│ │ ├── Peak Index in a Mountain Array.cpp
│ │ └── Score of Parentheses.cpp
│ ├── 861-870/
│ │ ├── Advantage Shuffle.cpp
│ │ ├── All Nodes Distance K in Binary Tree.cpp
│ │ ├── Binary Gap.cpp
│ │ ├── Prime Palindrome.cpp
│ │ ├── Reordered Power of 2.cpp
│ │ ├── Score After Flipping Matrix.cpp
│ │ ├── Smallest Subtree with all the Deepest Nodes.cpp
│ │ └── Transpose Matrix.cpp
│ ├── 871-880/
│ │ ├── Implement Rand10() Using Rand7().cpp
│ │ ├── Koko Eating Bananas.cpp
│ │ ├── Leaf-Similar Trees.cpp
│ │ ├── Length of Longest Fibonacci Subsequence.cpp
│ │ ├── Middle of the Linked List.cpp
│ │ └── Stone Game.cpp
│ ├── 881-890/
│ │ ├── Boats to Save People.cpp
│ │ ├── Possible Bipartition.cpp
│ │ ├── Projection Area of 3D Shapes.cpp
│ │ └── Uncommon Words from Two Sentences.cpp
│ ├── 891-900/
│ │ └── Maximum Frequency Stack.cpp
│ ├── 911-920/
│ │ ├── Complete Binary Tree Inserter.cpp
│ │ ├── Maximum Sum Circular Subarray.cpp
│ │ ├── Number of Music Playlists.cpp
│ │ ├── Online Election.cpp
│ │ ├── Partition Array into Disjoint Intervals.cpp
│ │ ├── Reverse Only Letters.cpp
│ │ ├── Word Subsets.cpp
│ │ └── X of a Kind in a Deck of Cards.cpp
│ ├── 921-930/
│ │ ├── 3Sum With Multiplicity.cpp
│ │ ├── Binary Subarrays With Sum.cpp
│ │ ├── Flip String to Monotone Increasing.cpp
│ │ ├── Long Pressed Name.cpp
│ │ ├── Minimize Malware Spread.cpp
│ │ ├── Minimum Add to Make Parentheses Valid.cpp
│ │ ├── Sort Array By Parity II.cpp
│ │ ├── Three Equal Parts.cpp
│ │ └── Unique Email Addresses.cpp
│ ├── 931-940/
│ │ ├── Beautiful Array.cpp
│ │ ├── Distinct Subsequences II.cpp
│ │ ├── Knight Dialer.cpp
│ │ ├── Minimum Area Rectangle.cpp
│ │ ├── Minimum Falling Path Sum.cpp
│ │ ├── Number of Recent Calls.cpp
│ │ ├── Range Sum of BST.cpp
│ │ ├── Reorder Log Files.cpp
│ │ ├── Shortest Bridge.cpp
│ │ └── Stamping The Sequence.cpp
│ ├── 941-950/
│ │ ├── Bag of Tokens.cpp
│ │ ├── DI String Match.cpp
│ │ ├── Delete Columns to Make Sorted.cpp
│ │ ├── Minimum Increment to Make Array Unique.cpp
│ │ ├── Most Stones Removed with Same Row or Column.cpp
│ │ ├── Valid Mountain Array.cpp
│ │ └── Validate Stack Sequences.cpp
│ ├── 951-960/
│ │ ├── Check Completeness of a Binary Tree.cpp
│ │ ├── Prison Cells After N Days.cpp
│ │ ├── Regions Cut By Slashes.cpp
│ │ └── Verifying an Alien Dictionary.cpp
│ ├── 961-970/
│ │ ├── N-Repeated Element in Size 2N Array.cpp
│ │ └── Pancake Sorting.cpp
│ ├── 971-980/
│ │ ├── Distribute Coins in Binary Tree.cpp
│ │ ├── K Closest Points to Origin.cpp
│ │ ├── Largest Perimeter Triangle.cpp
│ │ ├── Longest Turbulent Subarray.cpp
│ │ ├── Squares of a Sorted Array.cpp
│ │ ├── Subarray Sums Divisible by K.cpp
│ │ └── Unique Paths III.cpp
│ ├── 981-990/
│ │ ├── Add to Array-Form of Integer.cpp
│ │ ├── Interval List Intersections.cpp
│ │ ├── Satisfiability of Equality Equations.cpp
│ │ ├── String Without AAA or BBB.cpp
│ │ └── Time Based Key-Value Store.cpp
│ └── 991-1000/
│ ├── Broken Calculator.cpp
│ ├── Cousins in Binary Tree.cpp
│ ├── Find the Town Judge.cpp
│ ├── Maximum Binary Tree II.cpp
│ ├── Minimum Number of K Consecutive Bit Flips.cpp
│ ├── Number of Squareful Arrays.cpp
│ └── Rotting Oranges.cpp
├── golang/
│ └── 001-010/
│ ├── Add Two Numbers.go
│ ├── Longest Substring Without Repeating Characters.go
│ └── Two Sum.go
├── java/
│ ├── 201-210/
│ │ └── Happy Number.java
│ ├── 291-300/
│ │ └── Nim Game.java
│ └── 331-340/
│ ├── Counting Bits.java
│ └── Nested List Weight Sum.java
├── python/
│ ├── 001-010/
│ │ └── Median of Two Sorted Arrays.py
│ ├── 011-020/
│ │ └── Valid Parentheses.py
│ ├── 021-030/
│ │ └── Reverse Nodes in k-Group.py
│ ├── 031-040/
│ │ ├── Combination Sum II.py
│ │ ├── Combination Sum.py
│ │ ├── Next Permutation.py
│ │ ├── Search Insert Position.py
│ │ ├── Search for a Range.py
│ │ ├── Sudoku Solver.py
│ │ └── Valid Sudoku.py
│ ├── 041-050/
│ │ ├── Jump Game II.py
│ │ └── Rotate Image.py
│ ├── 051-060/
│ │ ├── Jump Game.py
│ │ └── Permutation Sequence.py
│ ├── 061-070/
│ │ ├── Minimum Path Sum.py
│ │ ├── Sqrt(x).py
│ │ ├── Unique Paths II.py
│ │ ├── Unique Paths.py
│ │ └── Valid Number.py
│ ├── 071-080/
│ │ └── Edit Distance.py
│ ├── 081-090/
│ │ ├── Largest Rectangle in Histogram.py
│ │ ├── Maximal Rectangle.py
│ │ ├── Remove Duplicates from Sorted List II.py
│ │ └── Remove Duplicates from Sorted List.py
│ ├── 091-100/
│ │ ├── Decode Ways.py
│ │ └── Interleaving String.py
│ ├── 101-110/
│ │ └── Symmetric Tree.py
│ ├── 111-120/
│ │ ├── Path Sum.py
│ │ ├── Populating Next Right Pointers in Each Node II.py
│ │ └── Populating Next Right Pointers in Each Node.py
│ ├── 121-130/
│ │ ├── Best Time to Buy and Sell Stock.py
│ │ ├── Binary Tree Maximum Path Sum.py
│ │ ├── Word Ladder II.py
│ │ └── Word Ladder.py
│ ├── 131-140/
│ │ ├── Candy.py
│ │ ├── Clone Graph.py
│ │ └── Single Number II.py
│ ├── 141-150/
│ │ ├── Binary Tree Postorder Traversal.py
│ │ └── LRU Cache.py
│ ├── 151-160/
│ │ ├── Find Minimum in Rotated Sorted Array II.py
│ │ └── Find Minimum in Rotated Sorted Array.py
│ ├── 161-170/
│ │ ├── Majority Element.py
│ │ └── Maximum Gap.py
│ ├── 171-180/
│ │ └── Largest Number.py
│ ├── 181-190/
│ │ ├── Best Time to Buy and Sell Stock IV.py
│ │ └── Repeated DNA Sequences.py
│ ├── 191-200/
│ │ ├── Binary Tree Right Side View.py
│ │ └── House Robber.py
│ ├── 201-210/
│ │ ├── Count Primes.py
│ │ └── Implement Trie (Prefix Tree).py
│ ├── 211-220/
│ │ └── House Robber II.py
│ ├── 221-230/
│ │ └── Maximal Square.py
│ └── 231-240/
│ ├── Palindrome Linked List.py
│ ├── Product of Array Except Self.py
│ └── a.py
└── scala/
├── 0001-0010/
│ ├── Add Two Numbers.scala
│ ├── Longest Substring Without Repeating Characters.scala
│ ├── Palindrome Number.scala
│ └── Two Sum.scala
└── 0011-0020/
├── Longest Common Prefix.scala
└── Roman to Integer.scala
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
.DS_Store
================================================
FILE: LICENSE
================================================
Copyright (C) <2015> <leetcode.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
================================================
FILE: README.md
================================================
# leetcode
LeetCode solutions.
LeetCode solutions in English.
LeetCode中文解答。
I uploaded some codes [here](https://zhenchaogan.gitbook.io/leetcode-solution/)
[Video solutions](https://www.youtube.com/watch?v=iZHDx-k2Mxw&list=PLSY2q1ZYmTARCSZvXIwO79Lb9LB5EBX-a&index=2) [中文解答](https://www.youtube.com/watch?v=6S1eKneFu8I&list=PLSY2q1ZYmTATCxSnwd_NohDmmt8PTBzrq) [中文bilibili解答](https://space.bilibili.com/1551381295/channel/detail?cid=167862)
<table class="table table-bordered table-striped table-condensed">
<tr>
<td colspan='40'><font size="4px" color="#0x888888">Problem</font></td>
<td colspan='20'><font size="4px" color="#0x888888">Video Solution</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/001-010/Two%20Sum.cpp">LeetCode 1. Two Sum</font></td>
<td align="center"><a href="https://www.youtube.com/watch?v=WbSOR-Qewt0&feature=youtu.be"><font color="black">English</font></td>
<td align="center"><a href="https://www.youtube.com/watch?v=GKM0IByXKkk&feature=youtu.be"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1dy4y1n7AS/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/001-010/Add%20Two%20Numbers.cpp">LeetCode 2. Add Two Numbers</font></td>
<td align="center"><a href="https://youtu.be/nrT4oGpOLfk"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/LVhNH1BdGGM"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1h54y1W7iR/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/001-010/Longest%20Substring%20Without%20Repeating%20Characters.cpp">LeetCode 3. Longest Substring Without Repeating Characters</font></td>
<td align="center"><a href="https://youtu.be/51tTP5RJlQ0"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/BUXpASogwZw"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV17A411g7xk/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/001-010/Median%20of%20Two%20Sorted%20Arrays.cpp">LeetCode 4. Median of Two Sorted Arrays</font></td>
<td align="center"><a href="https://youtu.be/12mkeVQIiQc"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/iQ1oxyXPJCY"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1HU4y1x7dt/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/001-010/Longest%20Palindromic%20Substring.cpp">LeetCode 5. Longest Palindromic Substring</font></td>
<td align="center"><a href="https://youtu.be/l0FR5x5dNvs"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/7jkLvTSyyy4"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV12541177cx/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/001-010/ZigZag%20Conversion.cpp">LeetCode 6. ZigZag Conversion</font></td>
<td align="center"><a href="https://youtu.be/1v4c3nj_8jc"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/eG9JVMAhKz8"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1iv4y1Z7M9/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/001-010/Reverse%20Integer.cpp">LeetCode 7. Reverse Integer</font></td>
<td align="center"><a href="https://youtu.be/9Uoze4Wfesg"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/2Wrdfm0FBOs"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1Ry4y1E7mA/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/001-010/String%20to%20Integer%20(atoi).cpp">LeetCode 8. String to Integer (atoi)</font></td>
<td align="center"><a href="https://youtu.be/VMr_bFDLXrA"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/1EwgseajIOE"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1kV411i7kM/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/001-010/Palindrome%20Number.cpp">LeetCode 9. Palindrome Number</font></td>
<td align="center"><a href="https://youtu.be/99fQ34HHTuw"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/obBNRAfHsno"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1vU4y1W7Zf/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/001-010/Regular%20Expression%20Matching.cpp">LeetCode 10. Regular Expression Matching</font></td>
<td align="center"><a href="https://youtu.be/_U3vZCgLhXE"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/cHwEdvY8rRg"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1Tb4y1R7Fs/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/011-020/Container%20With%20Most%20Water.cpp">LeetCode 11. Container With Most Water</font></td>
<td align="center"><a href="https://youtu.be/veZhNuviRtg"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/HK5-nhR0Jtc"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1Ef4y1z75r/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/011-020/Integer%20to%20Roman.cpp">LeetCode 12. Integer to Roman</font></td>
<td align="center"><a href="https://youtu.be/oL1hreAAFc0"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/d80x6Ruh1Ic"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1bK4y1Q7mc/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/011-020/Roman%20to%20Integer.cpp">LeetCode 13. Roman to Integer</font></td>
<td align="center"><a href="https://youtu.be/53XFEgtot7g"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/LA3qRG3qS48"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1AN411d7bX/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/011-020/Longest%20Common%20Prefix.cpp">LeetCode 14. Longest Common Prefix</font></td>
<td align="center"><a href="https://youtu.be/ukfzYlQPwsY"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/qdLc68w9X5c"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1Rz4y127Bs/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/011-020/3Sum.cpp">LeetCode 15. 3Sum</font></td>
<td align="center"><a href="https://youtu.be/3Szdf-_uRRE"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/v86W0cgvO5Y"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1cy4y1J71A/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/011-020/3Sum%20Closest.cpp">LeetCode 16. 3Sum Closest</font></td>
<td align="center"><a href="https://youtu.be/G9x8UqE_F2k"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/ovkcwjUUapw"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV19V411e74N/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/011-020/Letter%20Combinations%20of%20a%20Phone%20Number.cpp">LeetCode 17. Letter Combinations of a Phone Number</font></td>
<td align="center"><a href="https://youtu.be/czE2XcQjYyE"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/PvKXodU6irA"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1tZ4y1A7Vg/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/011-020/4Sum.cpp">LeetCode 18. 4Sum</font></td>
<td align="center"><a href="https://youtu.be/zM8yfKADVfM"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/HJ8rgwmO1L0"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1by4y1J7GF/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/011-020/Remove%20Nth%20Node%20From%20End%20of%20List.cpp">LeetCode 19. Remove Nth Node From End of List</font></td>
<td align="center"><a href="https://youtu.be/YKi_YM9Ih_I"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/aTSVLDJduBM"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1qi4y1T7NE/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/011-020/Valid%20Parentheses.cpp">LeetCode 20. Valid Parentheses</font></td>
<td align="center"><a href="https://youtu.be/rh4T1sI8krU"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/oAu0zWo3fNw"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1Ty4y1e7dQ/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/021-030/Merge%20Two%20Sorted%20Lists.cpp">LeetCode 21. Merge Two Sorted Lists</font></td>
<td align="center"><a href="https://youtu.be/LsaQUAQacZA"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/Darw7d-fg6U"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1EN41197Fo/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/021-030/Generate%20Parentheses.cpp">LeetCode 22. Generate Parentheses</font></td>
<td align="center"><a href="https://www.youtube.com/watch?v=7UnrtxdII2g"><font color="black">English</font></td>
<td align="center"><a href="https://www.youtube.com/watch?v=AfCUpUedBgU"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV15N41197Qq/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/021-030/Merge%20k%20Sorted%20Lists.cpp">LeetCode 23. Merge k Sorted Lists</font></td>
<td align="center"><a href="https://youtu.be/Xequ4LCiHgM"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/BHoY6wjfx4g"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1ki4y1T77r/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/021-030/Swap%20Nodes%20in%20Pairs.cpp">LeetCode 24. Swap Nodes in Pairs</font></td>
<td align="center"><a href="https://youtu.be/xHD8uzI3D3Y"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/eeV5zbeqous"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1Wp4y1H72Z/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/021-030/Reverse%20Nodes%20in%20k-Group.cpp">LeetCode 25. Reverse Nodes in k-Group</font></td>
<td align="center"><a href="https://youtu.be/dc4gxhpCrPY"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/goNpyRA02jw"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV18K4y1J7Fm/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/021-030/Remove%20Duplicates%20from%20Sorted%20Array.cpp">LeetCode 26. Remove Duplicates from Sorted Array</font></td>
<td align="center"><a href="https://youtu.be/ifVpYbnm05A"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/Dy9uPt-HvYQ"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1Gy4y1a7AB/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/021-030/Remove%20Element.cpp">LeetCode 27. Remove Element</font></td>
<td align="center"><a href="https://youtu.be/dUENPWnea6g"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/OFiDGVXm7ko"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1ZX4y1G7EE/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/021-030/Implement%20strStr().cpp">LeetCode 28. Implement strStr()</font></td>
<td align="center"><a href="https://youtu.be/G9c18kcusBY"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/2XJeC0eVNrc"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1CA411K7f8/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/021-030/Divide%20Two%20Integers.cpp">LeetCode 29. Divide Two Integers</font></td>
<td align="center"><a href="https://youtu.be/7-_MeN35y6M"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/0BdG-hLtDZ4"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV16N41197Go/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/021-030/Substring%20with%20Concatenation%20of%20All%20Words.cpp">LeetCode 30. Substring with Concatenation of All Words</font></td>
<td align="center"><a href="https://youtu.be/eebtefMRvjQ"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/n9fYwG3dC_Q"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1up4y1h7AC/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/031-040/Next%20Permutation.cpp">LeetCode 31. Next Permutation</font></td>
<td align="center"><a href="https://youtu.be/0_eyN3VnTxc"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/JBX8rktJr3Y"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1DV411v7MM/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/031-040/Longest%20Valid%20Parentheses.cpp">LeetCode 32. Longest Valid Parentheses</font></td>
<td align="center"><a href="https://youtu.be/APvAgoFcFYQ"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/7sLZoD05uxw"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV13z4y117uv/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/031-040/Search%20in%20Rotated%20Sorted%20Array.cpp">LeetCode 33. Search in Rotated Sorted Array</font></td>
<td align="center"><a href="https://youtu.be/_0_8c6kZlxM"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/gSevuT3fvZU"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1154y187P5/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/041-050/Trapping%20Rain%20Water.cpp">LeetCode 42. Trapping Rain Water</font></td>
<td align="center"><a href="https://youtu.be/1LXscFcXkOk"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/vzNQr6ocvt4"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1BK4y1N75u/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/051-060/Merge%20Intervals.cpp">LeetCode 56. Merge Intervals</font></td>
<td align="center"><a href="https://youtu.be/TBw99kT-r6A"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/WKEZOVgYVjI"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1fK4y1N77s/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/061-070/Add%20Binary.cpp">LeetCode 67. Add Binary</font></td>
<td align="center"><a href="https://youtu.be/LIe-KekRmGE"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/rZUpzKi0w50"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1LQ4y1Z7MB/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/081-090/Search%20in%20Rotated%20Sorted%20Array%20II.cpp">LeetCode 81. Search in Rotated Sorted Array II</font></td>
<td align="center"><a href="https://youtu.be/SobfkJqBFYk"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/tBfnbjEw6RQ"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1g54y187cX/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/121-130/Valid%20Palindrome.cpp">LeetCode 125. Valid Palindrome</font></td>
<td align="center"><a href="https://youtu.be/TczseY1HaXI"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/4o2yZy_-iV0"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1TK4y1o7aa/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/151-160/Find%20Minimum%20in%20Rotated%20Sorted%20Array.cpp">LeetCode 153. Find Minimum in Rotated Sorted Array</font></td>
<td align="center"><a href="https://youtu.be/sNP3mg6dGAU"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/PTS5CXXBT1s"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV15h411X72i/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/151-160/Find%20Minimum%20in%20Rotated%20Sorted%20Array%20II.cpp">LeetCode 154. Find Minimum in Rotated Sorted Array II</font></td>
<td align="center"><a href="https://youtu.be/rR5M-Z0R3QE"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/w_OIDPaf_eI"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV12p4y1b74Q/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/151-160/Read%20N%20Characters%20Given%20Read4.cpp">LeetCode 157. Read N Characters Given Read4</font></td>
<td align="center"><a href="https://youtu.be/bziuNha1nXw"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/Zw2UzFsMfZI"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1rX4y137FB/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/151-160/Read%20N%20Characters%20Given%20Read4%20II%20-%20Call%20multiple%20times.cpp">LeetCode 158. Read N Characters Given Read4 II - Call multiple times</font></td>
<td align="center"><a href="https://youtu.be/FYEfiWkkSEo"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/E-UIXA6LTIc"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1RV411Y7P3/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/231-240/Lowest%20Common%20Ancestor%20of%20a%20Binary%20Tree.cpp">LeetCode 236. Lowest Common Ancestor of a Binary Tree</font></td>
<td align="center"><a href="https://youtu.be/XhLMEiZWEZ4"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/T-PGz0jnAHA"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV14B4y1P7PF/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/231-240/Product%20of%20Array%20Except%20Self.cpp">LeetCode 238. Product of Array Except Self</font></td>
<td align="center"><a href="https://youtu.be/_M6LXQqd33w"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/hdCuT7xxNAY"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1rK4y1K72x/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/261-270/Alien%20Dictionary.cpp">LeetCode 269. Alien Dictionary</font></td>
<td align="center"><a href="https://youtu.be/OsjodfsorBs"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/5slT8ZfVKrQ"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1NU4y1h7Ww/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/291-300/Find%20Median%20from%20Data%20Stream.cpp">Leetcode 295. Find Median from Data Stream</font></td>
<td align="center"><a href="https://youtu.be/sSUCgilaVJ4"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/ByZgcvujtSA"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV16v411s7KH/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/291-300/Serialize%20and%20Deserialize%20Binary%20Tree.cpp">Leetcode 297. Serialize and Deserialize Binary Tree</font></td>
<td align="center"><a href="https://youtu.be/iZHDx-k2Mxw"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/8_JSg4RWvhY"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1rN411d7K1/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/291-300/Longest%20Increasing%20Subsequence.cpp">LeetCode 300. Longest Increasing Subsequence</font></td>
<td align="center"><a href="https://youtu.be/MGoFqowsxbU"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/7g3uoteFKug"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1Vh411C7if/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/301-310/Remove%20Invalid%20Parentheses.cpp">LeetCode 301. Remove Invalid Parentheses</font></td>
<td align="center"><a href="https://youtu.be/hFGjMV851OU"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/I91977216Hk"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1i54y1a7g9/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/331-340/Palindrome%20Pairs.cpp">LeetCode 336. Palindrome Pairs</font></td>
<td align="center"><a href="https://youtu.be/bNXpdDNjKjM"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/P5-bM5g4m5Q"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1vb4y1D7Mq/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/401-410/Trapping%20Rain%20Water%20II.cpp">LeetCode 407. Trapping Rain Water II</font></td>
<td align="center"><a href="https://youtu.be/fqgqhRItdD4"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/GM2a2KalLYA"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1wK4y1K7t3/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/411-420/Add%20Strings.cpp">LeetCode 415. Add Strings</font></td>
<td align="center"><a href="https://youtu.be/UUhGJVIXFOQ"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/jOBZnOcjBQc"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1Z54y1L7Ho/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/421-430/Convert%20Binary%20Search%20Tree%20to%20Sorted%20Doubly%20Linked%20List.cpp">LeetCode 426. Convert Binary Search Tree to Sorted Doubly Linked List</font></td>
<td align="center"><a href="https://youtu.be/SLT9NasJo4U"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/-TSxiyrOwIQ"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1Cf4y147qd/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/481-490/Robot%20Room%20Cleaner.cpp">LeetCode 489. Robot Room Cleaner</font></td>
<td align="center"><a href="https://youtu.be/lXEBnevMfLg"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/AkLu58eJQPc"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1nZ4y1A7Rp/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/551-560/Subarray%20Sum%20Equals%20K.cpp">LeetCode 560. Subarray Sum Equals K</font></td>
<td align="center"><a href="https://youtu.be/l0dLq-qI588"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/cBGP5zAzom0"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1aK4y1U7jb/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/671-680/Valid%20Palindrome%20II.cpp">LeetCode 680. Valid Palindrome II</font></td>
<td align="center"><a href="https://youtu.be/rNTH2DSW8z0"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/w18su7VGwUQ"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1Rf4y1W7GE/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/701-710/Random%20Pick%20with%20Blacklist.cpp">LeetCode 710. Random Pick with Blacklist</font></td>
<td align="center"><a href="https://youtu.be/Bq3M4itMpbs"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/vJPVDzVrMSE"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1FK4y1S7g6/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/721-730/Accounts%20Merge.cpp">LeetCode 721. Accounts Merge</font></td>
<td align="center"><a href="https://youtu.be/pqvyyDQ9yIo"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/YAtoN4NikWM"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1RN411Q7Vk/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/861-870/All%20Nodes%20Distance%20K%20in%20Binary%20Tree.cpp">LeetCode 863. All Nodes Distance K in Binary Tree</font></td>
<td align="center"><a href="https://youtu.be/81kQSmLwtDA"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/KMIEWurYs10"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1QA411N7Ns/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/911-920/Maximum%20Sum%20Circular%20Subarray.cpp">LeetCode 918. Maximum Sum Circular Subarray</font></td>
<td align="center"><a href="https://youtu.be/oCDQ3JMZXw4"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/o_qM8AJUjt4"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1G5411A7H3/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/951-960/Verifying%20an%20Alien%20Dictionary.cpp">LeetCode 953. Verifying an Alien Dictionary</font></td>
<td align="center"><a href="https://youtu.be/jwL1Q70YNso"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/Ou-28FTq00g"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1gK4y1U7Bp/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/971-980/K%20Closest%20Points%20to%20Origin.cpp">LeetCode 973. K Closest Points to Origin</font></td>
<td align="center"><a href="https://youtu.be/V2pdqKe2mjY"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/HaRE_RS70IQ"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1s54y1a7iQ/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1241-1250/Minimum%20Remove%20to%20Make%20Valid%20Parentheses.cpp">LeetCode 1249. Minimum Remove to Make Valid Parentheses</font></td>
<td align="center"><a href="https://youtu.be/S4LLF3uT-EY"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/vxMmmvdnuNs"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1n64y1v7Nm/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1421-1430/Leftmost%20Column%20with%20at%20Least%20a%20One.cpp">LeetCode 1428. Leftmost Column with at Least a One</font></td>
<td align="center"><a href="https://youtu.be/O3KQIh0J89g"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/koAFGCKT-Hw"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1ef4y1478d/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1561-1570/Dot%20Product%20of%20Two%20Sparse%20Vectors.cpp">LeetCode 1570. Dot Product of Two Sparse Vectors</font></td>
<td align="center"><a href="https://youtu.be/yzaZJCCjV7M"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/Ns_gNGRhGd8"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1FZ4y1w7tQ/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1641-1650/Lowest%20Common%20Ancestor%20of%20a%20Binary%20Tree%20II.cpp">LeetCode 1644. Lowest Common Ancestor of a Binary Tree II</font></td>
<td align="center"><a href="https://youtu.be/d1b1WcKOGkU"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/NP9n3ebk620"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1sf4y1x7Kn/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1641-1650/Lowest%20Common%20Ancestor%20of%20a%20Binary%20Tree%20III.cpp">LeetCode 1650. Lowest Common Ancestor of a Binary Tree III</font></td>
<td align="center"><a href="https://youtu.be/8hrKhABmle8"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/31KtJn5IS9Q"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1sy4y1h7Ap/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1671-1680/Lowest%20Common%20Ancestor%20of%20a%20Binary%20Tree%20IV.cpp">LeetCode 1676. Lowest Common Ancestor of a Binary Tree IV</font></td>
<td align="center"><a href="https://youtu.be/_cJSRjNDn9s"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/6-q4KywBGAY"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1yb4y1Q7Ns/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1721-1730/Largest%20Submatrix%20With%20Rearrangements.cpp">LeetCode 1727. Largest Submatrix With Rearrangements</font></td>
<td align="center"><a href="https://youtu.be/DDN9ROQPwzA"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/6S1eKneFu8I"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1654y1W7hY/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1751-1760/Maximum%20Number%20of%20Events%20That%20Can%20Be%20Attended%20II.cpp">LeetCode 1751. Maximum Number of Events That Can Be Attended II</font></td>
<td align="center"><a href="https://youtu.be/Az2GoGzOSEQ"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/DBsANiXd0LA"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV13y4y1Y7SW/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1751-1760/Largest%20Merge%20Of%20Two%20Strings.cpp">LeetCode 1754. Largest Merge Of Two Strings</font></td>
<td align="center"><a href="https://youtu.be/l5gKIfFbCIY"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/69YytzC_g_w"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1C541177NK/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1751-1760/Closest%20Subsequence%20Sum.cpp">LeetCode 1755. Closest Subsequence Sum</font></td>
<td align="center"><a href="https://youtu.be/K_CB32_SQFs"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/R_fDIPryG78"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1Fz4y1U7zu/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1751-1760/Minimum%20Limit%20of%20Balls%20in%20a%20Bag.cpp">LeetCode 1760. Minimum Limit of Balls in a Bag</font></td>
<td align="center"><a href="https://youtu.be/5RLgPa7TWMY"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/C2s5lMLwyBE"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1wb4y1R7F5/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1761-1770/Minimum%20Degree%20of%20a%20Connected%20Trio%20in%20a%20Graph.cpp">LeetCode 1761. Minimum Degree of a Connected Trio in a Graph</font></td>
<td align="center"><a href="https://youtu.be/gSLz62X1eUY"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/8ud2wbNKPrM"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1T54y1Y7QD/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1761-1770/Form%20Array%20by%20Concatenating%20Subarrays%20of%20Another%20Array.cpp">LeetCode 1764. Form Array by Concatenating Subarrays of Another Array</font></td>
<td align="center"><a href="https://youtu.be/h6vQbNpfHbc"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/x8Hjo8C4_mA"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1WA411M7MH/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1761-1770/Map%20of%20Highest%20Peak.cpp">LeetCode 1765. Map of Highest Peak</font></td>
<td align="center"><a href="https://youtu.be/rMH2WLcD-Tc"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/9bFC2CLXynM"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://member.bilibili.com/platform/upload-manager/article"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1761-1770/Tree%20of%20Coprimes.cpp">LeetCode 1766. Tree of Coprimes</font></td>
<td align="center"><a href="https://youtu.be/l4sZZ0NJiCE"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/riLoVJ3ROEM"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1vb4y1R7Ji/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1761-1770/Maximum%20Score%20from%20Performing%20Multiplication%20Operations.cpp">LeetCode 1770. Maximum Score from Performing Multiplication Operations</font></td>
<td align="center"><a href="https://youtu.be/ggv0pK4BRuI"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/SBOp20CzqK0"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1QA411M7Da/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1771-1780/Maximize%20Palindrome%20Length%20From%20Subsequences.cpp">LeetCode 1771. Maximize Palindrome Length From Subsequences</font></td>
<td align="center"><a href="https://youtu.be/BJBdt7izITY"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/8KW1YYn2Puw"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1AK4y1H7jA/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1771-1780/Closest%20Dessert%20Cost.cpp">LeetCode 1774. Closest Dessert Cost</font></td>
<td align="center"><a href="https://youtu.be/0XCq29SOhNQ"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/fE-ZdhJF5Dc"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV12U4y1H7mX/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1771-1780/Equal%20Sum%20Arrays%20With%20Minimum%20Number%20of%20Operations.cpp">LeetCode 1775. Equal Sum Arrays With Minimum Number of Operations</font></td>
<td align="center"><a href="https://youtu.be/HkMyTGrBQxU"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/b-5bi-GA8_o"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1254y1h7ao/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1771-1780/Car%20Fleet%20II.cpp">LeetCode 1776. Car Fleet II</font></td>
<td align="center"><a href="https://youtu.be/iGxc4hgBM4c"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/0tB6Ozo40Kk"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1Qi4y1T7jR/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1771-1780/Shortest%20Path%20in%20a%20Hidden%20Grid.cpp">LeetCode 1778. Shortest Path in a Hidden Grid</font></td>
<td align="center"><a href="https://youtu.be/P8H-oxAQAuY"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/tfNTJtdOW6c"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1i54y1a74m/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1771-1780/Find%20Nearest%20Point%20That%20Has%20the%20Same%20X%20or%20Y%20Coordinate.cpp">LeetCode 1779. Find Nearest Point That Has the Same X or Y Coordinate</font></td>
<td align="center"><font color="black">English</font></td>
<td align="center"><font color="black">中文Youtube</font></td>
<td align="center"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1771-1780/Check%20if%20Number%20is%20a%20Sum%20of%20Powers%20of%20Three.cpp">LeetCode 1780. Check if Number is a Sum of Powers of Three</font></td>
<td align="center"><font color="black">English</font></td>
<td align="center"><font color="black">中文Youtube</font></td>
<td align="center"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1781-1790/Sum%20of%20Beauty%20of%20All%20Substrings.cpp">LeetCode 1781. Sum of Beauty of All Substrings</font></td>
<td align="center"><font color="black">English</font></td>
<td align="center"><font color="black">中文Youtube</font></td>
<td align="center"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1781-1790/Count%20Pairs%20Of%20Nodes.cpp">LeetCode 1782. Count Pairs Of Nodes</font></td>
<td align="center"><a href="https://youtu.be/Ubch4urToXI"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/7tU017USVLw"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1z54y1a7WT/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1781-1790/Check%20if%20Binary%20String%20Has%20at%20Most%20One%20Segment%20of%20Ones.cpp">LeetCode 1784. Check if Binary String Has at Most One Segment of Ones</font></td>
<td align="center"><font color="black">English</font></td>
<td align="center"><font color="black">中文Youtube</font></td>
<td align="center"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1781-1790/Minimum%20Elements%20to%20Add%20to%20Form%20a%20Given%20Sum.cpp">LeetCode 1785. Minimum Elements to Add to Form a Given Sum</font></td>
<td align="center"><font color="black">English</font></td>
<td align="center"><font color="black">中文Youtube</font></td>
<td align="center"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1781-1790/Number%20of%20Restricted%20Paths%20From%20First%20to%20Last%20Node.cpp">LeetCode 1786. Number of Restricted Paths From First to Last Node</font></td>
<td align="center"><a href="https://youtu.be/b0YQ-IQbX1k"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/_NW5IRZtdOY"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1Xv411h74T/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1781-1790/Make%20the%20XOR%20of%20All%20Segments%20Equal%20to%20Zero.cpp">LeetCode 1787. Make the XOR of All Segments Equal to Zero</font></td>
<td align="center"><a href="https://youtu.be/IjzRWhLIaqA"><font color="black"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/iMKtxo3N2r8"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1Wb4y197Fx/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1781-1790/Maximize%20the%20Beauty%20of%20the%20Garden.cpp">LeetCode 1788. Maximize the Beauty of the Garden</font></td>
<td align="center"><a href="https://youtu.be/3eHQSpIGvwE"><font color="black"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/GPgHycs-VTg"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1uh411Q7nt/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1781-1790/Check%20if%20One%20String%20Swap%20Can%20Make%20Strings%20Equal.cpp">LeetCode 1790. Check if One String Swap Can Make Strings Equal</font></td>
<td align="center"><font color="black">English</font></td>
<td align="center"><font color="black">中文Youtube</font></td>
<td align="center"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1791-1800/Find%20Center%20of%20Star%20Graph.cpp">LeetCode 1791. Find Center of Star Graph</font></td>
<td align="center"><font color="black">English</font></td>
<td align="center"><font color="black">中文Youtube</font></td>
<td align="center"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1791-1800/Maximum%20Average%20Pass%20Ratio.cpp">LeetCode 1792. Maximum Average Pass Ratio</font></td>
<td align="center"><a href="https://youtu.be/sZBuARv5F2k"><font color="black"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/PMV8u4d87r0"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV12f4y1471N/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1791-1800/Maximum%20Score%20of%20a%20Good%20Subarray.cpp">LeetCode 1793. Maximum Score of a Good Subarray</font></td>
<td align="center"><a href="https://youtu.be/An3r5pFOKLc"><font color="black"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/Xiznf9co2sM"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV14V411Y7kr/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1791-1800/Count%20Pairs%20of%20Equal%20Substrings%20With%20Minimum%20Difference.cpp">LeetCode 1794. Count Pairs of Equal Substrings With Minimum Difference</font></td>
<td align="center"><a href="https://youtu.be/1fnPLW5Tbxc"><font color="black"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/oXm_wtSecxs"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV12B4y1A7e1/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1791-1800/Second%20Largest%20Digit%20in%20a%20String.cpp">LeetCode 1796. Second Largest Digit in a String</font></td>
<td align="center"><font color="black">English</font></td>
<td align="center"><font color="black">中文Youtube</font></td>
<td align="center"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1791-1800/Design%20Authentication%20Manager.cpp">LeetCode 1797. Design Authentication Manager</font></td>
<td align="center"><font color="black">English</font></td>
<td align="center"><font color="black">中文Youtube</font></td>
<td align="center"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1791-1800/Maximum%20Number%20of%20Consecutive%20Values%20You%20Can%20Make.cpp">LeetCode 1798. Maximum Number of Consecutive Values You Can Make</font></td>
<td align="center"><a href="https://youtu.be/nx2ewP-wF6M"><font color="black"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/ZOE8TPrRG3M"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1G5411P7sT/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1791-1800/Maximize%20Score%20After%20N%20Operations.cpp">LeetCode 1799. Maximize Score After N Operations</font></td>
<td align="center"><a href="https://youtu.be/iYUoydllPc4"><font color="black"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/94vDosERuiI"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1g64y1D7j6/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1791-1800/Maximum%20Ascending%20Subarray%20Sum.cpp">LeetCode 1800. Maximum Ascending Subarray Sum</font></td>
<td align="center"><font color="black">English</font></td>
<td align="center"><font color="black">中文Youtube</font></td>
<td align="center"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1801-1810/Number%20of%20Orders%20in%20the%20Backlog.cpp">LeetCode 1801. Number of Orders in the Backlog</font></td>
<td align="center"><font color="black">English</font></td>
<td align="center"><font color="black">中文Youtube</font></td>
<td align="center"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1801-1810/Maximum%20Value%20at%20a%20Given%20Index%20in%20a%20Bounded%20Array.cpp">LeetCode 1802. Maximum Value at a Given Index in a Bounded Array</font></td>
<td align="center"><a href="https://youtu.be/YaxcdotEiwY"><font color="black"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/zDcsb9GYsC8">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1oz4y117Yb/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1801-1810/Count%20Pairs%20With%20XOR%20in%20a%20Range.cpp">LeetCode 1803. Count Pairs With XOR in a Range</font></td>
<td align="center"><a href="https://youtu.be/liaiLNNgOmo"><font color="black"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/iS1_e8vsXz4">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV16Z4y1w7pB/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1801-1810/Implement%20Trie%20II%20(Prefix%20Tree).cpp">LeetCode 1804. Implement Trie II (Prefix Tree)</font></td>
<td align="center"><a href="https://youtu.be/_3ReIHJeTT4"><font color="black"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/PAvVIROaw-Q">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1jv41187qN/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1801-1810/Number%20of%20Different%20Integers%20in%20a%20String.cpp">LeetCode 1805. Number of Different Integers in a String</font></td>
<td align="center"><font color="black">English</font></td>
<td align="center"><font color="black">中文Youtube</font></td>
<td align="center"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1801-1810/Evaluate%20the%20Bracket%20Pairs%20of%20a%20String.cpp">LeetCode 1807. Evaluate the Bracket Pairs of a String</font></td>
<td align="center"><font color="black">English</font></td>
<td align="center"><font color="black">中文Youtube</font></td>
<td align="center"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1801-1810/Maximize%20Number%20of%20Nice%20Divisors.cpp">LeetCode 1808. Maximize Number of Nice Divisors</font></td>
<td align="center"><a href="https://youtu.be/kYm4bYrktkw"><font color="black"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/xkqcceTrGJw">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1Si4y1P7wF/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1801-1810/Minimum%20Path%20Cost%20in%20a%20Hidden%20Grid.cpp">LeetCode 1810. Minimum Path Cost in a Hidden Grid</font></td>
<td align="center"><a href="https://youtu.be/qtKlnHso4BU"><font color="black"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/6Id3jgq6FHg">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1Gp4y187nM/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1811-1820/Determine%20Color%20of%20a%20Chessboard%20Square.cpp">LeetCode 1812. Determine Color of a Chessboard Square</font></td>
<td align="center"><font color="black">English</font></td>
<td align="center"><font color="black">中文Youtube</font></td>
<td align="center"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1811-1820/Sentence%20Similarity%20III.cpp">LeetCode 1813. Sentence Similarity III</font></td>
<td align="center"><font color="black">English</font></td>
<td align="center"><font color="black">中文Youtube</font></td>
<td align="center"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1811-1820/Count%20Nice%20Pairs%20in%20an%20Array.cpp">LeetCode 1814. Count Nice Pairs in an Array</font></td>
<td align="center"><font color="black">English</font></td>
<td align="center"><font color="black">中文Youtube</font></td>
<td align="center"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1811-1820/Maximum%20Number%20of%20Groups%20Getting%20Fresh%20Donuts.cpp">LeetCode 1815. Maximum Number of Groups Getting Fresh Donuts</font></td>
<td align="center"><a href="https://youtu.be/h7U1S7Ut3ws"><font color="black"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/0FduysByEmE">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1Ly4y1b7bq/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1811-1820/Truncate%20Sentence.cpp">LeetCode 1816. Truncate Sentence</font></td>
<td align="center"><font color="black">English</font></td>
<td align="center"><font color="black">中文Youtube</font></td>
<td align="center"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1811-1820/Finding%20the%20Users%20Active%20Minutes.cpp">LeetCode 1817. Finding the Users Active Minutes</font></td>
<td align="center"><font color="black">English</font></td>
<td align="center"><font color="black">中文Youtube</font></td>
<td align="center"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1811-1820/Minimum%20Absolute%20Sum%20Difference.cpp">LeetCode 1818. Minimum Absolute Sum Difference</font></td>
<td align="center"><font color="black">English</font></td>
<td align="center"><font color="black">中文Youtube</font></td>
<td align="center"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1811-1820/Number%20of%20Different%20Subsequences%20GCDs.cpp">LeetCode 1819. Number of Different Subsequences GCDs</font></td>
<td align="center"><a href="https://youtu.be/Jbs6p2MLZjQ"><font color="black"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/ptaC4X0hC2Q">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1WX4y1g7sQ/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1811-1820/Maximum%20Number%20of%20Accepted%20Invitations.cpp">LeetCode 1820. Maximum Number of Accepted Invitations</font></td>
<td align="center"><a href="https://youtu.be/70cuAeXs6rk"><font color="black"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/beVpSBo7FZk"><font color="black"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1F5411A7dx/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1821-1830/Sign%20of%20the%20Product%20of%20an%20Array.cpp">LeetCode 1822. Sign of the Product of an Array</font></td>
<td align="center"><font color="black">English</font></td>
<td align="center"><font color="black">中文Youtube</font></td>
<td align="center"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1821-1830/Minimum%20Sideway%20Jumps.cpp">LeetCode 1824. Minimum Sideway Jumps</font></td>
<td align="center"><a href="https://youtu.be/6-49f0eystc"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/PtYI0c8x8lY"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1HK4y1K7nk/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1821-1830/Finding%20MK%20Average.cpp">LeetCode 1825. Finding MK Average</font></td>
<td align="center"><a href="https://youtu.be/tHMWcAikcnY"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/Nr_XX-joVm4"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1uy4y147Pi/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1821-1830/Faulty%20Sensor.cpp">LeetCode 1826. Faulty Sensor</font></td>
<td align="center"><font color="black">English</font></td>
<td align="center"><font color="black">中文Youtube</font></td>
<td align="center"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1821-1830/Minimum%20Operations%20to%20Make%20the%20Array%20Increasing.cpp">LeetCode 1827. Minimum Operations to Make the Array Increasing</font></td>
<td align="center"><font color="black">English</font></td>
<td align="center"><font color="black">中文Youtube</font></td>
<td align="center"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1821-1830/Queries%20on%20Number%20of%20Points%20Inside%20a%20Circle.cpp">LeetCode 1828. Queries on Number of Points Inside a Circle</font></td>
<td align="center"><font color="black">English</font></td>
<td align="center"><font color="black">中文Youtube</font></td>
<td align="center"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1821-1830/Maximum%20XOR%20for%20Each%20Query.cpp">LeetCode 1829. Maximum XOR for Each Query</font></td>
<td align="center"><font color="black">English</font></td>
<td align="center"><font color="black">中文Youtube</font></td>
<td align="center"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1821-1830/Minimum%20Number%20of%20Operations%20to%20Make%20String%20Sorted.cpp">LeetCode 1830. Minimum Number of Operations to Make String Sorted</font></td>
<td align="center"><a href="https://youtu.be/6u6l5Jd-HQc"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/0yxk667NXgw"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1uA411V7Tr/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1831-1840/Check%20if%20the%20Sentence%20Is%20Pangram.cpp">LeetCode 1832. Check if the Sentence Is Pangram</font></td>
<td align="center"><font color="black">English</font></td>
<td align="center"><font color="black">中文Youtube</font></td>
<td align="center"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1831-1840/Maximum%20Ice%20Cream%20Bars.cpp">LeetCode 1833. Maximum Ice Cream Bars</font></td>
<td align="center"><font color="black">English</font></td>
<td align="center"><font color="black">中文Youtube</font></td>
<td align="center"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1831-1840/Single-Threaded%20CPU.cpp">LeetCode 1834. Single-Threaded CPU</font></td>
<td align="center"><font color="black">English</font></td>
<td align="center"><font color="black">中文Youtube</font></td>
<td align="center"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1831-1840/Find%20XOR%20Sum%20of%20All%20Pairs%20Bitwise%20AND.cpp">LeetCode 1835. Find XOR Sum of All Pairs Bitwise AND</font></td>
<td align="center"><a href="https://youtu.be/H09_S0dbphs"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/d0cbmU9v-Pc"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1B64y1y7TY/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1831-1840/Remove%20Duplicates%20From%20an%20Unsorted%20Linked%20List.cpp">LeetCode 1836. Remove Duplicates From an Unsorted Linked List</font></td>
<td align="center"><font color="black">English</font></td>
<td align="center"><font color="black">中文Youtube</font></td>
<td align="center"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1831-1840/Sum%20of%20Digits%20in%20Base%20K.cpp">LeetCode 1837. Sum of Digits in Base K</font></td>
<td align="center"><font color="black">English</font></td>
<td align="center"><font color="black">中文Youtube</font></td>
<td align="center"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1831-1840/Longest%20Substring%20Of%20All%20Vowels%20in%20Order.cpp">LeetCode 1839. Longest Substring Of All Vowels in Order</font></td>
<td align="center"><font color="black">English</font></td>
<td align="center"><font color="black">中文Youtube</font></td>
<td align="center"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1831-1840/Maximum%20Building%20Height.cpp">LeetCode 1840. Maximum Building Height</font></td>
<td align="center"><a href="https://youtu.be/gQSwu5TVD8A"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/Gfv8tNiizCw"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1uQ4y1f7QH/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1841-1850/Closest%20Room.cpp">LeetCode 1847. Closest Room</font></td>
<td align="center"><a href="https://youtu.be/Q1WGr7fxA6g"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/6QW31b5CeoQ"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV13B4y1w7wS/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1841-1850/Minimum%20Adjacent%20Swaps%20to%20Reach%20the%20Kth%20Smallest%20Number.cpp">LeetCode 1850. Minimum Adjacent Swaps to Reach the Kth Smallest Number</font></td>
<td align="center"><a href="https://youtu.be/5-GdjgRc4P0"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/LMmWq6j73vU"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV1j64y127Cx/"><font color="black">中文b站</font></td>
</tr>
<tr>
<td colspan='40'><font size="4px" color="#0x888888"><a href="https://github.com/gzc/leetcode/blob/master/cpp/1001-10000/1851-1860/Minimum%20Interval%20to%20Include%20Each%20Query.cpp">LeetCode 1851. Minimum Interval to Include Each Query</font></td>
<td align="center"><a href="https://youtu.be/Z7qiynScOPA"><font color="black">English</font></td>
<td align="center"><a href="https://youtu.be/q5jHwTw139s"><font color="black">中文Youtube</font></td>
<td align="center"><a href="https://www.bilibili.com/video/BV14h411m7GA/"><font color="black">中文b站</font></td>
</tr>
</table>
================================================
FILE: Solve the Equation.cpp
================================================
// https://discuss.leetcode.com/topic/95378/concise-c-solution-with-regular-expression-12-lines
class Solution {
public:
string solveEquation(string equation) {
// normalize the equation, add 1 for x's which have no coefficient: x => 1x
equation = regex_replace(equation, regex("(^|[+=-])x"), "$011x");
// calculate coefficients for both sides
auto pos = equation.find('=');
auto l = coef(equation.substr(0, pos));
auto r = coef(equation.substr(pos + 1));
// l.first x + l.second = r.first x + r.second => ax = b
int a = l.first - r.first;
int b = r.second - l.second;
return a != 0 ? "x=" + to_string(b/a) : b != 0 ? "No solution" : "Infinite solutions";
}
pair<int, int> coef(string s) {
// split the side into form of (+/-)123x
auto e = regex("(^|[+-])\\d+x?");
regex_token_iterator<string::iterator> it(s.begin(), s.end(), e), end;
int a = 0, b = 0;
for (; it != end; it++)
(it->str().back() == 'x' ? a : b) += stoi(*it);
return {a, b};
}
};
================================================
FILE: TODO
================================================
4 Median of Two Sorted Arrays
5 Longest Palindromic Substring
9 Palindrome Number
10 Regular Expression Matching(花了挺多时间,30分钟)
12 Integer to Roman 醉了啊
42 review later
43 need more practice
44 tricky
================================================
FILE: cpp/001-010/Add Two Numbers.cpp
================================================
class Solution {
public:
ListNode *addTwoNumbers(ListNode *l1, ListNode *l2) {
ListNode *head = new ListNode(0);
ListNode *pre = head;
int carry = 0;
while(l1 || l2 || carry) {
int a = (l1 == NULL? 0 : l1->val);
int b = (l2 == NULL? 0 : l2->val);
int c = a + b + carry;
carry = c > 9? 1 : 0;
int v = c%10;
ListNode *cur = new ListNode(v);
pre->next = cur;
pre = pre->next;
if(l1) l1 = l1->next;
if(l2) l2 = l2->next;
}
return head->next;
}
};
================================================
FILE: cpp/001-010/Longest Palindromic Substring.cpp
================================================
class Solution {
public:
string longestPalindrome(string s) {
int n = s.length();
int longestBegin = 0;
int maxLen = 1;
bool table[1000][1000] = {false};
for (int i = 0; i < n; i++)
table[i][i] = true;
for (int len = 2; len <= n; len++) {
for (int i = 0; i < n-len+1; i++) {
int j = i+len-1;
if (s[i] == s[j] && (j-i == 1 || table[i+1][j-1])) {
table[i][j] = true;
longestBegin = i;
maxLen = len;
}
}
}
return s.substr(longestBegin, maxLen);
}
};
================================================
FILE: cpp/001-010/Longest Substring Without Repeating Characters.cpp
================================================
class Solution {
public:
int lengthOfLongestSubstring(string s) {
unordered_map<char, int> mymap;
int start = 0;
int ans = 0;
for (int i = 0; i < s.length(); i++) {
char ch = s[i];
auto it = mymap.find(ch);
if (it != mymap.end()) {
start = max(start, it->second + 1);
}
mymap[ch] = i;
ans = max(ans, i - start + 1);
}
return ans;
}
};
================================================
FILE: cpp/001-010/Median of Two Sorted Arrays.cpp
================================================
class Solution {
public:
double findMedianSortedArrays(vector<int>& nums1, vector<int>& nums2) {
int m = nums1.size(), n = nums2.size();
if ((m + n) % 2 == 1) {
return findKthElement((m + n) / 2 + 1, nums1, 0, nums2, 0);
} else {
return (findKthElement((m + n) / 2, nums1, 0 ,nums2, 0) + findKthElement((m + n) / 2 + 1, nums1, 0 ,nums2, 0)) / 2;
}
}
double findKthElement(int k, const vector<int>& nums1, int idx1, const vector<int>& nums2, int idx2) {
int l1 = nums1.size() - idx1;
int l2 = nums2.size() - idx2;
if (l1 > l2) {
return findKthElement(k, nums2, idx2, nums1, idx1);
}
if (l1 == 0) {
return nums2[idx2 + k - 1];
}
if (k == 1) {
return min(nums1[idx1], nums2[idx2]);
}
int cut1 = min(k/2, l1);
int cut2 = k - cut1;
if (nums1[idx1 + cut1 - 1] > nums2[idx2 + cut2 - 1]) {
return findKthElement(k - cut2, nums1, idx1, nums2, idx2 + cut2);
} else {
return findKthElement(k - cut1, nums1, idx1 + cut1, nums2, idx2);
}
}
};
================================================
FILE: cpp/001-010/Palindrome Number.cpp
================================================
class Solution {
public:
bool isPalindrome(int x) {
if (x == 0) return true;
if (x < 0) return false;
if (x % 10 == 0) return false;
int sum = 0;
while (x > sum) {
sum = sum * 10 + x % 10;
x /= 10;
}
return (x == sum) || (x == sum / 10);
}
};
================================================
FILE: cpp/001-010/Regular Expression Matching.cpp
================================================
class Solution {
bool isMatch(const string& s, int sidx, const string& p, int pidx) {
if (pidx >= p.length()) {
return sidx == s.length();
}
if ((pidx + 1) < p.length() && p[pidx + 1] == '*') {
if (isMatch(s, sidx, p, pidx + 2)) {
return true;
}
if (sidx < s.length() && (p[pidx] == '.' || s[sidx] == p[pidx])) {
return isMatch(s, sidx + 1, p, pidx);
}
} else if (sidx < s.length() && (p[pidx] == '.' || s[sidx] == p[pidx])) {
return isMatch(s, sidx + 1, p, pidx + 1);
}
return false;
}
public:
bool isMatch(string s, string p) {
return isMatch(s, 0, p, 0);
}
};
================================================
FILE: cpp/001-010/Reverse Integer.cpp
================================================
class Solution {
public:
int reverse(int x) {
// INT_MAX: 2147483647
// INT_MIN: -2147483648
int result = 0;
while (x != 0) {
int mod = x % 10;
if (result > 214748364 || (result == 214748364 && mod > 7)) {
return 0;
}
if (result < -214748364 || (result == -214748364 && mod == -9)) {
return 0;
}
result = 10 * result + mod;
x /= 10;
}
return result;
}
};
================================================
FILE: cpp/001-010/String to Integer (atoi).cpp
================================================
class Solution {
public:
int myAtoi(string str) {
while (str[0] == ' ') {
str.erase(0, 1);
}
int sign = 1;
if (str[0] == '+' || str[0] == '-') {
if (str[0] == '-') sign = -1;
str.erase(0, 1);
}
int result = 0;
for (int i = 0; i < str.length(); i++) {
if (!isdigit(str[i])) {
break;
}
int v = str[i] - '0';
if (result > INT_MAX/10) {
if (sign == 1) return INT_MAX;
if (sign == -1) return INT_MIN;
} else if (result == INT_MAX/10) {
if (sign == 1 && v >= 7) return INT_MAX;
if (sign == -1 && v >= 8) return INT_MIN;
}
result = 10 * result + v;
}
return result * sign;
}
};
================================================
FILE: cpp/001-010/Two Sum.cpp
================================================
class Solution {
public:
vector<int> twoSum(vector<int> &numbers, int target) {
unordered_map<int, int> m;
vector<int> result;
for (int i = 0;i < numbers.size();i++) {
int remain = target - numbers[i];
if (m.count(remain) > 0) {
result.push_back(m[remain]);
result.push_back(i);
return result;
}
m[numbers[i]] = i;
}
return result;
}
};
================================================
FILE: cpp/001-010/ZigZag Conversion.cpp
================================================
class Solution {
public:
string convert(string s, int numRows) {
if (numRows == 1) {
return s;
}
vector<string> rows(numRows);
int row = 0;
int step = 1;
for (char ch : s) {
rows[row].push_back(ch);
if (row == (numRows - 1)) {
step = -1;
} else if (row == 0) {
step = 1;
}
row += step;
}
stringstream ss;
for (const string& row : rows) {
ss << row;
}
return ss.str();
}
};
================================================
FILE: cpp/011-020/3Sum Closest.cpp
================================================
class Solution {
public:
int threeSumClosest(vector<int>& nums, int target) {
int ans = 0;
int diff = INT_MAX;
sort(nums.begin(), nums.end());
for (int i = 0; i < nums.size(); i++) {
if (i > 0 && nums[i - 1] == nums[i]) {
continue;
}
int j = i + 1;
int k = nums.size() - 1;
while (j < k) {
int sum = nums[i] + nums[j] + nums[k];
if (abs(sum - target) < diff) {
ans = sum;
diff = abs(sum - target);
}
if (sum < target) {
j++;
} else if (sum > target) {
k--;
} else {
return target;
}
}
}
return ans;
}
};
================================================
FILE: cpp/011-020/3Sum.cpp
================================================
class Solution {
public:
vector<vector<int>> threeSum(vector<int>& nums) {
vector<vector<int>> result;
sort(nums.begin(), nums.end());
for (int i = 0; i < nums.size(); i++) {
if (i > 0 && nums[i - 1] == nums[i]) {
continue;
}
int j = i + 1;
int k = nums.size() - 1;
while (j < k) {
int sum = nums[i] + nums[j] + nums[k];
if (sum < 0) {
j++;
} else if (sum > 0) {
k--;
} else {
result.push_back({nums[i], nums[j], nums[k]});
while ((j + 1) < nums.size() && nums[j] == nums[j+1]) j++;
j++;
while ((k - 1) >= 0 && nums[k] == nums[k - 1]) k--;
k--;
}
}
}
return result;
}
};
================================================
FILE: cpp/011-020/4Sum.cpp
================================================
class Solution {
public:
vector<vector<int> > fourSum(vector<int> &num, int target) {
vector<vector<int>>result;
int n = num.size();
sort(num.begin(), num.end());
for (int i = 0; i < n; i++) {
if (i > 0 && num[i-1] == num[i]) {
continue;
}
for (int j = i + 1; j < n; j++) {
if (j > (i + 1) && num[j-1] == num[j]) {
continue;
}
int l = j + 1, r = n - 1;
int partial_sum = num[i] + num[j];
while (l < r) {
int sum = partial_sum + num[l] + num[r];
if (sum < target) {
l++;
} else if (sum > target) {
r--;
} else {
result.push_back({num[i], num[j], num[l], num[r]});
while ((l + 1) < num.size() && num[l] == num[l+1]) l++;
l++;
while ((r - 1) >= 0 && num[r] == num[r - 1]) r--;
r--;
}
}
}
}
return result;
}
};
================================================
FILE: cpp/011-020/Container With Most Water.cpp
================================================
class Solution {
public:
int maxArea(vector<int>& height) {
int i(0), j(height.size()-1);
int area(0);
while (i < j) {
area = max(area, (j-i)*min(height[i], height[j]));
height[i] > height[j] ? j-- : i++;
}
return area;
}
};
================================================
FILE: cpp/011-020/Integer to Roman.cpp
================================================
class Solution {
public:
string intToRoman(int num) {
map<int, string> mymap{
{1, "I"}, {5, "V"}, {10, "X"}, {50, "L"},
{100, "C"}, {500, "D"}, {1000, "M"},
{4, "IV"}, {9, "IX"},
{40, "XL"}, {90, "XC"},
{400, "CD"}, {900, "CM"}
};
stringstream ss;
for (auto it = mymap.rbegin(); it != mymap.rend(); it++) {
int key = it->first;
const string& code = it->second;
while (num >= key) {
num -= key;
ss << code;
}
}
return ss.str();
}
};
================================================
FILE: cpp/011-020/Letter Combinations of a Phone Number.cpp
================================================
class Solution {
public:
vector<string> letterCombinations(string digits) {
string symbols[10] = {"", "", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"};
vector<string> result;
if (digits.empty()) {
return result;
}
result.push_back("");
for (char ch : digits) {
int num = ch - '0';
vector<string> new_result;
for (const string& s : result) {
for (char symbol : symbols[num]) {
string tmp = s + symbol;
new_result.push_back(tmp);
}
}
result.swap(new_result);
}
return result;
}
};
================================================
FILE: cpp/011-020/Longest Common Prefix.cpp
================================================
class Solution {
public:
string longestCommonPrefix(vector<string>& strs) {
if (strs.empty()) {
return "";
}
string prefix = strs[0];
for (int i = 1; i < strs.size(); i++) {
const string& str = strs[i];
int k = 0;
while (k < min(prefix.length(), str.length())) {
if (prefix[k] != str[k]) {
break;
}
k++;
}
prefix = prefix.substr(0, k);
}
return prefix;
}
};
================================================
FILE: cpp/011-020/Remove Nth Node From End of List.cpp
================================================
class Solution {
public:
ListNode* removeNthFromEnd(ListNode* head, int n) {
int len = 0;
ListNode* head_copy = head;
while (head_copy != nullptr) {
head_copy = head_copy->next;
len++;
}
if (n == len) {
ListNode* new_head = head->next;
delete head;
return new_head;
}
head_copy = head;
for (int i = 1; i < (len - n); i++) {
head_copy = head_copy->next;
}
ListNode* to_delete = head_copy->next;
head_copy->next = head_copy->next->next;
delete to_delete;
return head;
}
};
================================================
FILE: cpp/011-020/Roman to Integer.cpp
================================================
class Solution {
public:
int romanToInt(string s) {
map<char, int> table {
{'I', 1}, {'V', 5}, {'X', 10}, {'L', 50},
{'C', 100}, {'D', 500}, {'M', 1000}
};
int result = 0;
for (int i = 0;i < s.length();i++) {
if (i < s.length()-1 && table[s[i]] < table[s[i+1]] ) {
result -= table[s[i]];
} else {
result += table[s[i]];
}
}
return result;
}
};
================================================
FILE: cpp/011-020/Valid Parentheses.cpp
================================================
class Solution {
public:
bool isValid(string s) {
stack<char> container;
for (int i = 0;i < s.length();i++)
{
if (container.empty())
container.push(s[i]);
else
{
char c = s[i];
char v = container.top();
if (c == '(' || c == '{' || c == '[')
container.push(c);
else
{
if ( (c == ')' && v == '(') || (c == '}' && v == '{') || (c == ']' && v == '['))
container.pop();
else
return false;
}
}
}
return container.empty();
}
};
================================================
FILE: cpp/021-030/Divide Two Integers.cpp
================================================
/*
* Solution 1:
* Use long type
*/
class Solution {
public:
int divide(int dividend, int divisor) {
if (dividend == INT_MIN && divisor == -1) {
return INT_MAX;
}
bool positive = true;
if ((dividend > 0 && divisor < 0) || (dividend < 0 && divisor > 0)) {
positive = false;
}
long new_dividend = abs((long)dividend);
long new_divisor = abs((long)divisor);
long result = 0;
int power = 0;
while (new_divisor <= (new_dividend >> 1)) {
new_divisor = new_divisor << 1;
power++;
}
while (power >= 0) {
if (new_dividend >= new_divisor) {
result += (1 << power);
new_dividend -= new_divisor;
}
power--;
new_divisor = new_divisor >> 1;
}
return positive ? result : -result;
}
};
/*
* Solution 2:
* Don't use long type
*/
class Solution {
public:
int divide(int dividend, int divisor) {
if (dividend == INT_MIN) {
if (divisor == -1) {
return INT_MAX;
}
if (divisor > 0) {
return -1 + divide(dividend + divisor, divisor);
} else {
return 1 + divide(dividend - divisor, divisor);
}
}
if (divisor == INT_MIN) {
return dividend == INT_MIN ? 1 : 0;
}
bool positive = true;
if ((dividend > 0 && divisor < 0) || (dividend < 0 && divisor > 0)) {
positive = false;
}
int new_dividend = abs(dividend);
int new_divisor = abs(divisor);
int result = 0;
int power = 0;
while (new_divisor <= (new_dividend >> 1)) {
new_divisor = new_divisor << 1;
power++;
}
while (power >= 0) {
if (new_dividend >= new_divisor) {
result += (1 << power);
new_dividend -= new_divisor;
}
power--;
new_divisor = new_divisor >> 1;
}
return positive ? result : -result;
}
};
================================================
FILE: cpp/021-030/Generate Parentheses.cpp
================================================
class Solution {
void dfs(string s, int open, int close, vector<string>& parentheses) {
if (close < open) {
return;
}
if (open == 0) {
string temp(close, ')');
s += temp;
parentheses.push_back(s);
} else {
dfs(s + "(", open - 1, close, parentheses);
dfs(s + ")", open, close - 1, parentheses);
}
}
public:
vector<string> generateParenthesis(int n) {
vector<string> parentheses;
dfs("", n, n, parentheses);
return parentheses;
}
};
================================================
FILE: cpp/021-030/Implement strStr().cpp
================================================
class Solution {
public:
int strStr(string haystack, string needle) {
int m = haystack.length(), n = needle.length();
for (int i = 0; i < m - n + 1; i++) {
int j = 0;
for (; j < n; j++) {
if (haystack[i + j] != needle[j]) {
break;
}
}
if (j == n) {
return i;
}
}
return -1;
}
};
================================================
FILE: cpp/021-030/Merge Two Sorted Lists.cpp
================================================
class Solution {
public:
ListNode *mergeTwoLists(ListNode *l1, ListNode *l2) {
ListNode *head = new ListNode(-1);
ListNode *fake_head = head;
while (l1 != nullptr || l2 != nullptr) {
if (l1 == nullptr) {
head->next = l2;
break;
} else if(l2 == nullptr) {
head->next = l1;
break;
}
if (l1->val <= l2->val) {
head->next = l1;
head = l1;
l1 = l1->next;
} else {
head->next = l2;
head = l2;
l2 = l2->next;
}
}
return fake_head->next;
}
};
================================================
FILE: cpp/021-030/Merge k Sorted Lists.cpp
================================================
class Solution {
public:
ListNode *mergeKLists(vector<ListNode *> &lists) {
auto cmp = [] (ListNode *n1, ListNode *n2) {
return n1->val > n2->val;
};
priority_queue<ListNode*, vector<ListNode*>, decltype(cmp)> nodes(cmp);
for (ListNode *list : lists) {
if (list != nullptr) {
nodes.push(list);
}
}
if (nodes.empty()) {
return nullptr;
}
ListNode fake_head(0);
ListNode* current = &fake_head;
while (!nodes.empty()) {
current->next = nodes.top();
current = current->next;
nodes.pop();
if (current->next != nullptr) {
nodes.push(current->next);
}
}
return fake_head.next;
}
};
================================================
FILE: cpp/021-030/Remove Duplicates from Sorted Array.cpp
================================================
class Solution {
public:
int removeDuplicates(vector<int>& nums) {
int pos = 0;
for (int n : nums) {
if (pos == 0 || n > nums[pos-1]) {
nums[pos] = n;
pos++;
}
}
return pos;
}
};
================================================
FILE: cpp/021-030/Remove Element.cpp
================================================
class Solution {
public:
int removeElement(vector<int>& nums, int val) {
int pos = 0;
for (int n : nums) {
if (n != val) {
nums[pos] = n;
pos++;
}
}
return pos;
}
};
================================================
FILE: cpp/021-030/Reverse Nodes in k-Group.cpp
================================================
class Solution {
int length(ListNode* head) {
int len = 0;
while (head != nullptr) {
head = head->next;
len++;
}
return len;
}
ListNode* dfs(ListNode* head, int len, int k) {
if (len < k) {
return head;
}
ListNode* tail = head;
ListNode* prev = nullptr, *tmp = nullptr;
for (int i = 0; i < k; i++) {
tmp = head->next;
head -> next = prev;
prev = head;
head = tmp;
}
tail->next = dfs(head, len - k, k);
return prev;
}
public:
ListNode* reverseKGroup(ListNode* head, int k) {
return dfs(head, length(head), k);
}
};
================================================
FILE: cpp/021-030/Substring with Concatenation of All Words.cpp
================================================
class Solution {
public:
vector<int> findSubstring(string s, vector<string>& words) {
vector<int> res;
unordered_map<string, int> dict;
int len = words[0].size();
int n = s.length(), m = words.size();
for (const string& word : words) {
dict[word]++;
}
for (int i = 0; i < len; i++) {
int cnt = 0;
unordered_map<string, int> copy = dict;
for (int j = i; j <= n - len; j += len) {
string cur = s.substr(j, len);
copy[cur]--;
if (copy[cur] >= 0) {
cnt++;
}
int pop_start = j - m * len;
if (pop_start >= 0) {
string pop_word = s.substr(pop_start, len);
copy[pop_word]++;
if (copy[pop_word] > 0) {
cnt--;
}
}
if (cnt == m) {
res.push_back(pop_start + len);
}
}
}
return res;
}
};
================================================
FILE: cpp/021-030/Swap Nodes in Pairs.cpp
================================================
class Solution {
public:
ListNode* swapPairs(ListNode* head) {
if (head == nullptr || head->next == nullptr) {
return head;
}
ListNode* new_head = head->next;
head->next = swapPairs(new_head->next);
new_head->next = head;
return new_head;
}
};
================================================
FILE: cpp/031-040/Combination Sum II.cpp
================================================
#include <iostream>
#include <unordered_map>
#include <vector>
#include <stack>
#include <queue>
using namespace std;
class Solution {
void help(vector<int>& now, vector<int>&candidates, int index, int target, vector<vector<int>>& results)
{
for(int i = index;i < candidates.size();i++)
{
if(candidates[i] < target)
{
now.push_back(candidates[i]);
help(now, candidates, i+1, target-candidates[i], results);
now.pop_back();
while(i < candidates.size()-1 && candidates[i] == candidates[i+1]) i++;
} else if(candidates[i] == target) {
now.push_back(candidates[i]);
results.push_back(now);
now.pop_back();
return;
}
}
}
public:
vector<vector<int> > combinationSum2(vector<int> &candidates, int target) {
vector<vector<int>> results;
vector<int> tmp;
sort(candidates.begin(), candidates.end());
help(tmp, candidates, 0, target, results);
return results;
}
};
int main()
{
Solution s;
return 0;
}
================================================
FILE: cpp/031-040/Combination Sum.cpp
================================================
class Solution {
void help(vector<int>& now, vector<int>&candidates, int index, int target, vector<vector<int>>& results)
{
for (int i = index;i < candidates.size();i++)
{
if (candidates[i] < target)
{
now.push_back(candidates[i]);
help(now, candidates, i, target-candidates[i], results);
now.pop_back();
} else if (candidates[i] == target) {
now.push_back(candidates[i]);
results.push_back(now);
now.pop_back();
}
}
}
public:
vector<vector<int> > combinationSum(vector<int> &candidates, int target) {
vector<vector<int>> results;
vector<int>tmp;
help(tmp, candidates, 0, target, results);
return results;
}
};
================================================
FILE: cpp/031-040/Count and Say.cpp
================================================
#include <iostream>
#include <unordered_map>
#include <vector>
#include <stack>
#include <queue>
using namespace std;
class Solution {
string process(string &s)
{
int i = 0;
string r;
while(i < s.length())
{
int l = 1;
while(i < s.length()-1 && s[i] == s[i+1])
{
l++;
i++;
}
r = r + to_string(l) + s[i];
i++;
}
return r;
}
public:
string countAndSay(int n) {
string r = "1";
if(n == 1) return r;
for(int i = 2;i <= n;i++)
r = process(r);
return r;
}
};
int main()
{
Solution s;
cout << s.countAndSay(1);
return 0;
}
================================================
FILE: cpp/031-040/Longest Valid Parentheses.cpp
================================================
// Solution 1: DP
class Solution {
public:
int longestValidParentheses(string s) {
int n = s.size();
int res = 0;
vector<int> dp(n, 0);
for (int i = 0; i < n; i++) {
if (i > 0 && s[i] == ')') {
if (s[i-1] == '(') {
int val = i - 2 >= 0 ? dp[i-2] : 0;
dp[i] = 2 + val;
} else {
int ind = i - dp[i-1] - 1;
if (ind >= 0 && s[ind] == '(') {
int val = ind > 0 ? dp[ind - 1] : 0;
dp[i] = 2 + dp[i-1] + val;
}
}
res = max(res, dp[i]);
}
}
return res;
}
};
// Solution 2: stack
class Solution {
public:
int longestValidParentheses(string s) {
stack<int> mystack;
mystack.push(-1);
int res = 0;
for (int i = 0; i < s.size(); i++) {
int t = mystack.top();
if (t != -1 && s[i] == ')' && s[t]=='(') {
mystack.pop();
res = max(res, i - mystack.top());
} else {
mystack.push(i);
}
}
return res;
}
};
================================================
FILE: cpp/031-040/Next Permutation.cpp
================================================
class Solution {
public:
void nextPermutation(vector<int> &num) {
if (num.empty()) {
return;
}
int violation_index = num.size() - 2;
for (; violation_index >= 0; violation_index--) {
if (num[violation_index] < num[violation_index+1]) {
break;
}
}
reverse(begin(num) + violation_index + 1, end(num));
if (violation_index == -1) {
return;
}
auto it = upper_bound(begin(num) + violation_index + 1, num.end(), num[violation_index]);
swap(num[violation_index], *it);
}
};
================================================
FILE: cpp/031-040/Search Insert Position.cpp
================================================
class Solution {
public:
int searchInsert(vector<int>& nums, int target) {
int lo = 0;
int hi = nums.size() - 1;
while (lo <= hi) {
int mid = lo + (hi - lo) / 2;
if (target < nums[mid]) hi = mid - 1;
else if (target > nums[mid]) lo = mid + 1;
else return mid;
}
return lo;
}
};
================================================
FILE: cpp/031-040/Search for a Range.cpp
================================================
class Solution {
public:
vector<int> searchRange(vector<int>& nums, int target) {
std::vector<int>::iterator low,up;
low =std::lower_bound (nums.begin(), nums.end(), target);
up = std::upper_bound (nums.begin(), nums.end(), target);
vector<int> result;
if (low == up) {
result.push_back(-1);
result.push_back(-1);
} else {
result.push_back(low - nums.begin());
result.push_back(up - nums.begin() - 1);
}
return result;
}
};
class Solution {
int FindFirst(const vector<int>& nums, int target) {
int i = 0;
int j = nums.size() - 1;
int pos = -1;
while (i <= j) {
int mid = (i + j) / 2;
if (nums[mid] == target) {
pos = mid;
j = mid - 1;
} else if (nums[mid] > target) {
j = mid - 1;
} else {
i = mid + 1;
}
}
return pos;
}
int FindLast(const vector<int>& nums, int target) {
int i = 0;
int j = nums.size() - 1;
int pos = -1;
while (i <= j) {
int mid = (i + j) / 2;
if (nums[mid] == target) {
pos = mid;
i = mid + 1;
} else if (nums[mid] > target) {
j = mid - 1;
} else {
i = mid + 1;
}
}
return pos;
}
public:
vector<int> searchRange(vector<int>& nums, int target) {
vector<int> ans{FindFirst(nums, target), FindLast(nums, target)};
return ans;
}
};
================================================
FILE: cpp/031-040/Search in Rotated Sorted Array.cpp
================================================
class Solution {
public:
int search(vector<int>& nums, int target) {
int i = 0;
int j = nums.size() - 1;
while (i <= j) {
int mid = (i + j) / 2;
if (nums[mid] == target) return mid;
if (nums[mid] < nums[i]) {
if (nums[mid] < target && nums[j] >= target) i = mid+1;
else j = mid-1;
} else {
if (nums[mid] > target && nums[i] <= target) j = mid-1;
else i = mid+1;
}
}
return -1;
}
};
================================================
FILE: cpp/031-040/Sudoku Solver.cpp
================================================
class Solution {
bool rows[9][9];
bool cols[9][9];
bool rec[3][3][9];
bool help(vector<vector<char> > &board, int i, int j) {
if(i == 9) return true;
int nexti(i), nextj(0);
if (j != 8) {
nextj = j+1;
} else {
nexti = i+1;
}
if(board[i][j] != '.') {
return help(board, nexti, nextj);
} else {
for(int k = 0;k < 9;k++) {
if(rows[i][k] == false && cols[k][j] == false && rec[i/3][j/3][k] == false) {
rows[i][k] = true;
cols[k][j] = true;
rec[i/3][j/3][k] = true;
board[i][j] = (k+'1');
bool t = help(board, nexti, nextj);
if(t) return true;
rows[i][k] = false;
cols[k][j] = false;
rec[i/3][j/3][k] = false;
board[i][j] = '.';
}
}
}
return false;
}
public:
void solveSudoku(vector<vector<char> > &board) {
memset(rows, false, sizeof(rows));
memset(cols, false, sizeof(cols));
memset(rec, false, sizeof(rec));
for (int i = 0;i < 9;i++) {
for(int j = 0;j < 9;j++) {
if(board[i][j] != '.') {
int d = board[i][j] - '1';
rows[i][d] = true;
cols[d][j] = true;
rec[i/3][j/3][d] = true;
}
}
}
help(board, 0, 0);
}
};
================================================
FILE: cpp/031-040/Valid Sudoku.cpp
================================================
class Solution {
public:
bool isValidSudoku(vector<vector<char> > &board) {
bool r[9][9], c[9][9], s[3][3][9];
memset(r, false, 9*9);
memset(c, false, 9*9);
memset(s, false, 3*3*9);
for(int i = 0;i < 9;i++) {
for(int j = 0;j < 9;j++) {
char ch = board[i][j];
if (!isdigit(ch)) continue;
int num = ch - '1';
if (r[i][num] == true) return false;
r[i][num] = true;
if (c[j][num] == true) return false;
c[j][num] = true;
int ii = i/3;
int jj = j/3;
if (s[ii][jj][num]) return false;
s[ii][jj][num] = true;
}
}
return true;
}
};
================================================
FILE: cpp/041-050/First Missing Positive.cpp
================================================
class Solution {
public:
int firstMissingPositive(vector<int>& nums) {
if (nums.empty()) return 1;
int i(0);
while (i < nums.size()) {
if (nums[i] != i+1 && nums[i] > 0 && nums[i] < nums.size() && nums[i] != nums[nums[i]-1]) {
swap(nums[i], nums[nums[i]-1]);
continue;
}
i++;
}
for (int i = 0;i < nums.size();i++)
if(nums[i] != i+1)
return i+1;
return nums.back()+1;
}
};
================================================
FILE: cpp/041-050/Group Anagrams.cpp
================================================
class Solution {
public:
vector<vector<string>> groupAnagrams(vector<string>& strs) {
map<string, vector<string>> mymap;
for (const string& str : strs) {
string key(str);
sort(key.begin(), key.end());
mymap[key].emplace_back(str);
}
vector<vector<string>> result;
for (const auto& it : mymap) result.emplace_back(it.second);
return result;
}
};
================================================
FILE: cpp/041-050/Jump Game II.cpp
================================================
class Solution {
public:
int jump(vector<int>& nums) {
if (nums.size() < 2) return 0;
int count(0);
int step(0);
int nextstep(0);
for (int i = 0; i < nums.size(); i++) {
if (i + nums[i] > nextstep) nextstep = i + nums[i];
if (i == step && i != nums.size()-1) {
step = nextstep;
count++;
}
}
return count;
}
};
================================================
FILE: cpp/041-050/Multiply Strings.cpp
================================================
class Solution {
public:
string multiply(string num1, string num2) {
string result(num1.length()+num2.length(), '0');
reverse(num1.begin(), num1.end());
reverse(num2.begin(), num2.end());
for (int i = 0;i < num1.length();i++) {
int carry = 0;
int j = 0;
while (j < num2.size() || carry > 0) {
int digit = result[i+j] - '0';
int v = j < num2.size() ? num2[j] : '0';
int num = (num1[i] - '0') * (v - '0');
int res = digit + num + carry;
result[i+j] = (res % 10) + '0';
carry = res / 10;
j++;
}
}
reverse(result.begin(), result.end());
while(result[0] == '0' && result.length() > 1)
result = result.substr(1);
return result;
}
};
================================================
FILE: cpp/041-050/Permutations II.cpp
================================================
class Solution {
void help(vector<vector<int>>& result, int begin, vector<int> num) {
if (begin == num.size()) {
result.emplace_back(num);
return;
}
for (int i = begin; i < num.size();i++) {
if (i != begin && num[i] == num[begin]) continue;
swap(num[begin], num[i]);
help(result, begin+1, num);
}
}
public:
vector<vector<int> > permuteUnique(vector<int> &num) {
vector<vector<int>> result;
sort(num.begin(), num.end());
help(result, 0, num);
return result;
}
};
================================================
FILE: cpp/041-050/Permutations.cpp
================================================
class Solution {
void help(vector<vector<int>>& result, int begin, vector<int> &num)
{
if (begin == num.size()) {
result.emplace(result.end(), num);
return;
}
for (int i = begin; i < num.size();i++)
{
swap(num[begin], num[i]);
help(result, begin+1, num);
swap(num[begin], num[i]);
}
}
public:
vector<vector<int> > permute(vector<int> &num) {
vector<vector<int>> result;
help(result, 0, num);
return result;
}
};
================================================
FILE: cpp/041-050/Pow.cpp
================================================
class Solution {
public:
double myPow(double x, int n) {
double res = 1.0;
double tmp = x;
bool sign = (n >= 0);
n = abs(n);
while (n > 0) {
if (n & 1) {
res *= tmp;
}
tmp *= tmp;
n = n >> 1;
}
return sign ? res : 1/res;
}
};
================================================
FILE: cpp/041-050/Rotate Image.cpp
================================================
class Solution {
public:
void rotate(vector<vector<int> > &matrix) {
int n = matrix[0].size() -1;
for (int i = 0;i <= n - i;i++) {
for (int j = i;j <= n - i - 1;j++) {
int tmp = matrix[j][n-i];
matrix[j][n-i] = matrix[i][j];
matrix[i][j] = matrix[n-j][i];
matrix[n-j][i] = matrix[n-i][n-j];
matrix[n-i][n-j] = tmp;
}
}
}
};
================================================
FILE: cpp/041-050/Trapping Rain Water.cpp
================================================
class Solution {
public:
int trap(vector<int>& height) {
int i = 0;
int j = height.size() - 1;
int maxleft = 0, maxright = 0;
int res = 0;
while(i < j) {
if(height[i] <= height[j]) {
if (height[i] > maxleft) maxleft = height[i];
else res += (maxleft - height[i]);
i++;
} else {
if (height[j] > maxright) maxright = height[j];
else res += (maxright - height[j]);
j--;
}
}
return res;
}
};
================================================
FILE: cpp/041-050/Wildcard Matching.cpp
================================================
class Solution {
public:
bool isMatch(string s, string p) {
int i(0),j(0),ss(0),pp(-1);
while (i < s.length()) {
if(s[i] == p[j] || p[j] == '?') {i++;j++;continue;}
else if(p[j] == '*'){ss = i;pp = ++j;continue;}
else if(pp != -1) {i = ++ss;j = pp;continue;}
return false;
}
while (j < p.length()) if(p[j++] != '*') return false;
return true;
}
};
================================================
FILE: cpp/051-060/Insert Interval.cpp
================================================
class Solution {
vector<Interval> merge(vector<Interval> &intervals) {
if(intervals.size() < 2)
return intervals;
auto comp = [&](Interval m,Interval n) { return m.start < n.start; };
vector<Interval> result;
sort(intervals.begin(), intervals.end(), comp);
Interval now = intervals[0];
for(int i = 1;i < intervals.size();i++)
{
Interval then = intervals[i];
if(now.end >= then.start) {
now.end = max(now.end, then.end);
} else {
result.push_back(now);
now = then;
}
}
result.push_back(now);
return result;
}
public:
vector<Interval> insert(vector<Interval> &intervals, Interval newInterval) {
intervals.push_back(newInterval);
return merge(intervals);
}
};
================================================
FILE: cpp/051-060/Jump Game.cpp
================================================
class Solution {
public:
bool canJump(vector<int>& nums) {
int maxpos(0);
for (int i = 0; i < nums.size(); i++) {
if (i <= maxpos) {
int tmp = i + nums[i];
if(tmp >= (nums.size()-1)) return true;
maxpos = max(tmp, maxpos);
}
else return false;
}
return false;
}
};
================================================
FILE: cpp/051-060/Length of Last Word.cpp
================================================
class Solution {
public:
int lengthOfLastWord(string s) {
int len = 0, tail = s.length() - 1;
while (tail >= 0 && s[tail] == ' ') tail--;
while (tail >= 0 && s[tail] != ' ') {
len++;
tail--;
}
return len;
}
};
================================================
FILE: cpp/051-060/Maximum_Subarray.cpp
================================================
/*************************************************************************
> File Name: Maximum_Subarray.cpp
> Author: Louis1992
> Mail: zhenchaogan@gmail.com
> Blog: http://gzc.github.io
> Created Time: Sat Apr 18 19:14:47 2015
************************************************************************/
#include<iostream>
#include<cstdio>
#include<list>
#include<vector>
#include<unordered_map>
#include<climits>
#include<unordered_set>
#include<map>
#include<set>
#include<stack>
#include<queue>
using namespace std;
class Solution {
public:
int maxSubArray(std::vector<int>& A) {
int n = A.size();
int a1(0), a2(0);
int m = INT_MIN;
for(int i = 0;i < n;i++)
{
if(i == 0) a2 = A[i];
else if (a1 < 0) a2 = A[i];
else a2 = A[i]+a1;
m = max(m,a2);
a1 = a2;
}
return m;
}
};
int main() {
Solution s;
return 0;
}
================================================
FILE: cpp/051-060/Merge Intervals.cpp
================================================
class Solution {
public:
vector<vector<int>> merge(vector<vector<int>> &intervals) {
auto comp = [](const vector<int>& m, const vector<int>& n) {
return m[0] < n[0];
};
sort(intervals.begin(), intervals.end(), comp);
vector<int> now = intervals[0];
vector<vector<int>> result;
for (int i = 1;i < intervals.size();i++) {
const vector<int>& then = intervals[i];
if (now[1] >= then[0]) {
now[1] = max(now[1], then[1]);
} else {
result.push_back(now);
now = then;
}
}
result.push_back(now);
return result;
}
};
================================================
FILE: cpp/051-060/N-Queens II.cpp
================================================
class Solution {
bool *cols;
bool *add;
bool *diff;
int n;
bool valid(int i, int j) {
if (!cols[j] && !add[i+j] && !diff[i-j+n])
return true;
return false;
}
void help(int i, int &res) {
if (i == n) {
res++;
return;
}
for (int j = 0;j < n;j++) {
if(valid(i, j)) {
cols[j] = add[i+j] = diff[i-j+n] = true;
help(i+1, res);
cols[j] = add[i+j] = diff[i-j+n] = false;
}
}
}
public:
int totalNQueens(int n) {
cols = new bool[n];
add = new bool[2*n];
diff = new bool[2*n];
memset(cols, 0, n);
memset(add, 0, 2*n);
memset(diff, 0, 2*n);
this->n = n;
int res = 0;
help(0, res);
return res;
}
};
================================================
FILE: cpp/051-060/N-Queens.cpp
================================================
class Solution {
bool *cols;
bool *add;
bool *diff;
int n;
bool valid(int i, int j)
{
if(!cols[j] && !add[i+j] && !diff[i-j+n])
return true;
return false;
}
void help(vector<vector<string>> &result, vector<pair<int, int>> &tmp, int i)
{
if(i == n)
{
string s(n, '.');
vector<string>t{n,s};
for(int k = 0;k < tmp.size();k++)
t[tmp[k].first][tmp[k].second] = 'Q';
result.push_back(t);
return;
}
for(int j = 0;j < n;j++)
{
if(valid(i, j))
{
cols[j] = add[i+j] = diff[i-j+n] = true;
tmp.push_back(make_pair(i, j));
help(result, tmp, i+1);
tmp.pop_back();
cols[j] = add[i+j] = diff[i-j+n] = false;
}
}
}
public:
vector<vector<string> > solveNQueens(int n) {
cols = new bool[n];
add = new bool[2*n];
diff = new bool[2*n];
this->n = n;
vector<vector<string>> result;
vector<pair<int, int>> tmp;
help(result, tmp, 0);
return result;
}
};
================================================
FILE: cpp/051-060/Permutation Sequence.cpp
================================================
class Solution {
public:
string getPermutation(int n, int k) {
int pTable[10] = {1};
for (int i = 1; i <= 9; i++) {
pTable[i] = i * pTable[i - 1];
}
string result;
char a[] = {'1','2','3','4','5','6','7','8','9'};
vector<char> numSet(a, a+9);
while (n > 0) {
int temp = (k - 1) / pTable[n - 1];
result += numSet[temp];
numSet.erase(numSet.begin() + temp);
k = k - temp * pTable[n - 1];
n--;
}
return result;
}
};
================================================
FILE: cpp/051-060/Spiral Matrix II.cpp
================================================
#include <iostream>
#include <unordered_map>
#include <vector>
#include <stack>
#include <queue>
using namespace std;
class Solution {
public:
vector<vector<int> > generateMatrix(int n) {
vector<vector <int> > result(n ,vector<int>(n));
if(n == 0)
return result;
int h = n;
int w = n;
int step = 1;
int i(0),j(0);
int z = 1;
while(w > 0 && h > 0)
{
for(int k = 0;k < w;k++)
{
result[i][j] = z++;
j += step;
}
j -= step;
i += step;
h--;
for(int k = 0;k < h;k++)
{
result[i][j] = z++;
i += step;
}
i -= step;
step *= -1;
j += step;
w--;
}
return result;
}
};
int main()
{
Solution s;
return 0;
}
================================================
FILE: cpp/051-060/Spiral Matrix.cpp
================================================
#include <iostream>
#include <unordered_map>
#include <vector>
#include <stack>
#include <queue>
using namespace std;
class Solution {
public:
vector<int> spiralOrder(vector<vector<int> > &matrix) {
vector<int>result;
if(matrix.size() == 0)
return result;
int h = matrix.size();
int w = matrix[0].size();
int step = 1;
int i(0),j(0);
while(w > 0 && h > 0)
{
for(int k = 0;k < w;k++)
{
result.push_back(matrix[i][j]);
j += step;
}
j -= step;
i += step;
h--;
for(int k = 0;k < h;k++)
{
result.push_back(matrix[i][j]);
i += step;
}
i -= step;
step *= -1;
j += step;
w--;
}
return result;
}
};
int main()
{
Solution s;
return 0;
}
================================================
FILE: cpp/061-070/Add Binary.cpp
================================================
class Solution {
public:
string addBinary(string a, string b) {
string result;
int carry = 0;
int i1 = a.length() - 1;
int i2 = b.length() - 1;
while (i1 >= 0 || i2 >= 0 || carry > 0) {
int v1 = i1 >= 0 ? a[i1] - '0' : 0;
int v2 = i2 >= 0 ? b[i2] - '0' : 0;
int sum = v1 + v2 + carry;
result.push_back((sum & 1) + '0');
carry = (sum >> 1) & 1;
i1--;
i2--;
}
reverse(begin(result), end(result));
return result;
}
};
================================================
FILE: cpp/061-070/Climbing Stairs.cpp
================================================
class Solution {
public:
int climbStairs(int n) {
vector<int> dp(n, 0);
dp[0] = 1;
dp[1] = 2;
for (int i =2;i < n;i++)
{
dp[i] = dp[i-1]+dp[i-2];
}
return dp[n-1];
}
};
================================================
FILE: cpp/061-070/Minimum Path Sum .cpp
================================================
public:
int minPathSum(vector<vector<int> > &grid) {
int n = grid.size();
int m = grid[0].size();
int p[n][m];
p[0][0] = grid[0][0];
for(int k = 1;k < n;k++)
p[k][0] = p[k-1][0]+grid[k][0];
for(int k = 1;k < m;k++)
p[0][k] = p[0][k-1]+grid[0][k];
for(int i = 1;i < n;i++)
for(int j = 1;j < m;j++)
p[i][j] = min(p[i-1][j], p[i][j-1]) + grid[i][j];
return p[n-1][m-1];
}
};
================================================
FILE: cpp/061-070/Plus One.cpp
================================================
class Solution {
public:
vector<int> plusOne(vector<int>& digits) {
int carry(1);
for (int i = digits.size()-1; i >= 0; i--) {
int tmp = digits[i] + carry;
carry = tmp/10;
digits[i] = tmp%10;
}
if (carry)
digits.emplace(digits.begin(), 1);
return digits;
}
};
================================================
FILE: cpp/061-070/Rotate List.cpp
================================================
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode *rotateRight(ListNode *head, int k) {
if(!head || !head->next || !k)
return head;
int len = 1;
ListNode *tail(head), *head2(head);
while (tail && tail->next) {
len++;
tail = tail->next;
}
k = k % len;
if(!k) return head;
int n = len-k;
while(--n)
head2 = head2->next;
ListNode *tmp = head2->next;
head2->next = nullptr;
head2 = tmp;
tail->next = head;
return head2;
}
};
================================================
FILE: cpp/061-070/Sqrt.cpp
================================================
class Solution {
public:
int mySqrt(int x) {
if (x == 0) return 0;
int left(1), right(x);
while (true) {
int mid = left + (right - left)/2;
if (mid > x/mid) {
right = mid - 1;
} else {
if (mid + 1 > x/(mid + 1))
return mid;
left = mid + 1;
}
}
return -1;
}
};
class Solution {
public:
int mySqrt(int x) {
if (x == 0) return 0;
int left = 1, right = x/2;
while (left < right) {
int mid = left + (right - left)/2;
if ((long)mid * (long)mid <= (long)x && (long)(mid+1)*(long)(mid+1) > (long)x) {
return mid;
} else if ((long)mid * (long)mid > (long)x) {
right = mid - 1;
} else {
left = mid + 1;
}
}
return left;
}
};
================================================
FILE: cpp/061-070/Text Justification.cpp
================================================
class Solution {
vector<int> help(vector<string> &words, int start, int end, int L)
{
int wordCount = end - start;
if(words.size() == end) return vector<int>(wordCount-1,1);
int sum = L;
for(int i = start;i < end;i++)
sum -= words[i].length();
int Count = wordCount - 1;
int average = sum / Count;
vector<int> blocks(wordCount-1, average);
sum -= average * Count;
int index = 0;
while(sum--)
blocks[index++]++;
return blocks;
}
public:
vector<string> fullJustify(vector<string> &words, int L) {
vector<string> result;
if(words.size() == 0) return result;
int from = 0;
while(from < words.size())
{
string temp(L, ' ');
int start = from;
int len = words[from].length();
while(len <= L && from < words.size()){
from ++;
if(from == words.size()) break;
len = len + words[from].length() + 1;
}
if(from - start == 1){
for(int n = 0;n < words[start].length();n++)
temp[n] = words[start][n];
} else {
vector<int> blocks = help(words, start, from, L);
int index = 0;
int skip = 0;
for(int i = start;i < from;i++)
{
string now = words[i];
for(int j = 0;j < now.length();j++)
temp[index++] = now[j];
index += blocks[skip++];
}
}
result.push_back(temp);
}
return result;
}
};
================================================
FILE: cpp/061-070/Unique Paths II .cpp
================================================
class Solution {
public:
int uniquePathsWithObstacles(vector<vector<int> > &obstacleGrid) {
int m(obstacleGrid.size()), n(obstacleGrid[0].size());
vector<vector<int>> dp(m+1,vector<int>(n+1,0));
if(obstacleGrid[0][0] == 1 || obstacleGrid[m-1][n-1] == 1)
return 0;
dp[1][1] = 1;
for(int i = 1;i <= m;i++)
{
for(int j = 1;j <= n;j++)
{
if(i == 1 && j == 1) continue;
if(obstacleGrid[i-1][j-1] == 1)
dp[i][j] = 0;
else
dp[i][j] = dp[i-1][j] + dp[i][j-1];
}
}
return dp[m][n];
}
};
================================================
FILE: cpp/061-070/Unique Paths.cpp
================================================
class Solution {
public:
int uniquePaths(int m, int n) {
vector<vector<int> > path(m, vector<int> (n, 1));
for (int i = 1; i < m; i++)
for (int j = 1; j < n; j++)
path[i][j] = path[i - 1][j] + path[i][j - 1];
return path[m - 1][n - 1];
}
};
================================================
FILE: cpp/061-070/Valid Number.cpp
================================================
class Solution {
public:
bool isNumber(string str) {
int state=0, flag=0; // flag to judge the special case "."
while(str[0]==' ') str.erase(0,1);//delete the prefix whitespace
while(str[str.length()-1]==' ') str.erase(str.length()-1, 1);//delete the suffix whitespace
for(int i=0; i<str.length(); i++){
if('0'<=str[i] && str[i]<='9'){
flag=1;
if(state<=2) state=2;
else state=(state<=5)?5:7;
}
else if('+'==str[i] || '-'==str[i]){
if(state==0 || state==3) state++;
else return false;
}
else if('.'==str[i]){
if(state<=2) state=6;
else return false;
}
else if('e'==str[i]){
if(flag&&(state==2 || state==6 || state==7)) state=3;
else return false;
}
else return false;
}
return (state==2 || state==5 || (flag&&state==6) || state==7);
}
};
================================================
FILE: cpp/071-080/Combinations.cpp
================================================
class Solution {
void help(int n, int k, int index, vector<int>&tmp, vector<vector<int>>&v)
{
if(k == 0)
{
v.push_back(tmp);
return;
}
else if(index > n)
return;
help(n,k,index+1,tmp,v);
tmp.push_back(index);
help(n,k-1,index+1,tmp,v);
tmp.pop_back();
}
public:
vector<vector<int> > combine(int n, int k) {
vector<vector<int>>v;
vector<int>tmp;
help(n,k,1,tmp,v);
return v;
}
};
================================================
FILE: cpp/071-080/Edit Distance.cpp
================================================
class Solution {
public:
int minDistance(string word1, string word2) {
int m = word1.length();
int n = word2.length();
vector<vector<int>> p(m+1, vector<int>(n+1));
for (int i = 0;i <= m;i++)
p[i][0] = i;
for (int j = 0;j <= n;j++)
p[0][j] = j;
for (int i = 1;i <= m;i++) {
for (int j = 1;j <= n;j++) {
if (word1[i-1] == word2[j-1]) {
p[i][j] = p[i-1][j-1];
} else {
p[i][j] = min(1 + p[i-1][j-1], 1+min(p[i][j-1], p[i-1][j]));
}
}
}
return p[m][n];
}
};
================================================
FILE: cpp/071-080/Minimum Window Substring.cpp
================================================
class Solution {
public:
string minWindow(string s, string t) {
unordered_map<char, int> dict;
int cnt = 0, start = 0, len = INT_MAX, first = 0;
for (char c : t) {
dict[c]++;
}
for (int i = 0; i < s.size(); i++) {
dict[s[i]]--;
if (dict[s[i]] >= 0) {
cnt++;
}
while (cnt == t.size()) {
dict[s[start]]++;
if (dict[s[start]] > 0) {
cnt--;
}
if (i - start + 1 < len) {
len = i - start + 1;
first = start;
}
start++;
}
}
return len == INT_MAX ? "" : s.substr(first, len);
}
};
================================================
FILE: cpp/071-080/Remove Duplicates from Sorted Array II.cpp
================================================
class Solution {
public:
int removeDuplicates(vector<int>& nums) {
int rear(1), n(nums.size());
if (n <= 2) return n;
for (int i = 2; i < n; i++)
if (!(nums[i] == nums[rear] && nums[i] == nums[rear -1]))
nums[++rear] = nums[i];
return rear+1;
}
};
================================================
FILE: cpp/071-080/Search a 2D Matrix.cpp
================================================
class Solution {
public:
bool searchMatrix(vector<vector<int> > &matrix, int target) {
int row(matrix.size()), col(matrix[0].size());
int i(0), j(row*col-1);
while (i <= j) {
int mid = (i+j) >> 1;
int v = matrix[mid/col][mid%col];
if (target < v) j = mid - 1;
else if (target > v) i = mid + 1;
else if (target == v) return true;
}
return false;
}
};
================================================
FILE: cpp/071-080/Set Matrix Zeroes.cpp
================================================
class Solution {
public:
void setZeroes(vector<vector<int> > &matrix) {
bool col0 = false;
int outer = matrix.size();
int inner = matrix[0].size();
for (int i = 0; i < outer; i++) {
if (matrix[i][0] == 0)
col0 = true;
for (int j = 1; j < inner; j++) {
if (matrix[i][j] == 0) {
matrix[i][0] = 0;
matrix[0][j] = 0;
}
}
}
for (int i = outer-1; i >= 0; i--) {
for (int j = inner-1; j >= 1; j--) {
if (matrix[i][0] == 0 || matrix[0][j] == 0) {
matrix[i][j] = 0;
}
}
if(col0)
matrix[i][0] = 0;
}
}
};
================================================
FILE: cpp/071-080/Simplify Path.cpp
================================================
class Solution {
public:
string simplifyPath(string path) {
string res, tmp;
vector<string> stk;
stringstream ss(path);
while(getline(ss,tmp,'/')) {
if (tmp == "" or tmp == ".") continue;
if (tmp == ".." and !stk.empty()) stk.pop_back();
else if (tmp != "..") stk.push_back(tmp);
}
for(auto str : stk) res += "/"+str;
return res.empty() ? "/" : res;
}
};
================================================
FILE: cpp/071-080/Sort Colors.cpp
================================================
class Solution {
public:
void sortColors(vector<int>& nums) {
int i = 0, j = 0;
for (int r = 0; r < nums.size(); r++) {
if (nums[r] == 0) {
swap(nums[j], nums[r]);
swap(nums[i], nums[j]);
i++;
j++;
} else if (nums[r] == 1) {
swap(nums[r], nums[j]);
j++;
}
}
}
};
================================================
FILE: cpp/071-080/Subsets.cpp
================================================
class Solution {
public:
vector<vector<int> > subsets(vector<int> &S) {
sort(S.begin(),S.end());
vector<vector<int>> sets;
vector<int> empty;
sets.push_back(empty);
int num = 1;
for(int i = 0;i < S.size();i++)
{
for(int k = 0;k < num;k++)
{
vector<int> tmp = sets[k];
tmp.push_back(S[i]);
sets.push_back(tmp);
}
num *= 2;
}
return sets;
}
};
================================================
FILE: cpp/071-080/Word Search.cpp
================================================
class Solution {
public:
bool dfs(vector<vector<char>>& board, const string &word, int i, int j, int ind) {
if (ind == word.size()) {
return true;
}
if (i >= board.size() || j >= board[0].size() || i < 0 || j < 0) return false;
if (board[i][j] == 0 || board[i][j] != word[ind]) return false;
board[i][j] = 0;
if (dfs(board, word, i+1, j, ind + 1)) return true;
if (dfs(board, word, i, j+1, ind + 1)) return true;
if (dfs(board, word, i-1, j, ind + 1)) return true;
if (dfs(board, word, i, j-1, ind + 1)) return true;
board[i][j] = word[ind];
return false;
}
bool exist(vector<vector<char>>& board, string word) {
int m = board.size();
if (m == 0) return false;
int n = board[0].size();
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
if (dfs(board, word, i, j, 0)) return true;
}
}
return false;
}
};
================================================
FILE: cpp/081-090/Gray Code.cpp
================================================
class Solution {
public:
vector<int> grayCode(int n) {
vector<int> v{0};
for (int i = 0; i < n; i++) {
int len = v.size();
for (int j = len-1; j >= 0; j--)
v.push_back(v[j] | (1 << i) );
}
return v;
}
};
================================================
FILE: cpp/081-090/Largest Rectangle in Histogram.cpp
================================================
class Solution {
public:
int largestRectangleArea(vector<int> &hist) {
int res(0);
stack<int> s;
hist.push_back(0);
for (int i = 0;i < hist.size();i++) {
while (!s.empty() && hist[i] < hist[s.top()]) {
int tp = s.top();
int h = hist[tp];
s.pop();
int tmp = h * (s.empty() ? i : i-s.top()-1);
res = max(res, tmp);
}
s.push(i);
}
return res;
}
};
================================================
FILE: cpp/081-090/Maximal Rectangle.cpp
================================================
class Solution {
public:
int maximalRectangle(vector<vector<char>>& matrix) {
if (matrix.size() <= 0) return 0;
int h[matrix[0].size()+1];
memset(h, 0, sizeof(int) * (matrix[0].size()+1));
int res(0);
for (int i = 0;i < matrix.size();i++) {
stack<int> s;
matrix[i].push_back('0');
for (int j = 0;j < matrix[0].size();j++) {
if (matrix[i][j] == '0') h[j] = 0;
else h[j]++;
while (!s.empty() && h[j] < h[s.top()]) {
int tp = s.top();
s.pop();
int height = h[tp];
int tmp = height * (s.empty() ? j : j - s.top() - 1);
res = max(res, tmp);
}
s.push(j);
}
}
return res;
}
};
================================================
FILE: cpp/081-090/Merge Sorted Array.cpp
================================================
class Solution {
public:
void merge(vector<int>& nums1, int m, vector<int>& nums2, int n) {
int i = m - 1;
int j = n - 1;
int k = m + n - 1;
while (i >= 0 && j >= 0) {
if (nums1[i] >= nums2[j]) {
nums1[k] = nums1[i];
i--;
} else {
nums1[k] = nums2[j];
j--;
}
k--;
}
while (i >= 0) {
nums1[k] = nums1[i];
k--;
i--;
}
while (j >= 0) {
nums1[k] = nums2[j];
k--;
j--;
}
}
};
================================================
FILE: cpp/081-090/Partition List.cpp
================================================
class Solution {
public:
ListNode *partition(ListNode *head, int x) {
ListNode *head1 = new ListNode(0);
ListNode *head2 = new ListNode(0);
ListNode *h1 = head1;
ListNode *h2 = head2;
while(head)
{
int v = head->val;
if(v < x)
{
head1->next = head;
head1 = head1->next;
} else {
head2->next = head;
head2 = head2->next;
}
head = head->next;
}
head2->next = NULL;
head1->next = h2->next;;
return h1->next;
}
};
================================================
FILE: cpp/081-090/Remove Duplicates from Sorted List II.cpp
================================================
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <stack>
#include <string>
using namespace std;
struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
};
class Solution {
public:
ListNode *deleteDuplicates(ListNode *head) {
ListNode *result = new ListNode(INT_MIN);
ListNode *_head = result;
int prev(INT_MIN);
while(head)
{
if(head->val != prev && ( (!head->next) || head->val != head->next->val) )
{
_head->next = head;
_head = head;
}
prev = head->val;
head = head->next;
}
_head->next = NULL;
return result->next;
}
};
int main()
{
Solution s;
ListNode *n1 = new ListNode(1);
ListNode *n2 = new ListNode(2);
ListNode *n3 = new ListNode(2);
n1->next = n2;
n2->next = n3;
ListNode *head = s.deleteDuplicates(n1);
while(head)
{
cout << head->val << " ";
head = head->next;
}
}
================================================
FILE: cpp/081-090/Remove Duplicates from Sorted List.cpp
================================================
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <stack>
#include <string>
using namespace std;
struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
};
class Solution {
public:
ListNode* deleteDuplicates(ListNode* head) {
ListNode *node(head);
while(node && node->next)
{
if (node->val == node->next->val)
node->next = node->next->next;
else
node = node->next;
}
return head;
}
};
int main()
{
Solution s;
ListNode *n1 = new ListNode(1);
ListNode *n2 = new ListNode(2);
ListNode *n3 = new ListNode(2);
n1->next = n2;
n2->next = n3;
ListNode *head = s.deleteDuplicates(n1);
while(head)
{
cout << head->val << " ";
head = head->next;
}
}
================================================
FILE: cpp/081-090/Scramble String.cpp
================================================
class Solution {
public:
bool isScramble(string s1, string s2) {
// Note: The Solution object is instantiated only once.
if (s1.length() != s2.length()) return false;
if (s1 == s2) return true;
int A[26] = {0};
for (int i = 0; i < s1.length(); i++)
++A[s1[i]-'a'];
for (int j = 0; j < s2.length(); j++)
--A[s2[j]-'a'];
for (int k = 0; k < 26; k++)
if(A[k] != 0) return false;
for(int i = 1; i < s1.length(); i++) {
bool result = isScramble(s1.substr(0,i), s2.substr(0,i))
&& isScramble(s1.substr(i), s2.substr(i));
result = result || (isScramble(s1.substr(0,i), s2.substr(s2.length()-i, i))
&& isScramble(s1.substr(i), s2.substr(0,s2.length()-i)));
if (result) return true;
}
return false;
}
};
================================================
FILE: cpp/081-090/Search in Rotated Sorted Array II.cpp
================================================
class Solution {
public:
bool search(vector<int>& nums, int target) {
int i = 0;
int j = nums.size() - 1;
while (i <= j) {
int mid = (i + j) / 2;
if (nums[mid] == target) return true;
if (nums[mid] < nums[i]) {
if (nums[mid] < target && nums[j] >= target) i = mid + 1;
else j = mid - 1;
} else if (nums[mid] > nums[i]) {
if (nums[mid] > target && nums[i] <= target) j = mid - 1;
else i = mid + 1;
} else {
i++;
}
}
return false;
}
};
================================================
FILE: cpp/081-090/Subsets II.cpp
================================================
class Solution {
public:
vector<vector<int>> subsetsWithDup(vector<int>& nums) {
sort(nums.begin(), nums.end());
vector<vector<int>> sets;
vector<int> empty;
sets.push_back(empty);
int num = 1;
int prev(INT_MIN);
for(int i = 0;i < nums.size();i++)
{
int number = nums[i];
if(number != prev)
{
num = sets.size();
for(int k = 0;k < num;k++)
{
vector<int> tmp = sets[k];
tmp.push_back(number);
sets.push_back(tmp);
}
prev = number;
} else {
int index = sets.size()-num;
for(int k = 0;k < num;k++)
{
vector<int> tmp = sets[k+index];
tmp.push_back(number);
sets.push_back(tmp);
}
}
}
return sets;
}
};
================================================
FILE: cpp/091-100/Binary Tree Inorder Traversal.cpp
================================================
class Solution {
public:
vector<int> inorderTraversal(TreeNode* root) {
vector<int> result;
stack<TreeNode*> node_in_path;
TreeNode* current_node = root;
while (current_node || !node_in_path.empty())
{
while (current_node)
{
node_in_path.emplace(current_node);
current_node = current_node->left;
}
current_node = node_in_path.top();
node_in_path.pop();
result.push_back(current_node->val);
current_node = current_node->right;
}
return result;
}
};
================================================
FILE: cpp/091-100/Decode Ways.cpp
================================================
class Solution {
bool valid(char ch1, char ch2)
{
if(ch1 == '1')
return true;
else if(ch1 == '2')
{
if(ch2 <= '6')
return true;
return false;
}
return false;
}
public:
int numDecodings(string s) {
int n = s.length();
if(n == 0) return 0;
int *p = new int[n+1];
p[0] = 1;
p[1] = 1;
if(s[0] == '0') p[1] = 0;
for(int i = 0;i < n-1;i++)
{
if(s[i+1] == '0')
{
if (s[i] >= '1' && s[i] <= '2')
p[i+2] = p[i];
else
p[i+2] = 0;
} else if(s[i] == '0') {
p[i+2] = p[i+1];
}
else if(valid(s[i], s[i+1]))
p[i+2] = p[i]+p[i+1];
else
p[i+2] = p[i+1];
}
return p[n];
}
};
================================================
FILE: cpp/091-100/Interleaving String.cpp
================================================
class Solution {
public:
bool isInterleave(string s1, string s2, string s3) {
if(s1.length() + s2.length() != s3.length())
return false;
bool table[s1.length()+1][s2.length()+1];
for(int i = 0;i <= s1.length();i++)
for(int j = 0;j <= s2.length();j++)
table[i][j] = false;
table[0][0] = true;
for(int i = 1;i <= s1.length();i++)
if(s3[i-1] == s1[i-1] && table[i-1][0])
table[i][0] = true;
for(int j = 1;j <= s2.length();j++)
if(s3[j-1] == s2[j-1] && table[0][j-1])
table[0][j] = true;
for(int i = 1;i <= s1.length();i++)
{
for(int j = 1;j <= s2.length();j++)
{
if(s3[i+j-1] == s1[i-1] && table[i-1][j] == true)
table[i][j] = true;
if(s3[i+j-1] == s2[j-1] && table[i][j-1] == true)
table[i][j] = true;
}
}
return table[s1.length()][s2.length()];
}
};
================================================
FILE: cpp/091-100/Recover Binary Search Tree.cpp
================================================
class Solution {
public:
void recoverTree(TreeNode* root) {
stack<TreeNode*>s;
TreeNode *p = root;
TreeNode *prev(nullptr);
bool fff(false);
TreeNode *n1(nullptr), *n2(nullptr);
while (p || !s.empty()) {
while (p) {
s.push(p);
p = p->left;
}
p = s.top();
s.pop();
if (prev && prev->val > p->val) {
n2 = p;
if (!fff){
fff = true;
n1 = prev;
} else {
swap(n1->val, n2->val);
return;
}
}
prev = p;
p = p->right;
}
swap(n1->val, n2->val);
}
};
================================================
FILE: cpp/091-100/Restore IP Addresses.cpp
================================================
class Solution {
public:
vector<string> restoreIpAddresses(string s) {
vector<string> ret;
string ans;
for (int a=1; a<=3; a++)
for (int b=1; b<=3; b++)
for (int c=1; c<=3; c++)
for (int d=1; d<=3; d++)
if (a+b+c+d == s.length()) {
int A = stoi(s.substr(0, a));
int B = stoi(s.substr(a, b));
int C = stoi(s.substr(a+b, c));
int D = stoi(s.substr(a+b+c, d));
if (A <= 255 && B <= 255 && C <= 255 && D <= 255)
// 000000 => false
if ( (ans=to_string(A)+"."+to_string(B)+"."+to_string(C)+"."+to_string(D)).length() == s.length()+3)
ret.push_back(ans);
}
return ret;
}
};
================================================
FILE: cpp/091-100/Reverse Linked List II.cpp
================================================
class Solution {
public:
ListNode *reverseBetween(ListNode *head, int m, int n) {
int d = n - m;
if(m == n) return head;
int ttt = m;
ListNode *answer = new ListNode(0);
answer->next = head;
while(--m > 1)
head = head->next;
ListNode *left = ttt == 1 ? answer : head;
ListNode *r_head = left->next;
head = r_head;
ListNode *tmp = head->next;
while(d-- > 0) {
ListNode *n = tmp->next;
tmp -> next = head;
head = tmp;
tmp = n;
}
left->next = head;
r_head->next = tmp;
return answer->next;
}
};
================================================
FILE: cpp/091-100/Same Tree.cpp
================================================
class Solution {
public:
bool isSameTree(TreeNode* p, TreeNode* q) {
if (p == nullptr && q == nullptr) return true;
if ( (p && !q) || (q && !p) ) return false;
if (p->val != q->val) return false;
return isSameTree(p->left, q->left) && isSameTree(p->right, q->right);
}
};
================================================
FILE: cpp/091-100/Unique Binary Search Trees II.cpp
================================================
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
vector<TreeNode *> generate(int beg, int end) {
vector<TreeNode* > ret;
if (beg > end) {
ret.push_back(nullptr);
return ret;
}
for (int i = beg; i <= end; i++) {
vector<TreeNode* > leftTree = generate(beg, i - 1);
vector<TreeNode* > rightTree = generate(i + 1, end);
for (int j = 0; j < leftTree.size(); j++) {
for (int k = 0; k < rightTree.size(); k++) {
TreeNode *node = new TreeNode(i);
ret.push_back(node);
node->left = leftTree[j];
node->right = rightTree[k];
}
}
}
return ret;
}
public:
vector<TreeNode *> generateTrees(int n) {
if (n == 0) return vector<TreeNode *>();
return generate(1, n);
}
};
================================================
FILE: cpp/091-100/Unique Binary Search Trees.cpp
================================================
class Solution {
public:
int numTrees(int n) {
vector<int> dp(n+1, 0);
dp[0] = dp[1] = 1;
for (int i = 2;i <= n;i++)
for (int k = 0;k < n;k++)
dp[i] += dp[k]*dp[i-k-1];
return dp[n];
}
};
================================================
FILE: cpp/091-100/Validate Binary Search Tree.cpp
================================================
class Solution {
public:
bool isValidBST(TreeNode* root) {
stack<TreeNode*>s;
TreeNode *p = root;
int prev(INT_MIN);
bool first(true);
while (p!= nullptr || !s.empty()) {
while (p != nullptr) {
s.push(p);
p = p->left;
}
p = s.top();
s.pop();
if (first) {
prev = p->val;
first = false;
} else if (p->val <= prev) {
return false;
}
prev = p->val;
p = p->right;
}
return true;
}
};
================================================
FILE: cpp/1001-10000/1001-1010/Construct Binary Search Tree from Preorder Traversal.cpp
================================================
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
TreeNode* dfs(int& i, vector<int>& preorder, int lower, int upper) {
if (i >= preorder.size()) return nullptr;
int v = preorder[i];
if (v < lower || v > upper) return nullptr;
TreeNode* root = new TreeNode(v);
i++;
root->left = dfs(i, preorder, lower, v);
root->right = dfs(i, preorder, v, upper);
return root;
}
public:
TreeNode* bstFromPreorder(vector<int>& preorder) {
int i = 0;
return dfs(i, preorder, -99999999, 99999999);
}
};
================================================
FILE: cpp/1001-10000/1011-1020/Best Sightseeing Pair.cpp
================================================
class Solution {
public:
int maxScoreSightseeingPair(vector<int>& A) {
int best_i = 0;
int ans = 0;
for (int i = 1; i < A.size(); i++) {
ans = max(ans, A[best_i] + A[i] + best_i - i);
if (i + A[i] >= best_i + A[best_i]) {
best_i = i;
}
}
return ans;
}
};
================================================
FILE: cpp/1001-10000/1011-1020/Binary Prefix Divisible By 5.cpp
================================================
class Solution {
public:
vector<bool> prefixesDivBy5(vector<int>& A) {
vector<bool> answer(A.size());
int v = 0;
int i = 0;
for (int e : A) {
v = 2*v + e;
v %= 5;
answer[i] = v == 0;
i++;
}
return answer;
}
};
================================================
FILE: cpp/1001-10000/1011-1020/Binary String With Substrings Representing 1 To N.cpp
================================================
class Solution {
public:
bool queryString(string S, int N) {
for (int i = N; i >= 1; i--) {
int number = i;
string str_num = "";
// Convert the number to string
while(number!=0) {
str_num += number%2 + '0';
number = number/2;
}
reverse(str_num.begin(), str_num.end());
if(S.find(str_num)==string::npos)
return false;
}
return true;
}
};
================================================
FILE: cpp/1001-10000/1011-1020/Convert to Base -2.cpp
================================================
class Solution {
public:
string baseNeg2(int N) {
if (N == 0) return "0";
string ans;
while(N != 0) {
if (N % 2 != 0) {
ans = '1' + ans;
N--;
} else {
ans = '0' + ans;
}
N = -(N/2);
}
return ans;
}
};
================================================
FILE: cpp/1001-10000/1011-1020/Next Greater Node In Linked List.cpp
================================================
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
vector<int> nextLargerNodes(ListNode* head) {
int current_index = 0;
vector<int> ans(10001, 0);
stack<pair<int, int>> mystack;
while (head) {
while (!mystack.empty() && mystack.top().second < head->val) {
pair<int, int> e = mystack.top();
mystack.pop();
ans[e.first] = head->val;
}
mystack.push({current_index, head->val});
head = head->next;
current_index++;
}
ans.resize(current_index);
return ans;
}
};
================================================
FILE: cpp/1001-10000/1011-1020/Number of Enclaves.cpp
================================================
class Solution {
pair<int, int> tmp[4] = {{1,0}, {-1,0}, {0,1}, {0,-1}};
int m;
int n;
void dfs(vector<vector<int>>& A, int i, int j) {
if (A[i][j] == 0) return;
A[i][j] = 2;
for (int k = 0; k < 4; k++) {
int n_i = i + tmp[k].first;
int n_j = j + tmp[k].second;
if (n_i < 0 || n_j < 0 || n_i >= m || n_j >= n) continue;
if (A[n_i][n_j] == 1) dfs(A, n_i, n_j);
}
}
public:
int numEnclaves(vector<vector<int>>& A) {
m = A.size();
n = A.front().size();
for (int i = 0; i < m; i++) {
dfs(A, i, 0);
dfs(A, i, n-1);
}
for (int j = 0; j < n; j++) {
dfs(A, 0, j);
dfs(A, m-1, j);
}
int ans = 0;
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
if (A[i][j] == 1) {
ans++;
}
}
}
return ans;
}
};
================================================
FILE: cpp/1001-10000/1011-1020/Partition Array Into Three Parts With Equal Sum.cpp
================================================
class Solution {
public:
bool canThreePartsEqualSum(vector<int>& A) {
int target = std::accumulate(A.begin(), A.end(), 0) / 3;
int sum = 0;
int times = 0;
for (int e : A) {
sum += e;
if (sum == target) {
times++;
sum = 0;
}
}
return times >= 3;
}
};
================================================
FILE: cpp/1001-10000/1021-1030/Camelcase Matching.cpp
================================================
class Solution {
public:
vector<bool> camelMatch(vector<string>& queries, string pattern) {
vector<bool> ans;
for (const string& query : queries) {
int i = 0;
bool find = true;
for (int j = 0; j < query.length(); j++) {
if (i >= pattern.size()) {
if (isupper(query[j])) {
find = false;
break;
}
continue;
}
char target = pattern[i];
if (target == query[j]) {
i++;
} else if (isupper(query[j])) {
find = false;
break;
}
}
find &= i >= pattern.size();
ans.push_back(find);
}
return ans;
}
};
================================================
FILE: cpp/1001-10000/1021-1030/Divisor Game.cpp
================================================
class Solution {
map<int, bool> dp;
public:
bool divisorGame(int N) {
if (N == 0) return false;
if (dp.count(N) > 0) return dp[N];
for (int i = 1; i < N; i++) {
if (N % i == 0) {
bool win = !divisorGame(N - i);
if (win) {
return dp[N] = win;
}
}
}
return dp[N] = false;
}
};
================================================
FILE: cpp/1001-10000/1021-1030/Longest Arithmetic Sequence.cpp
================================================
class Solution {
public:
int longestArithSeqLength(vector<int>& A) {
unordered_map<int, int> dp;
int ans = 0;
for (int i = 0; i < A.size(); i++) {
for (int j = 0; j < i; j++) {
int d = A[i] - A[j];
int key1 = i * 20001 + d;
int key2 = j * 20001 + d;
dp[key1] = max(dp[key1], 1 + dp[key2]);
ans = max(ans, dp[key1]);
}
}
return ans + 1;
}
};
================================================
FILE: cpp/1001-10000/1021-1030/Matrix Cells in Distance Order.cpp
================================================
class Solution {
public:
vector<vector<int>> allCellsDistOrder(int R, int C, int r0, int c0) {
vector<vector<int>> myqueue;
myqueue.push_back({r0, c0});
int i = 0;
int dis = 0;
pair<int, int> tmp[4] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
while (i < myqueue.size()) {
int next_i = myqueue.size();
dis++;
unordered_set<int> visited;
for (int k = i; k < next_i; k++) {
int x = myqueue[k][0];
int y = myqueue[k][1];
for (int j = 0; j < 4; j++) {
int n_x = x + tmp[j].first;
int n_y = y + tmp[j].second;
if (n_x < 0 || n_y < 0 || n_x >= R || n_y >= C) continue;
int d = abs(r0 - n_x) + abs(c0 - n_y);
if (dis != d) continue;
int hash_ = n_x * 101 + n_y;
if (visited.count(hash_) > 0) continue;
myqueue.push_back({n_x, n_y});
visited.insert(hash_);
}
}
i = next_i;
}
return myqueue;
}
};
================================================
FILE: cpp/1001-10000/1021-1030/Maximum Difference Between Node and Ancestor.cpp
================================================
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
int dfs(TreeNode* root, int min_, int max_) {
if (!root) return 0;
int current = max(abs(min_ - root->val), abs(max_ - root->val));
min_ = min(min_, root->val);
max_ = max(max_, root->val);
return max(current, max(dfs(root->left, min_, max_), dfs(root->right, min_, max_)));
}
public:
int maxAncestorDiff(TreeNode* root) {
return dfs(root, root->val, root->val);
}
};
================================================
FILE: cpp/1001-10000/1021-1030/Recover a Tree From Preorder Traversal.cpp
================================================
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
TreeNode* dfs(const string& S, int& i, int d) {
int dash_count = 0;
int i_ = i;
while (i_ < S.length() && S[i_] == '-') {
dash_count++;
i_++;
}
if (dash_count != d) return nullptr;
int num = 0;
while (i_ < S.length() && isdigit(S[i_])) {
num = 10 * num + (S[i_] - '0');
i_++;
}
i = i_;
TreeNode* node = new TreeNode(num);
node->left = dfs(S, i, d+1);
node->right = dfs(S, i, d+1);
return node;
}
public:
TreeNode* recoverFromPreorder(string S) {
int i = 0;
return dfs(S, i, 0);
}
};
================================================
FILE: cpp/1001-10000/1021-1030/Remove Outermost Parentheses.cpp
================================================
class Solution {
public:
string removeOuterParentheses(string S) {
string return_ans;
stack<char> mystack;
for (char ch : S) {
if (mystack.empty()) {
mystack.push(ch);
} else {
if (ch == '(') {
mystack.push(ch);
return_ans += '(';
} else {
mystack.pop();
if (!mystack.empty()) {
return_ans += ')';
}
}
}
}
return return_ans;
}
};
================================================
FILE: cpp/1001-10000/1021-1030/Sum of Root To Leaf Binary Numbers.cpp
================================================
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
int dfs(TreeNode* root, int carry) {
if (!root) return 0;
if (!root->left && !root->right) {
return 2*carry + root->val;
}
carry = 2 * carry + root->val;
return dfs(root->left, carry) + dfs(root->right, carry);
}
public:
int sumRootToLeaf(TreeNode* root) {
return dfs(root, 0);
}
};
================================================
FILE: cpp/1001-10000/1021-1030/Two City Scheduling.cpp
================================================
class Solution {
public:
int twoCitySchedCost(vector<vector<int>>& costs) {
sort(begin(costs), end(costs), [](vector<int> &v1, vector<int> &v2) {
return abs(v1[0] - v1[1]) > abs(v2[0] - v2[1]);
});
int a = costs.size()/2;
int b = costs.size()/2;
int ans = 0;
for (const vector<int>& cost : costs) {
if (a == 0) {
ans += cost[1];
continue;
}
if (b == 0) {
ans += cost[0];
continue;
}
if (cost[0] <= cost[1]) {
ans += cost[0];
a--;
} else {
ans += cost[1];
b--;
}
}
return ans;
}
};
================================================
FILE: cpp/1001-10000/1021-1030/Video Stitching.cpp
================================================
class Solution {
public:
int videoStitching(vector<vector<int>>& clips, int T) {
auto cmp = [](const vector<int>& a, const vector<int>& b) {
return a[0] <= b[0];
};
sort(clips.begin(), clips.end(), cmp);
int k = 0;
int next_k = -1;
int ans = 0;
for (const vector<int>& clip : clips) {
if (clip[0] > k && clip[0] <= next_k) {
ans++;
k = next_k;
}
if (clip[0] <= k) {
next_k = max(next_k, clip[1]);
if (next_k >= T) return ans + 1;
}
}
return next_k >= T ? ans : -1;
}
};
================================================
FILE: cpp/1001-10000/1031-1040/Binary Search Tree to Greater Sum Tree.cpp
================================================
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
void dfs(TreeNode* root, int& v) {
if (!root) return;
dfs(root->right, v);
v += root->val;
root->val = v;
dfs(root->left, v);
}
public:
TreeNode* bstToGst(TreeNode* root) {
int v = 0;
dfs(root, v);
return root;
}
};
================================================
FILE: cpp/1001-10000/1031-1040/Coloring A Border.cpp
================================================
class Solution {
int old_color;
int new_color;
int row;
int col;
pair<int, int> tmp[4] = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};
void dfs(vector<vector<int>>& grid, int i, int j, vector<vector<bool>>& visited) {
visited[i][j] = true;
bool has_non_connected_cells = false;
for (int k = 0; k < 4; k++) {
int new_i = i + tmp[k].first;
int new_j = j + tmp[k].second;
if (new_i < 0 || new_j < 0 || new_i >= row || new_j >= col || visited[new_i][new_j]) continue;
if (grid[new_i][new_j] == old_color) {
dfs(grid, new_i, new_j, visited);
} else {
has_non_connected_cells = true;
}
}
has_non_connected_cells |= (i == 0 || j == 0 || i == row-1 || j == col-1);
if (has_non_connected_cells) {
grid[i][j] = new_color;
}
}
public:
vector<vector<int>> colorBorder(vector<vector<int>>& grid, int r0, int c0, int color) {
old_color = grid[r0][c0];
new_color = color;
row = grid.size();
col = grid.front().size();
vector<vector<bool>> visited(row, vector<bool>(col, false));
dfs(grid, r0, c0, visited);
return grid;
}
};
================================================
FILE: cpp/1001-10000/1031-1040/Escape a Large Maze.cpp
================================================
class Solution {
bool find = false;
pair<int, int> tmp[4] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
bool isEscapePossibleInternal(vector<vector<int>>& blocked, vector<int>& source, vector<int>& target) {
set<pair<int, int>> visited;
for (const vector<int>& b : blocked) {
visited.insert({b[0], b[1]});
}
stack<pair<int, int>> mystack;
mystack.push({source[0], source[1]});
visited.insert({source[0], source[1]});
while (!mystack.empty()) {
pair<int, int> ele = mystack.top();
mystack.pop();
if (ele.first == target[0] && ele.second == target[1]) { find = true; return true; }
int dis = abs(ele.first - source[0]) + abs(ele.second - source[1]);
if (dis > blocked.size()) return true;
for (int k = 0; k < 4; k++) {
int n_i = ele.first + tmp[k].first;
int n_j = ele.second + tmp[k].second;
if (n_i < 0 || n_j < 0 || n_i >= 1e6 || n_j >= 1e6) continue;
if (visited.count({n_i, n_j}) > 0) continue;
visited.insert({n_i, n_j});
mystack.push({n_i, n_j});
}
}
return false;
}
public:
bool isEscapePossible(vector<vector<int>>& blocked, vector<int>& source, vector<int>& target) {
if (!isEscapePossibleInternal(blocked, source, target)) return false;
if (find) return true;
return isEscapePossibleInternal(blocked, target, source);
}
};
================================================
FILE: cpp/1001-10000/1031-1040/Maximum Sum of Two Non-Overlapping Subarrays.cpp
================================================
class Solution {
public:
int maxSumTwoNoOverlap(vector<int>& A, int L, int M) {
vector<int> sum = {0};
for(auto x:A) sum.push_back(sum.back()+x);
return max(help(sum, L, M), help(sum, M,L));
}
int help(const vector<int>& sum, int L, int M) {
int maxSumL = sum[L], maxSumLM = sum[L+M];
for(int i=L+M+1;i<sum.size();i++){
int curSumL = sum[i-M] - sum[i-M-L];
int curSumM = sum[i]-sum[i-M];
maxSumL = max(maxSumL, curSumL);
maxSumLM = max(maxSumLM, maxSumL + curSumM);
}
return maxSumLM;
}
};
================================================
FILE: cpp/1001-10000/1031-1040/Minimum Score Triangulation of Polygon.cpp
================================================
class Solution {
int dfs(vector<int>& A, map<pair<int, int>, int>& cache, int start_index, int end_index) {
pair<int, int> key = {start_index, end_index};
auto it = cache.find(key);
if (it != cache.end()) return it->second;
if (end_index - start_index < 2) {
return 0;
}
if (end_index - start_index == 2) {
return A[start_index] * A[start_index+1] * A[start_index+2];
}
int ans = INT_MAX;
for (int i = start_index+1; i < end_index; i++) {
int current = A[start_index] * A[i] * A[end_index];
current += dfs(A, cache, start_index, i);
current += dfs(A, cache, i, end_index);
ans = min(ans, current);
}
return cache[key] = ans;
}
public:
int minScoreTriangulation(vector<int>& A) {
map<pair<int, int>, int> cache;
return dfs(A, cache, 0, A.size() - 1);
}
};
================================================
FILE: cpp/1001-10000/1031-1040/Moving Stones Until Consecutive.cpp
================================================
class Solution {
public:
vector<int> numMovesStones(int a, int b, int c) {
vector<int> v{a,b,c};
sort(v.begin(), v.end());
int maximum_move = v[2] - v[0] - 2;
int d1 = v[1] - v[0];
int d2 = v[2] - v[1];
int minimum_move = 0;
if (d1 == 1 && d2 == 1) return {0, maximum_move};
if (d1 == 1 || d2 == 1 || d1 == 2 || d2 == 2) return {1, maximum_move};
return {2, maximum_move};
}
};
================================================
FILE: cpp/1001-10000/1031-1040/Stream of Characters.cpp
================================================
struct TrieNode {
TrieNode *nodes[26];
bool word;
// Initialize your data structure here.
TrieNode(): word(false) {
memset(nodes, 0, sizeof(nodes));
}
};
class Trie {
public:
Trie() {
root = new TrieNode();
}
// Inserts a word into the trie.
void insert(const string& s) {
TrieNode *tmp = root;
for(char ch : s) {
int index = ch - 'a';
if(tmp->nodes[index] == nullptr) {
tmp->nodes[index] = new TrieNode();
}
tmp = tmp->nodes[index];
}
tmp->word = true;
}
bool eat(char ch) {
vector<TrieNode*> tmp;
if (root->nodes[ch - 'a'] != nullptr) {
tmp.push_back(root->nodes[ch - 'a']);
}
for (TrieNode* node : state) {
if (node->nodes[ch - 'a'] != nullptr) {
tmp.push_back(node->nodes[ch - 'a']);
}
}
swap(state, tmp);
bool return_val = false;
for (TrieNode* node : state) {
if (node->word) {
return_val = true;
break;
}
}
return return_val;
}
private:
TrieNode* root;
vector<TrieNode*> state;
};
class StreamChecker {
Trie trie;
public:
StreamChecker(vector<string>& words) {
for (const string& word : words) {
trie.insert(word);
}
}
bool query(char letter) {
return trie.eat(letter);
}
};
/**
* Your StreamChecker object will be instantiated and called as such:
* StreamChecker* obj = new StreamChecker(words);
* bool param_1 = obj->query(letter);
*/
================================================
FILE: cpp/1001-10000/1031-1040/Uncrossed Lines.cpp
================================================
class Solution {
public:
int maxUncrossedLines(vector<int>& A, vector<int>& B) {
int m = A.size();
int n = B.size();
vector<vector<int>> dp(m+1, vector<int>(n+1, 0));
for (int i = 1; i <= m; i++) {
for (int j = 1; j <= n; j++) {
if (A[i-1] == B[j-1]) {
dp[i][j] = 1 + dp[i-1][j-1];
} else {
dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
}
}
}
return dp[m][n];
}
};
================================================
FILE: cpp/1001-10000/1031-1040/Valid Boomerang.cpp
================================================
class Solution {
public:
bool isBoomerang(vector<vector<int>>& points) {
sort(points.begin(), points.end());
if (points[0] == points[1] || points[1] == points[2]) return false;
int x1 = points[1][0] - points[0][0];
int y1 = points[1][1] - points[0][1];
int x2 = points[2][0] - points[1][0];
int y2 = points[2][1] - points[1][1];
if (x1 == 0 || x2 == 0) {
return x1 != 0 || x2 != 0;
}
return fabs(1.0*y1/x1 - 1.0*y2/x2) > 10e-5;
}
};
================================================
FILE: cpp/1001-10000/1041-1050/Flower Planting With No Adjacent.cpp
================================================
class Solution {
vector<int> colors;
void dfs(int u, map<int, vector<int>>& edges) {
vector<int> neighbors = edges[u];
set<int> excluded_colors;
for (int neighbor : neighbors) {
if (colors[neighbor-1] > 0) {
excluded_colors.insert(colors[neighbor-1]);
}
}
for (int i = 1; i <= 4; i++) {
if (excluded_colors.count(i) == 0) {
colors[u-1] = i;
for (int neighbor : neighbors) {
if (colors[neighbor-1] == 0) {
dfs(neighbor, edges);
}
}
break;
}
}
}
public:
vector<int> gardenNoAdj(int N, vector<vector<int>>& paths) {
map<int, vector<int>> edges;
for (const vector<int>& path : paths) {
edges[path[0]].push_back(path[1]);
edges[path[1]].push_back(path[0]);
}
colors.resize(N, 0);
for (int garden = 1; garden <= N; garden++) {
if (colors[garden - 1] == 0) {
dfs(garden, edges);
}
}
return colors;
}
};
================================================
FILE: cpp/1001-10000/1041-1050/Last Stone Weight II.cpp
================================================
class Solution {
public:
int lastStoneWeightII(vector<int>& stones) {
int sum = 0;
bool dp[1501] = {false};
dp[0] = true;
for (int v : stones) {
sum += v;
for (int start = sum; start >= v; start--) {
// we need to start from back to make it not affected by itself
dp[start] = dp[start] | dp[start-v];
}
}
for (int i = sum/2; i > 0; i--) {
if (dp[i] == true) {
return sum - 2 * i;
}
}
return 0;
}
};
================================================
FILE: cpp/1001-10000/1041-1050/Last Stone Weight.cpp
================================================
class Solution {
public:
int lastStoneWeight(vector<int>& stones) {
std::priority_queue<int, std::vector<int>, std::less<int> >
myqueue (stones.begin(), stones.end());
while (myqueue.size() > 1) {
int v1 = myqueue.top();
myqueue.pop();
int v2 = myqueue.top();
myqueue.pop();
int v = abs(v1 - v2);
if (v > 0) myqueue.push(v);
}
return myqueue.empty() ? 0 : myqueue.top();
}
};
================================================
FILE: cpp/1001-10000/1041-1050/Longest String Chain.cpp
================================================
class Solution {
int dfs(const string& word, const unordered_set<string>& dictionary, unordered_map<string, int>& cache) {
unordered_map<string, int>::iterator it = cache.find(word);
if (it != cache.end()) {
return it->second;
}
int ans = 1;
for (int i = 0; i < word.size(); i++) {
string c_word = word.substr(0, i) + word.substr(i+1);
if (dictionary.count(c_word) > 0) {
ans = max(ans, 1 + dfs(c_word, dictionary, cache));
}
}
return cache[word] = ans;
}
public:
int longestStrChain(vector<string>& words) {
unordered_set<string> dictionary(begin(words), end(words));
unordered_map<string, int> cache;
int ans = 1;
for (const string& word : words) {
ans = max(ans, dfs(word, dictionary, cache));
}
return ans;
}
};
================================================
FILE: cpp/1001-10000/1041-1050/Partition Array for Maximum Sum.cpp
================================================
class Solution {
public:
int maxSumAfterPartitioning(vector<int>& A, int K) {
vector<int> dp(A.size()+1, 0);
for (int i = 0; i < A.size(); i++) {
int p_i = max(-1, i - K);
int maximum_i_sum = 0;
int temp_max = -1;
int n_elements = 0;
for (int j = i; j > p_i; j--) {
n_elements++;
temp_max = max(temp_max, A[j]);
maximum_i_sum = max(maximum_i_sum, dp[j] + n_elements * temp_max);
}
dp[i+1] = maximum_i_sum;
}
return dp.back();
}
};
================================================
FILE: cpp/1001-10000/1041-1050/Remove All Adjacent Duplicates In String.cpp
================================================
class Solution {
public:
string removeDuplicates(string S) {
int i = 0;
for (char ch : S) {
if (i != 0 && ch == S[i-1]) {
i--;
} else {
S[i] = ch;
i++;
}
}
return S.substr(0, i);
}
};
================================================
FILE: cpp/1001-10000/1041-1050/Robot Bounded In Circle.cpp
================================================
class Solution {
pair<int, int> getNextDirection(pair<int, int> d, char ch) {
if (ch == 'L') {
if (d.first == 0 && d.second == 1) {
return {-1, 0};
}
if (d.first == -1 && d.second == 0) {
return {0, -1};
}
if (d.first == 0 && d.second == -1) {
return {1, 0};
}
if (d.first == 1 && d.second == 0) {
return {0, 1};
}
} else {
if (d.first == 0 && d.second == 1) {
return {1, 0};
}
if (d.first == 1 && d.second == 0) {
return {0, -1};
}
if (d.first == 0 && d.second == -1) {
return {-1, 0};
}
if (d.first == -1 && d.second == 0) {
return {0, 1};
}
}
return {0, 0};
}
string GetKey(int x, int y, pair<int, int> d) {
return to_string(x) + '-' + to_string(y) + '-' + to_string(d.first) + '-' + to_string(d.second);
}
public:
bool isRobotBounded(string instructions) {
pair<int, int> d = {0, 1};
int x = 0, y = 0;
for (char ch : instructions) {
if (ch == 'G') {
x += d.first;
y += d.second;
} else {
d = getNextDirection(d, ch);
}
}
if (x == 0 && y == 0) return true;
if (d.first == 0 && d.second == 1) return false;
return true;
}
};
==================
gitextract_k9u05cp_/
├── .gitignore
├── LICENSE
├── README.md
├── Solve the Equation.cpp
├── TODO
├── cpp/
│ ├── 001-010/
│ │ ├── Add Two Numbers.cpp
│ │ ├── Longest Palindromic Substring.cpp
│ │ ├── Longest Substring Without Repeating Characters.cpp
│ │ ├── Median of Two Sorted Arrays.cpp
│ │ ├── Palindrome Number.cpp
│ │ ├── Regular Expression Matching.cpp
│ │ ├── Reverse Integer.cpp
│ │ ├── String to Integer (atoi).cpp
│ │ ├── Two Sum.cpp
│ │ └── ZigZag Conversion.cpp
│ ├── 011-020/
│ │ ├── 3Sum Closest.cpp
│ │ ├── 3Sum.cpp
│ │ ├── 4Sum.cpp
│ │ ├── Container With Most Water.cpp
│ │ ├── Integer to Roman.cpp
│ │ ├── Letter Combinations of a Phone Number.cpp
│ │ ├── Longest Common Prefix.cpp
│ │ ├── Remove Nth Node From End of List.cpp
│ │ ├── Roman to Integer.cpp
│ │ └── Valid Parentheses.cpp
│ ├── 021-030/
│ │ ├── Divide Two Integers.cpp
│ │ ├── Generate Parentheses.cpp
│ │ ├── Implement strStr().cpp
│ │ ├── Merge Two Sorted Lists.cpp
│ │ ├── Merge k Sorted Lists.cpp
│ │ ├── Remove Duplicates from Sorted Array.cpp
│ │ ├── Remove Element.cpp
│ │ ├── Reverse Nodes in k-Group.cpp
│ │ ├── Substring with Concatenation of All Words.cpp
│ │ └── Swap Nodes in Pairs.cpp
│ ├── 031-040/
│ │ ├── Combination Sum II.cpp
│ │ ├── Combination Sum.cpp
│ │ ├── Count and Say.cpp
│ │ ├── Longest Valid Parentheses.cpp
│ │ ├── Next Permutation.cpp
│ │ ├── Search Insert Position.cpp
│ │ ├── Search for a Range.cpp
│ │ ├── Search in Rotated Sorted Array.cpp
│ │ ├── Sudoku Solver.cpp
│ │ └── Valid Sudoku.cpp
│ ├── 041-050/
│ │ ├── First Missing Positive.cpp
│ │ ├── Group Anagrams.cpp
│ │ ├── Jump Game II.cpp
│ │ ├── Multiply Strings.cpp
│ │ ├── Permutations II.cpp
│ │ ├── Permutations.cpp
│ │ ├── Pow.cpp
│ │ ├── Rotate Image.cpp
│ │ ├── Trapping Rain Water.cpp
│ │ └── Wildcard Matching.cpp
│ ├── 051-060/
│ │ ├── Insert Interval.cpp
│ │ ├── Jump Game.cpp
│ │ ├── Length of Last Word.cpp
│ │ ├── Maximum_Subarray.cpp
│ │ ├── Merge Intervals.cpp
│ │ ├── N-Queens II.cpp
│ │ ├── N-Queens.cpp
│ │ ├── Permutation Sequence.cpp
│ │ ├── Spiral Matrix II.cpp
│ │ └── Spiral Matrix.cpp
│ ├── 061-070/
│ │ ├── Add Binary.cpp
│ │ ├── Climbing Stairs.cpp
│ │ ├── Minimum Path Sum .cpp
│ │ ├── Plus One.cpp
│ │ ├── Rotate List.cpp
│ │ ├── Sqrt.cpp
│ │ ├── Text Justification.cpp
│ │ ├── Unique Paths II .cpp
│ │ ├── Unique Paths.cpp
│ │ └── Valid Number.cpp
│ ├── 071-080/
│ │ ├── Combinations.cpp
│ │ ├── Edit Distance.cpp
│ │ ├── Minimum Window Substring.cpp
│ │ ├── Remove Duplicates from Sorted Array II.cpp
│ │ ├── Search a 2D Matrix.cpp
│ │ ├── Set Matrix Zeroes.cpp
│ │ ├── Simplify Path.cpp
│ │ ├── Sort Colors.cpp
│ │ ├── Subsets.cpp
│ │ └── Word Search.cpp
│ ├── 081-090/
│ │ ├── Gray Code.cpp
│ │ ├── Largest Rectangle in Histogram.cpp
│ │ ├── Maximal Rectangle.cpp
│ │ ├── Merge Sorted Array.cpp
│ │ ├── Partition List.cpp
│ │ ├── Remove Duplicates from Sorted List II.cpp
│ │ ├── Remove Duplicates from Sorted List.cpp
│ │ ├── Scramble String.cpp
│ │ ├── Search in Rotated Sorted Array II.cpp
│ │ └── Subsets II.cpp
│ ├── 091-100/
│ │ ├── Binary Tree Inorder Traversal.cpp
│ │ ├── Decode Ways.cpp
│ │ ├── Interleaving String.cpp
│ │ ├── Recover Binary Search Tree.cpp
│ │ ├── Restore IP Addresses.cpp
│ │ ├── Reverse Linked List II.cpp
│ │ ├── Same Tree.cpp
│ │ ├── Unique Binary Search Trees II.cpp
│ │ ├── Unique Binary Search Trees.cpp
│ │ └── Validate Binary Search Tree.cpp
│ ├── 1001-10000/
│ │ ├── 1001-1010/
│ │ │ └── Construct Binary Search Tree from Preorder Traversal.cpp
│ │ ├── 1011-1020/
│ │ │ ├── Best Sightseeing Pair.cpp
│ │ │ ├── Binary Prefix Divisible By 5.cpp
│ │ │ ├── Binary String With Substrings Representing 1 To N.cpp
│ │ │ ├── Convert to Base -2.cpp
│ │ │ ├── Next Greater Node In Linked List.cpp
│ │ │ ├── Number of Enclaves.cpp
│ │ │ └── Partition Array Into Three Parts With Equal Sum.cpp
│ │ ├── 1021-1030/
│ │ │ ├── Camelcase Matching.cpp
│ │ │ ├── Divisor Game.cpp
│ │ │ ├── Longest Arithmetic Sequence.cpp
│ │ │ ├── Matrix Cells in Distance Order.cpp
│ │ │ ├── Maximum Difference Between Node and Ancestor.cpp
│ │ │ ├── Recover a Tree From Preorder Traversal.cpp
│ │ │ ├── Remove Outermost Parentheses.cpp
│ │ │ ├── Sum of Root To Leaf Binary Numbers.cpp
│ │ │ ├── Two City Scheduling.cpp
│ │ │ └── Video Stitching.cpp
│ │ ├── 1031-1040/
│ │ │ ├── Binary Search Tree to Greater Sum Tree.cpp
│ │ │ ├── Coloring A Border.cpp
│ │ │ ├── Escape a Large Maze.cpp
│ │ │ ├── Maximum Sum of Two Non-Overlapping Subarrays.cpp
│ │ │ ├── Minimum Score Triangulation of Polygon.cpp
│ │ │ ├── Moving Stones Until Consecutive.cpp
│ │ │ ├── Stream of Characters.cpp
│ │ │ ├── Uncrossed Lines.cpp
│ │ │ └── Valid Boomerang.cpp
│ │ ├── 1041-1050/
│ │ │ ├── Flower Planting With No Adjacent.cpp
│ │ │ ├── Last Stone Weight II.cpp
│ │ │ ├── Last Stone Weight.cpp
│ │ │ ├── Longest String Chain.cpp
│ │ │ ├── Partition Array for Maximum Sum.cpp
│ │ │ ├── Remove All Adjacent Duplicates In String.cpp
│ │ │ └── Robot Bounded In Circle.cpp
│ │ ├── 1051-1060/
│ │ │ ├── Distant Barcodes.cpp
│ │ │ ├── Grumpy Bookstore Owner.cpp
│ │ │ ├── Height Checker.cpp
│ │ │ └── Previous Permutation With One Swap.cpp
│ │ ├── 1071-1080/
│ │ │ ├── Adding Two Negabinary Numbers.cpp
│ │ │ ├── Flip Columns For Maximum Number of Equal Rows.cpp
│ │ │ ├── Greatest Common Divisor of Strings.cpp
│ │ │ ├── Insufficient Nodes in Root to Leaf Paths.cpp
│ │ │ ├── Letter Tile Possibilities.cpp
│ │ │ ├── Number of Submatrices That Sum to Target.cpp
│ │ │ └── Occurrences After Bigram.cpp
│ │ ├── 1081-1090/
│ │ │ ├── Duplicate Zeros.cpp
│ │ │ ├── Largest Values From Labels.cpp
│ │ │ └── Smallest Subsequence of Distinct Characters.cpp
│ │ ├── 1091-1100/
│ │ │ ├── Brace Expansion II.cpp
│ │ │ ├── Car Pooling.cpp
│ │ │ ├── Find in Mountain Array.cpp
│ │ │ ├── Shortest Common Supersequence.cpp
│ │ │ ├── Shortest Path in Binary Matrix.cpp
│ │ │ ├── Statistics from a Large Sample.cpp
│ │ │ └── Two Sum Less Than K.cpp
│ │ ├── 1101-1110/
│ │ │ ├── Corporate Flight Bookings.cpp
│ │ │ ├── Defanging an IP Address.cpp
│ │ │ ├── Delete Nodes And Return Forest.cpp
│ │ │ ├── Distribute Candies to People.cpp
│ │ │ ├── Filling Bookcase Shelves.cpp
│ │ │ ├── Parsing A Boolean Expression.cpp
│ │ │ └── Path In Zigzag Labelled Binary Tree.cpp
│ │ ├── 1111-1120/
│ │ │ ├── Maximum Nesting Depth of Two Valid Parentheses Strings.cpp
│ │ │ ├── Print FooBar Alternately.cpp
│ │ │ └── Print in Order.cpp
│ │ ├── 1121-1130/
│ │ │ ├── Lowest Common Ancestor of Deepest Leaves.cpp
│ │ │ ├── Minimum Cost Tree From Leaf Values.cpp
│ │ │ ├── Number of Equivalent Domino Pairs.cpp
│ │ │ ├── Relative Sort Array.cpp
│ │ │ └── Smallest Sufficient Team.cpp
│ │ ├── 1131-1140/
│ │ │ └── N-th Tribonacci Number.cpp
│ │ ├── 1141-1150/
│ │ │ ├── Binary Tree Coloring Game.cpp
│ │ │ ├── Decrease Elements To Make Array Zigzag.cpp
│ │ │ ├── Longest Chunked Palindrome Decomposition.cpp
│ │ │ ├── Longest Common Subsequence.cpp
│ │ │ └── Snapshot Array.cpp
│ │ ├── 1151-1160/
│ │ │ ├── Day of the Year.cpp
│ │ │ ├── Find Words That Can Be Formed by Characters.cpp
│ │ │ └── Number of Dice Rolls With Target Sum.cpp
│ │ ├── 1161-1170/
│ │ │ ├── As Far from Land as Possible.cpp
│ │ │ ├── Compare Strings by Frequency of the Smallest Character.cpp
│ │ │ ├── Design File System.cpp
│ │ │ ├── Invalid Transactions.cpp
│ │ │ ├── Maximum Level Sum of a Binary Tree.cpp
│ │ │ ├── Minimum Cost to Connect Sticks.cpp
│ │ │ ├── Optimize Water Distribution in a Village.cpp
│ │ │ └── Single-Row Keyboard.cpp
│ │ ├── 1171-1180/
│ │ │ ├── Can Make Palindrome from Substring.cpp
│ │ │ ├── Count Substrings with Only One Distinct Letter.cpp
│ │ │ ├── Diet Plan Performance.cpp
│ │ │ ├── Dinner Plate Stacks.cpp
│ │ │ ├── Prime Arrangements.cpp
│ │ │ └── Remove Zero Sum Consecutive Nodes from Linked List.cpp
│ │ ├── 1181-1190/
│ │ │ ├── Before and After Puzzle.cpp
│ │ │ ├── Day of the Week.cpp
│ │ │ ├── Design Bounded Blocking Queue.cpp
│ │ │ ├── Distance Between Bus Stops.cpp
│ │ │ ├── Make Array Strictly Increasing.cpp
│ │ │ ├── Maximum Subarray Sum with One Deletion.cpp
│ │ │ └── Shortest Distance to Target Color.cpp
│ │ ├── 1191-1200/
│ │ │ └── Minimum Knight Moves.cpp
│ │ ├── 1201-1210/
│ │ │ ├── Design Skiplist.cpp
│ │ │ └── Smallest String With Swaps.cpp
│ │ ├── 1221-1230/
│ │ │ ├── Dice Roll Simulation.cpp
│ │ │ ├── Queens That Can Attack the King.cpp
│ │ │ └── Split a String in Balanced Strings.cpp
│ │ ├── 1231-1240/
│ │ │ ├── Maximum Profit in Job Scheduling.cpp
│ │ │ └── Replace the Substring for Balanced String.cpp
│ │ ├── 1241-1250/
│ │ │ ├── Minimum Remove to Make Valid Parentheses.cpp
│ │ │ └── Web Crawler Multithreaded.cpp
│ │ ├── 1261-1270/
│ │ │ └── Greatest Sum Divisible by Three.cpp
│ │ ├── 1281-1290/
│ │ │ ├── Convert Binary Number in a Linked List to Integer.cpp
│ │ │ ├── Element Appearing More Than 25% In Sorted Array.cpp
│ │ │ └── Remove Covered Intervals.cpp
│ │ ├── 1291-1300/
│ │ │ ├── Maximum Side Length of a Square with Sum Less than or Equal to Threshold.cpp
│ │ │ └── Sequential Digits.cpp
│ │ ├── 1311-1320/
│ │ │ └── Minimum Distance to Type a Word Using Two Fingers.cpp
│ │ ├── 1411-1420/
│ │ │ └── Minimum Value to Get Positive Step by Step Sum.cpp
│ │ ├── 1421-1430/
│ │ │ └── Leftmost Column with at Least a One.cpp
│ │ ├── 1481-1490/
│ │ │ ├── Avoid Flood in The City.cpp
│ │ │ ├── Find Critical and Pseudo-Critical Edges in Minimum Spanning Tree.cpp
│ │ │ ├── Making File Names Unique.cpp
│ │ │ └── XOR Operation in an Array.cpp
│ │ ├── 1501-1510/
│ │ │ └── Stone Game IV.cpp
│ │ ├── 1541-1550/
│ │ │ └── Minimum Insertions to Balance a Parentheses String.cpp
│ │ ├── 1561-1570/
│ │ │ └── Dot Product of Two Sparse Vectors.cpp
│ │ ├── 1621-1630/
│ │ │ ├── Arithmetic Subarrays.cpp
│ │ │ └── Slowest Key.cpp
│ │ ├── 1631-1640/
│ │ │ ├── Check Array Formation Through Concatenation.cpp
│ │ │ ├── Number of Ways to Form a Target String Given a Dictionary.cpp
│ │ │ ├── Path With Minimum Effort.cpp
│ │ │ └── Rank Transform of a Matrix.cpp
│ │ ├── 1641-1650/
│ │ │ ├── Count Sorted Vowel Strings.cpp
│ │ │ ├── Create Sorted Array through Instructions.cpp
│ │ │ ├── Furthest Building You Can Reach.cpp
│ │ │ ├── Get Maximum in Generated Array.cpp
│ │ │ ├── Kth Smallest Instructions.cpp
│ │ │ ├── Lowest Common Ancestor of a Binary Tree II.cpp
│ │ │ ├── Lowest Common Ancestor of a Binary Tree III.cpp
│ │ │ ├── Minimum Deletions to Make Character Frequencies Unique.cpp
│ │ │ └── Sell Diminishing-Valued Colored Balls.cpp
│ │ ├── 1671-1680/
│ │ │ ├── Lowest Common Ancestor of a Binary Tree IV.cpp
│ │ │ └── Minimum Moves to Make Array Complementary.cpp
│ │ ├── 1681-1690/
│ │ │ ├── Delivering Boxes from Storage to Ports.cpp
│ │ │ ├── Stone Game VI.cpp
│ │ │ └── Sum of Absolute Differences in a Sorted Array.cpp
│ │ ├── 1701-1710/
│ │ │ ├── Determine if String Halves Are Alike.cpp
│ │ │ ├── Maximum Number of Eaten Apples.cpp
│ │ │ ├── Maximum Units on a Truck.cpp
│ │ │ ├── Maximum XOR With an Element From Array.cpp
│ │ │ └── Where Will the Ball Fall.cpp
│ │ ├── 1711-1720/
│ │ │ ├── Count Good Meals.cpp
│ │ │ ├── Decode XORed Array.cpp
│ │ │ ├── Minimum Operations to Make a Subsequence.cpp
│ │ │ └── Ways to Split Array Into Three Subarrays.cpp
│ │ ├── 1721-1730/
│ │ │ ├── Find Minimum Time to Finish All Jobs.cpp
│ │ │ ├── Largest Submatrix With Rearrangements.cpp
│ │ │ ├── Minimize Hamming Distance After Swap Operations.cpp
│ │ │ ├── Number Of Rectangles That Can Form The Largest Square.cpp
│ │ │ ├── Swapping Nodes in a Linked List.cpp
│ │ │ └── Tuple with Same Product.cpp
│ │ ├── 1731-1740/
│ │ │ └── Building Boxes.cpp
│ │ ├── 1751-1760/
│ │ │ ├── Closest Subsequence Sum.cpp
│ │ │ ├── Largest Merge Of Two Strings.cpp
│ │ │ ├── Maximum Number of Events That Can Be Attended II.cpp
│ │ │ └── Minimum Limit of Balls in a Bag.cpp
│ │ ├── 1761-1770/
│ │ │ ├── Form Array by Concatenating Subarrays of Another Array.cpp
│ │ │ ├── Map of Highest Peak.cpp
│ │ │ ├── Maximum Score from Performing Multiplication Operations.cpp
│ │ │ ├── Minimum Degree of a Connected Trio in a Graph.cpp
│ │ │ └── Tree of Coprimes.cpp
│ │ ├── 1771-1780/
│ │ │ ├── Car Fleet II.cpp
│ │ │ ├── Check if Number is a Sum of Powers of Three.cpp
│ │ │ ├── Closest Dessert Cost.cpp
│ │ │ ├── Equal Sum Arrays With Minimum Number of Operations.cpp
│ │ │ ├── Find Nearest Point That Has the Same X or Y Coordinate.cpp
│ │ │ ├── Maximize Palindrome Length From Subsequences.cpp
│ │ │ └── Shortest Path in a Hidden Grid.cpp
│ │ ├── 1781-1790/
│ │ │ ├── Check if Binary String Has at Most One Segment of Ones.cpp
│ │ │ ├── Check if One String Swap Can Make Strings Equal.cpp
│ │ │ ├── Count Pairs Of Nodes.cpp
│ │ │ ├── Make the XOR of All Segments Equal to Zero.cpp
│ │ │ ├── Maximize the Beauty of the Garden.cpp
│ │ │ ├── Minimum Elements to Add to Form a Given Sum.cpp
│ │ │ ├── Number of Restricted Paths From First to Last Node.cpp
│ │ │ └── Sum of Beauty of All Substrings.cpp
│ │ ├── 1791-1800/
│ │ │ ├── Count Pairs of Equal Substrings With Minimum Difference.cpp
│ │ │ ├── Design Authentication Manager.cpp
│ │ │ ├── Find Center of Star Graph.cpp
│ │ │ ├── Maximize Score After N Operations.cpp
│ │ │ ├── Maximum Ascending Subarray Sum.cpp
│ │ │ ├── Maximum Average Pass Ratio.cpp
│ │ │ ├── Maximum Number of Consecutive Values You Can Make.cpp
│ │ │ ├── Maximum Score of a Good Subarray.cpp
│ │ │ └── Second Largest Digit in a String.cpp
│ │ ├── 1801-1810/
│ │ │ ├── Count Pairs With XOR in a Range.cpp
│ │ │ ├── Evaluate the Bracket Pairs of a String.cpp
│ │ │ ├── Implement Trie II (Prefix Tree).cpp
│ │ │ ├── Maximize Number of Nice Divisors.cpp
│ │ │ ├── Maximum Value at a Given Index in a Bounded Array.cpp
│ │ │ ├── Minimum Path Cost in a Hidden Grid.cpp
│ │ │ ├── Number of Different Integers in a String.cpp
│ │ │ └── Number of Orders in the Backlog.cpp
│ │ ├── 1811-1820/
│ │ │ ├── Count Nice Pairs in an Array.cpp
│ │ │ ├── Determine Color of a Chessboard Square.cpp
│ │ │ ├── Finding the Users Active Minutes.cpp
│ │ │ ├── Maximum Number of Accepted Invitations.cpp
│ │ │ ├── Maximum Number of Groups Getting Fresh Donuts.cpp
│ │ │ ├── Minimum Absolute Sum Difference.cpp
│ │ │ ├── Number of Different Subsequences GCDs.cpp
│ │ │ ├── Sentence Similarity III.cpp
│ │ │ └── Truncate Sentence.cpp
│ │ ├── 1821-1830/
│ │ │ ├── Faulty Sensor.cpp
│ │ │ ├── Finding MK Average.cpp
│ │ │ ├── Maximum XOR for Each Query.cpp
│ │ │ ├── Minimum Number of Operations to Make String Sorted.cpp
│ │ │ ├── Minimum Operations to Make the Array Increasing.cpp
│ │ │ ├── Minimum Sideway Jumps.cpp
│ │ │ ├── Queries on Number of Points Inside a Circle.cpp
│ │ │ └── Sign of the Product of an Array.cpp
│ │ ├── 1831-1840/
│ │ │ ├── Check if the Sentence Is Pangram.cpp
│ │ │ ├── Find XOR Sum of All Pairs Bitwise AND.cpp
│ │ │ ├── Longest Substring Of All Vowels in Order.cpp
│ │ │ ├── Maximum Building Height.cpp
│ │ │ ├── Maximum Ice Cream Bars.cpp
│ │ │ ├── Remove Duplicates From an Unsorted Linked List.cpp
│ │ │ ├── Single-Threaded CPU.cpp
│ │ │ └── Sum of Digits in Base K.cpp
│ │ ├── 1841-1850/
│ │ │ ├── Closest Room.cpp
│ │ │ └── Minimum Adjacent Swaps to Reach the Kth Smallest Number.cpp
│ │ └── 1851-1860/
│ │ └── Minimum Interval to Include Each Query.cpp
│ ├── 101-110/
│ │ ├── Balanced Binary Tree.cpp
│ │ ├── Binary Tree Level Order Traversal II.cpp
│ │ ├── Binary Tree Level Order Traversal.cpp
│ │ ├── Binary Tree Zigzag Level Order Traversal.cpp
│ │ ├── Construct Binary Tree from Inorder and Postorder Traversal.cpp
│ │ ├── Construct Binary Tree from Preorder and Inorder Traversal.cpp
│ │ ├── Convert Sorted Array to Binary Search Tree.cpp
│ │ ├── Convert Sorted List to Binary Search Tree.cpp
│ │ ├── Maximum Depth of Binary Tree.cpp
│ │ └── Symmetric Tree.cpp
│ ├── 111-120/
│ │ ├── Distinct Subsequences.cpp
│ │ ├── Flatten Binary Tree to Linked List.cpp
│ │ ├── Minimum Depth of Binary Tree.cpp
│ │ ├── Pascal's Triangle II.cpp
│ │ ├── Pascal's Triangle.cpp
│ │ ├── Path Sum II.cpp
│ │ ├── Path Sum.cpp
│ │ ├── Populating Next Right Pointers in Each Node II.cpp
│ │ ├── Populating Next Right Pointers in Each Node.cpp
│ │ └── Triangle.cpp
│ ├── 121-130/
│ │ ├── Best Time to Buy and Sell Stock II.cpp
│ │ ├── Best Time to Buy and Sell Stock III.cpp
│ │ ├── Best Time to Buy and Sell Stock.cpp
│ │ ├── Binary Tree Maximum Path Sum.cpp
│ │ ├── Longest Consecutive Sequence.cpp
│ │ ├── Sum Root to Leaf Numbers.cpp
│ │ ├── Surrounded Regions.cpp
│ │ ├── Valid Palindrome.cpp
│ │ ├── Word Ladder II.cpp
│ │ └── Word Ladder.cpp
│ ├── 131-140/
│ │ ├── Candy.cpp
│ │ ├── Clone Graph.cpp
│ │ ├── Copy List with Random Pointer.cpp
│ │ ├── Gas Station.cpp
│ │ ├── Palindrome Partitioning II.cpp
│ │ ├── Palindrome Partitioning.cpp
│ │ ├── Single Number II.cpp
│ │ ├── Single Number.cpp
│ │ ├── Word Break II.cpp
│ │ └── Word Break.cpp
│ ├── 141-150/
│ │ ├── Binary Tree Postorder Traversal.cpp
│ │ ├── Evaluate Reverse Polish Notation.cpp
│ │ ├── Insertion Sort List.cpp
│ │ ├── LRU Cache.cpp
│ │ ├── Linked List Cycle II.cpp
│ │ ├── Linked List Cycle.cpp
│ │ ├── Max Points on a Line.cpp
│ │ ├── Reorder List.cpp
│ │ ├── Sort List.cpp
│ │ └── Tree Preorder Traversal.cpp
│ ├── 151-160/
│ │ ├── Binary Tree Upside Down.cpp
│ │ ├── Find Minimum in Rotated Sorted Array II.cpp
│ │ ├── Find Minimum in Rotated Sorted Array.cpp
│ │ ├── Intersection of Two Linked Lists.cpp
│ │ ├── Longest Substring with At Most Two Distinct Characters.cpp
│ │ ├── Maximum Product Subarray.cpp
│ │ ├── Min Stack.cpp
│ │ ├── Read N Characters Given Read4 II - Call multiple times.cpp
│ │ ├── Read N Characters Given Read4.cpp
│ │ └── Reverse Words in a String.cpp
│ ├── 161-170/
│ │ ├── Compare Version Numbers.cpp
│ │ ├── Excel Sheet Column Title.cpp
│ │ ├── Find Peak Element.cpp
│ │ ├── Fraction to Recurring Decimal.cpp
│ │ ├── Majority Element.cpp
│ │ ├── Maximum Gap.cpp
│ │ ├── Missing Ranges.cpp
│ │ ├── One Edit Distance.cpp
│ │ ├── Two Sum II - Input array is sorted.cpp
│ │ └── Two Sum III - Data structure design.cpp
│ ├── 171-180/
│ │ ├── Binary Search Tree Iterator.cpp
│ │ ├── Dungeon Game.cpp
│ │ ├── Excel Sheet Column Number.cpp
│ │ ├── Factorial Trailing Zeroes.cpp
│ │ └── Largest Number.cpp
│ ├── 181-190/
│ │ ├── Best Time to Buy and Sell Stock IV.cpp
│ │ ├── Repeated DNA Sequences.cpp
│ │ ├── Reverse Bits.cpp
│ │ ├── Reverse Words in a String II.cpp
│ │ └── Rotate Array.cpp
│ ├── 191-200/
│ │ ├── Binary Tree Right Side View.cpp
│ │ ├── House Robber.cpp
│ │ ├── Number of 1 Bits.cpp
│ │ ├── Number of Islands.cpp
│ │ └── Reverse Bits.cpp
│ ├── 201-210/
│ │ ├── Bitwise AND of Numbers Range.cpp
│ │ ├── Count Primes.cpp
│ │ ├── Course Schedule II.cpp
│ │ ├── Course Schedule.cpp
│ │ ├── Happy Number.cpp
│ │ ├── Implement Trie (Prefix Tree).cpp
│ │ ├── Isomorphic Strings.cpp
│ │ ├── Minimum Size Subarray Sum.cpp
│ │ ├── Remove Linked List Elements.cpp
│ │ └── Reverse Linked List.cpp
│ ├── 211-220/
│ │ ├── Add and Search Word - Data structure design.cpp
│ │ ├── Combination Sum III.cpp
│ │ ├── Contains Duplicate II.cpp
│ │ ├── Contains Duplicate III.cpp
│ │ ├── Contains Duplicate.cpp
│ │ ├── House Robber II.cpp
│ │ ├── Kth Largest Element in an Array.cpp
│ │ ├── Shortest Palindrome.cpp
│ │ ├── The Skyline Problem.cpp
│ │ └── Word Search II.cpp
│ ├── 221-230/
│ │ ├── Basic Calculator II.cpp
│ │ ├── Basic Calculator.cpp
│ │ ├── Count Complete Tree Nodes.cpp
│ │ ├── Implement Stack using Queues.cpp
│ │ ├── Invert Binary Tree.cpp
│ │ ├── Kth Smallest Element in a BST.cpp
│ │ ├── Majority Element II.cpp
│ │ ├── Maximal Square.cpp
│ │ ├── Rectangle Area.cpp
│ │ └── Summary Ranges.cpp
│ ├── 231-240/
│ │ ├── Delete Node in a Linked List.cpp
│ │ ├── Implement Queue using Stacks.cpp
│ │ ├── Lowest Common Ancestor of a Binary Search Tree.cpp
│ │ ├── Lowest Common Ancestor of a Binary Tree.cpp
│ │ ├── Number of Digit One.cpp
│ │ ├── Palindrome Linked List.cpp
│ │ ├── Power of Two.cpp
│ │ ├── Product of Array Except Self.cpp
│ │ ├── Search a 2D Matrix II.cpp
│ │ └── Sliding Window Maximum.cpp
│ ├── 241-250/
│ │ ├── Count Univalue Subtrees.cpp
│ │ ├── Different Ways to Add Parentheses.cpp
│ │ ├── Group Shifted Strings.cpp
│ │ ├── Shortest Word Distance II.cpp
│ │ ├── Shortest Word Distance III.cpp
│ │ ├── Shortest Word Distance.cpp
│ │ ├── Strobogrammatic Number II.cpp
│ │ ├── Strobogrammatic Number III.cpp
│ │ ├── Strobogrammatic Number.cpp
│ │ └── Valid Anagram.cpp
│ ├── 251-260/
│ │ ├── 3Sum Smaller.cpp
│ │ ├── Add Digits.cpp
│ │ ├── Binary Tree Paths.cpp
│ │ ├── Factor Combinations.cpp
│ │ ├── Flatten 2D Vector.cpp
│ │ ├── Meeting Rooms II.cpp
│ │ ├── Meeting Rooms.cpp
│ │ ├── Paint House.cpp
│ │ ├── Single Number III.cpp
│ │ └── Verify Preorder Sequence in Binary Search Tree.cpp
│ ├── 261-270/
│ │ ├── Alien Dictionary.cpp
│ │ ├── Closest Binary Search Tree Value.cpp
│ │ ├── Factor Combinations.cpp
│ │ ├── Graph Valid Tree.cpp
│ │ ├── Missing Number.cpp
│ │ ├── Paint House II.cpp
│ │ ├── Palindrome Permutation II.cpp
│ │ ├── Palindrome Permutation.cpp
│ │ ├── Ugly Number II.cpp
│ │ └── Ugly Number.cpp
│ ├── 271-280/
│ │ ├── Closest Binary Search Tree Value II.cpp
│ │ ├── Encode and Decode Strings.cpp
│ │ ├── Find the Celebrity.cpp
│ │ ├── First Bad Version.cpp
│ │ ├── H-Index II.cpp
│ │ ├── H-Index.cpp
│ │ ├── Integer to English Words.cpp
│ │ ├── Paint Fence.cpp
│ │ ├── Perfect Squares.cpp
│ │ └── Wiggle Sort.cpp
│ ├── 281-290/
│ │ ├── Expression Add Operators.cpp
│ │ ├── Find the Duplicate Number.cpp
│ │ ├── Game of Life.cpp
│ │ ├── Inorder Successor in BST.cpp
│ │ ├── Move Zeroes.cpp
│ │ ├── Peeking Iterator.cpp
│ │ ├── Unique Word Abbreviation.cpp
│ │ ├── Walls and Gates.cpp
│ │ ├── Word Pattern.cpp
│ │ └── Zigzag Iterator.cpp
│ ├── 291-300/
│ │ ├── Best Meeting Point.cpp
│ │ ├── Binary Tree Longest Consecutive Sequence.cpp
│ │ ├── Bulls and Cows.cpp
│ │ ├── Find Median from Data Stream.cpp
│ │ ├── Flip Game II.cpp
│ │ ├── Flip Game.cpp
│ │ ├── Longest Increasing Subsequence.cpp
│ │ ├── Nim Game.cpp
│ │ ├── Serialize and Deserialize Binary Tree.cpp
│ │ └── Word Pattern II.cpp
│ ├── 301-310/
│ │ ├── Additive Number.cpp
│ │ ├── Best Time to Buy and Sell Stock with Cooldown.cpp
│ │ ├── Minimum Height Trees.cpp
│ │ ├── Number of Islands II.cpp
│ │ ├── Range Sum Query - Immutable.cpp
│ │ ├── Range Sum Query - Mutable.cpp
│ │ ├── Range Sum Query 2D - Immutable.cpp
│ │ ├── Range Sum Query 2D - Mutable.cpp
│ │ ├── Remove Invalid Parentheses.cpp
│ │ └── Smallest Rectangle Enclosing Black Pixels.cpp
│ ├── 311-320/
│ │ ├── Binary Tree Vertical Order Traversal.cpp
│ │ ├── Bulb Switcher.cpp
│ │ ├── Burst Balloons.cpp
│ │ ├── Count of Smaller Numbers After Self.cpp
│ │ ├── Generalized Abbreviation.cpp
│ │ ├── Maximum Product of Word Lengths.cpp
│ │ ├── Remove Duplicate Letters.cpp
│ │ ├── Shortest Distance from All Buildings.cpp
│ │ ├── Sparse Matrix Multiplication.cpp
│ │ └── Super Ugly Number.cpp
│ ├── 321-330/
│ │ ├── Coin Change.cpp
│ │ ├── Count of Range Sum.cpp
│ │ ├── Create Maximum Number.cpp
│ │ ├── Longest Increasing Path in a Matrix.cpp
│ │ ├── Maximum Size Subarray Sum Equals k.cpp
│ │ ├── Number of Connected Components in an Undirected Graph.cpp
│ │ ├── Odd Even Linked List.cpp
│ │ ├── Patching Array.cpp
│ │ ├── Power of Three.cpp
│ │ └── Wiggle Sort II.cpp
│ ├── 331-340/
│ │ ├── Counting Bits.cpp
│ │ ├── House Robber III.cpp
│ │ ├── Increasing Triplet Subsequence.cpp
│ │ ├── Largest BST Subtree.cpp
│ │ ├── Longest Substring with At Most K Distinct Characters.cpp
│ │ ├── Nested List Weight Sum.cpp
│ │ ├── Palindrome Pairs.cpp
│ │ ├── Reconstruct Itinerary.cpp
│ │ ├── Self Crossing.cpp
│ │ └── Verify Preorder Serialization of a Binary Tree.cpp
│ ├── 341-350/
│ │ ├── Design Tic-Tac-Toe.cpp
│ │ ├── Flatten Nested List Iterator.cpp
│ │ ├── Integer Break.cpp
│ │ ├── Intersection of Two Arrays II.cpp
│ │ ├── Intersection of Two Arrays.cpp
│ │ ├── Moving Average from Data Stream.cpp
│ │ ├── Power of Four.cpp
│ │ ├── Reverse String.cpp
│ │ ├── Reverse Vowels of a String.cpp
│ │ └── Top K Frequent Elements.cpp
│ ├── 351-360/
│ │ ├── Android Unlock Patterns.cpp
│ │ ├── Count Numbers with Unique Digits.cpp
│ │ ├── Data Stream as Disjoint Intervals.cpp
│ │ ├── Design Snake Game.cpp
│ │ ├── Design Twitter.cpp
│ │ ├── Line Reflection.cpp
│ │ ├── Logger Rate Limiter.cpp
│ │ ├── Rearrange String k Distance Apart.cpp
│ │ ├── Russian Doll Envelopes.cpp
│ │ └── Sort Transformed Array.cpp
│ ├── 361-370/
│ │ ├── Bomb Enemy.cpp
│ │ ├── Design Hit Counter.cpp
│ │ ├── Find Leaves of Binary Tree.cpp
│ │ ├── Largest Divisible Subset.cpp
│ │ ├── Max Sum of Rectangle No Larger Than K.cpp
│ │ ├── Nested List Weight Sum II.cpp
│ │ ├── Plus One Linked List.cpp
│ │ ├── Range Addition.cpp
│ │ ├── Valid Perfect Square.cpp
│ │ └── Water and Jug Problem.cpp
│ ├── 371-380/
│ │ ├── Combination Sum IV.cpp
│ │ ├── Design Phone Directory.cpp
│ │ ├── Find K Pairs with Smallest Sums.cpp
│ │ ├── Guess Number Higher or Lower II.cpp
│ │ ├── Guess Number Higher or Lower.cpp
│ │ ├── Insert Delete GetRandom O(1).cpp
│ │ ├── Kth Smallest Element in a Sorted Matrix.cpp
│ │ ├── Sum of Two Integers.cpp
│ │ ├── Super Pow.cpp
│ │ └── Wiggle Subsequence.cpp
│ ├── 381-390/
│ │ ├── Elimination Game.cpp
│ │ ├── Find the Difference.cpp
│ │ ├── First Unique Character in a String.cpp
│ │ ├── Insert Delete GetRandom O(1) - Duplicates allowed.cpp
│ │ ├── Lexicographical Numbers.cpp
│ │ ├── Linked List Random Node.cpp
│ │ ├── Longest Absolute File Path.cpp
│ │ ├── Mini Parser.cpp
│ │ ├── Ransom Note.cpp
│ │ └── Shuffle an Array.cpp
│ ├── 391-400/
│ │ ├── Decode String.cpp
│ │ ├── Evaluate Division.cpp
│ │ ├── Integer Replacement.cpp
│ │ ├── Is Subsequence.cpp
│ │ ├── Longest Substring with At Least K Repeating Characters.cpp
│ │ ├── Nth Digit.cpp
│ │ ├── Perfect Rectangle.cpp
│ │ ├── Random Pick Index.cpp
│ │ ├── Rotate Function.cpp
│ │ └── UTF-8 Validation.cpp
│ ├── 401-410/
│ │ ├── Binary Watch.cpp
│ │ ├── Convert a Number to Hexadecimal.cpp
│ │ ├── Frog Jump.cpp
│ │ ├── Longest Palindrome.cpp
│ │ ├── Queue Reconstruction by Height.cpp
│ │ ├── Remove K Digits.cpp
│ │ ├── Split Array Largest Sum.cpp
│ │ ├── Sum of Left Leaves.cpp
│ │ ├── Trapping Rain Water II.cpp
│ │ └── Valid Word Abbreviation.cpp
│ ├── 411-420/
│ │ ├── Add Strings.cpp
│ │ ├── Arithmetic Slices.cpp
│ │ ├── Battleships in a Board.cpp
│ │ ├── Fizz Buzz.cpp
│ │ ├── Minimum Unique Word Abbreviation.cpp
│ │ ├── Pacific Atlantic Water Flow.cpp
│ │ ├── Partition Equal Subset Sum.cpp
│ │ ├── Sentence Screen Fitting.cpp
│ │ └── Third Maximum Number.cpp
│ ├── 421-430/
│ │ ├── Convert Binary Search Tree to Sorted Doubly Linked List.cpp
│ │ ├── Maximum XOR of Two Numbers in an Array.cpp
│ │ ├── Serialize and Deserialize N-ary Tree.cpp
│ │ ├── Valid Word Square.cpp
│ │ └── Word Squares.cpp
│ ├── 431-440/
│ │ ├── All O`one Data Structure.cpp
│ │ ├── Find All Anagrams in a String.cpp
│ │ ├── Find Right Interval.cpp
│ │ ├── K-th Smallest in Lexicographical Order.cpp
│ │ ├── Minimum Genetic Mutation.cpp
│ │ ├── Number of Segments in a String.cpp
│ │ ├── Path Sum III.cpp
│ │ └── Ternary Expression Parser.cpp
│ ├── 441-450/
│ │ ├── Add Two Numbers II.cpp
│ │ ├── Arithmetic Slices II - Subsequence.cpp
│ │ ├── Arranging Coins.cpp
│ │ ├── Delete Node in a BST.cpp
│ │ ├── Find All Duplicates in an Array.cpp
│ │ ├── Number of Boomerangs.cpp
│ │ ├── Sequence Reconstruction.cpp
│ │ ├── Serialize and Deserialize BST.cpp
│ │ └── String Compression.cpp
│ ├── 451-460/
│ │ ├── 132 Pattern.cpp
│ │ ├── 4Sum II.cpp
│ │ ├── Assign Cookies.cpp
│ │ ├── LFU Cache.cpp
│ │ ├── Minimum Moves to Equal Array Elements.cpp
│ │ ├── Minimum Number of Arrows to Burst Balloons.cpp
│ │ ├── Repeated Substring Pattern.cpp
│ │ └── Sort Characters By Frequency.cpp
│ ├── 461-470/
│ │ ├── Can I Win.cpp
│ │ ├── Convex Polygon.cpp
│ │ ├── Count The Repetitions.cpp
│ │ ├── Hamming Distance.cpp
│ │ ├── Island Perimeter.cpp
│ │ ├── Minimum Moves to Equal Array Elements II.cpp
│ │ ├── Optimal Account Balancing.cpp
│ │ ├── Unique Substrings in Wraparound String.cpp
│ │ └── Validate IP Address.cpp
│ ├── 471-480/
│ │ ├── Concatenated Words.cpp
│ │ ├── Encode String with Shortest Length.cpp
│ │ ├── Heaters.cpp
│ │ ├── Largest Palindrome Product.cpp
│ │ ├── Matchsticks to Square.cpp
│ │ ├── Number Complement.cpp
│ │ ├── Ones and Zeroes.cpp
│ │ ├── Sliding Window Median.cpp
│ │ └── Total Hamming Distance.cpp
│ ├── 481-490/
│ │ ├── Find Permutation.cpp
│ │ ├── License Key Formatting.cpp
│ │ ├── Magical String.cpp
│ │ ├── Max Consecutive Ones II.cpp
│ │ ├── Max Consecutive Ones.cpp
│ │ ├── Predict the Winner.cpp
│ │ ├── Robot Room Cleaner.cpp
│ │ ├── Smallest Good Base.cpp
│ │ ├── The Maze.cpp
│ │ └── Zuma Game.cpp
│ ├── 491-500/
│ │ ├── Construct the Rectangle.cpp
│ │ ├── Diagonal Traverse.cpp
│ │ ├── Increasing Subsequences.cpp
│ │ ├── Keyboard Row.cpp
│ │ ├── Next Greater Element I.cpp
│ │ ├── Reverse Pairs.cpp
│ │ ├── Target Sum.cpp
│ │ ├── Teemo Attacking.cpp
│ │ └── The Maze III.cpp
│ ├── 501-510/
│ │ ├── Base 7.cpp
│ │ ├── Find Mode in Binary Search Tree.cpp
│ │ ├── IPO.cpp
│ │ ├── Most Frequent Subtree Sum.cpp
│ │ ├── Next Greater Element II.cpp
│ │ ├── Perfect Number.cpp
│ │ ├── Relative Ranks.cpp
│ │ └── The Maze II.cpp
│ ├── 511-520/
│ │ ├── Coin Change 2.cpp
│ │ ├── Detect Capital.cpp
│ │ ├── Find Bottom Left Tree Value.cpp
│ │ ├── Find Largest Value in Each Tree Row.cpp
│ │ ├── Freedom Trail.cpp
│ │ ├── Longest Palindromic Subsequence.cpp
│ │ └── Super Washing Machines.cpp
│ ├── 521-530/
│ │ ├── Beautiful Arrangement.cpp
│ │ ├── Contiguous Array.cpp
│ │ ├── Continuous Subarray Sum.cpp
│ │ ├── Longest Uncommon Subsequence I.cpp
│ │ ├── Longest Uncommon Subsequence II.cpp
│ │ ├── Longest Word in Dictionary through Deleting.cpp
│ │ ├── Minimum Distance Between BST Nodes.cpp
│ │ └── Word Abbreviation.cpp
│ ├── 531-540/
│ │ ├── Complex Number Multiplication.cpp
│ │ ├── Convert BST to Greater Tree.cpp
│ │ ├── Encode and Decode TinyURL.cpp
│ │ ├── Lonely Pixel I.cpp
│ │ ├── Lonely Pixel II.cpp
│ │ └── Single Element in a Sorted Array.cpp
│ ├── 541-550/
│ │ ├── 01 Matrix.cpp
│ │ ├── Binary Tree Longest Consecutive Sequence II.cpp
│ │ ├── Boundary of Binary Tree.cpp
│ │ ├── Diameter of Binary Tree.cpp
│ │ ├── Friend Circles.cpp
│ │ ├── Output Contest Matches.cpp
│ │ ├── Reverse String II.cpp
│ │ └── Split Array with Equal Sum.cpp
│ ├── 551-560/
│ │ ├── Brick Wall.cpp
│ │ ├── Next Greater Element III.cpp
│ │ ├── Optimal Division.cpp
│ │ ├── Reverse Words in a String III.cpp
│ │ ├── Split Concatenated Strings.cpp
│ │ ├── Student Attendance Record I.cpp
│ │ ├── Student Attendance Record II.cpp
│ │ └── Subarray Sum Equals K.cpp
│ ├── 561-570/
│ │ ├── Array Nesting.cpp
│ │ ├── Array Partition I.cpp
│ │ ├── Binary Tree Tilt.cpp
│ │ ├── Longest Line of Consecutive One in Matrix.cpp
│ │ ├── Maximum Vacation Days.cpp
│ │ ├── Permutation in String.cpp
│ │ └── Reshape the Matrix.cpp
│ ├── 571-580/
│ │ ├── Distribute Candies.cpp
│ │ ├── Out of Boundary Paths.cpp
│ │ ├── Squirrel Simulation.cpp
│ │ └── Subtree of Another Tree.cpp
│ ├── 581-590/
│ │ ├── Delete Operation for Two Strings.cpp
│ │ ├── Design In-Memory File System.cpp
│ │ ├── Erect the Fence.cpp
│ │ ├── Kill Process.cpp
│ │ └── Shortest Unsorted Continuous Subarray.cpp
│ ├── 591-600/
│ │ ├── Fraction Addition and Subtraction.cpp
│ │ ├── Longest Harmonious Subsequence.cpp
│ │ ├── Minimum Index Sum of Two Lists.cpp
│ │ ├── Non-negative Integers without Consecutive Ones.cpp
│ │ ├── Range Addition II.cpp
│ │ ├── Tag Validator.cpp
│ │ └── Valid Square.cpp
│ ├── 601-610/
│ │ ├── Can Place Flowers.cpp
│ │ ├── Construct String from Binary Tree.cpp
│ │ ├── Design Compressed String Iterator.cpp
│ │ └── Find Duplicate File in System.cpp
│ ├── 611-620/
│ │ ├── Add Bold Tag in String.cpp
│ │ ├── Merge Two Binary Trees.cpp
│ │ └── Valid Triangle Number.cpp
│ ├── 621-630/
│ │ ├── Add One Row to Tree.cpp
│ │ ├── Course Schedule III.cpp
│ │ ├── Design Circular Queue.cpp
│ │ ├── K Inverse Pairs Array.cpp
│ │ ├── Maximum Distance in Arrays.cpp
│ │ ├── Maximum Product of Three Numbers.cpp
│ │ ├── Minimum Factorization.cpp
│ │ └── Task Scheduler.cpp
│ ├── 631-640/
│ │ ├── Average of Levels in Binary Tree.cpp
│ │ ├── Decode Ways II.cpp
│ │ ├── Design Excel Sum Formula.cpp
│ │ ├── Design Log Storage System.cpp
│ │ ├── Exclusive Time of Functions.cpp
│ │ ├── Find the Derangement of An Array.cpp
│ │ ├── Shopping Offers.cpp
│ │ ├── Smallest Range.cpp
│ │ ├── Solve the Equation.cpp
│ │ └── Sum of Square Numbers.cpp
│ ├── 641-650/
│ │ ├── 2 Keys Keyboard.cpp
│ │ ├── Design Search Autocomplete System.cpp
│ │ ├── Dota2 Senate.cpp
│ │ ├── Maximum Average Subarray I.cpp
│ │ ├── Maximum Average Subarray II.cpp
│ │ ├── Maximum Length of Pair Chain.cpp
│ │ ├── Palindromic Substrings.cpp
│ │ ├── Replace Words.cpp
│ │ └── Set Mismatch.cpp
│ ├── 651-660/
│ │ ├── 4 Keys Keyboard.cpp
│ │ ├── Coin Path.cpp
│ │ ├── Find Duplicate Subtrees.cpp
│ │ ├── Find K Closest Elements.cpp
│ │ ├── Judge Route Circle.cpp
│ │ ├── Maximum Binary Tree.cpp
│ │ ├── Print Binary Tree.cpp
│ │ ├── Remove 9.cpp
│ │ ├── Split Array into Consecutive Subsequences.cpp
│ │ └── Two Sum IV - Input is a BST.cpp
│ ├── 661-670/
│ │ ├── Beautiful Arrangement II.cpp
│ │ ├── Equal Tree Partition.cpp
│ │ ├── Image Smoother.cpp
│ │ ├── Kth largest Number in Multiplication Table.cpp
│ │ ├── Maximum Swap.cpp
│ │ ├── Maximum Width of Binary Tree.cpp
│ │ ├── Non-decreasing Array.cpp
│ │ ├── Path Sum IV.cpp
│ │ ├── Strange Printer.cpp
│ │ └── Trim a Binary Search Tree.cpp
│ ├── 671-680/
│ │ ├── 24 Game.cpp
│ │ ├── Cut Off Trees for Golf Event.cpp
│ │ ├── Implement Magic Dictionary.cpp
│ │ ├── Longest Continuous Increasing Subsequence.cpp
│ │ ├── Map Sum Pairs.cpp
│ │ ├── Number of Longest Increasing Subsequence.cpp
│ │ ├── Second Minimum Node In a Binary Tree.cpp
│ │ ├── Valid Palindrome II.cpp
│ │ └── Valid Parenthesis String.cpp
│ ├── 681-690/
│ │ ├── Baseball Game.cpp
│ │ ├── Employee Importance.cpp
│ │ ├── K Empty Slots.cpp
│ │ ├── Knight Probability in Chessboard.cpp
│ │ ├── Longest Univalue Path.cpp
│ │ ├── Maximum Sum of 3 Non-Overlapping Subarrays.cpp
│ │ ├── Next Closest Time.cpp
│ │ ├── Redundant Connection II.cpp
│ │ ├── Redundant Connection.cpp
│ │ └── Repeated String Match.cpp
│ ├── 691-700/
│ │ ├── Binary Number with Alternating Bits.cpp
│ │ ├── Count Binary Substrings.cpp
│ │ ├── Degree of an Array.cpp
│ │ ├── Falling Squares.cpp
│ │ ├── Max Area of Island.cpp
│ │ ├── Number of Distinct Islands.cpp
│ │ ├── Partition to K Equal Sum Subsets.cpp
│ │ └── Top K Frequent Words.cpp
│ ├── 701-710/
│ │ ├── Insert into a Binary Search Tree.cpp
│ │ ├── Random Pick with Blacklist.cpp
│ │ └── To Lower Case.cpp
│ ├── 711-720/
│ │ ├── 1-bit and 2-bit Characters.cpp
│ │ ├── Best Time to Buy and Sell Stock with Transaction Fee.cpp
│ │ ├── Find K-th Smallest Pair Distance.cpp
│ │ ├── Longest Word in Dictionary.cpp
│ │ ├── Max Stack.cpp
│ │ ├── Maximum Length of Repeated Subarray.cpp
│ │ ├── Minimum ASCII Delete Sum for Two Strings.cpp
│ │ ├── Number of Distinct Islands II.cpp
│ │ ├── Range Module.cpp
│ │ └── Subarray Product Less Than K.cpp
│ ├── 721-730/
│ │ ├── Accounts Merge.cpp
│ │ ├── Candy Crush.cpp
│ │ ├── Count Different Palindromic Subsequences.cpp
│ │ ├── Find Pivot Index.cpp
│ │ ├── My Calendar I.cpp
│ │ ├── Number of Atoms.cpp
│ │ ├── Remove Comments.cpp
│ │ ├── Self Dividing Numbers.cpp
│ │ └── Split Linked List in Parts.cpp
│ ├── 731-740/
│ │ ├── Asteroid Collision.cpp
│ │ ├── Daily Temperatures.cpp
│ │ ├── Delete and Earn.cpp
│ │ ├── Flood Fill.cpp
│ │ ├── Monotone Increasing Digits.cpp
│ │ ├── My Calendar II.cpp
│ │ ├── My Calendar III.cpp
│ │ ├── Parse Lisp Expression.cpp
│ │ ├── Sentence Similarity II.cpp
│ │ └── Sentence Similarity.cpp
│ ├── 741-750/
│ │ ├── Closest Leaf in a Binary Tree.cpp
│ │ ├── Find Smallest Letter Greater Than Target.cpp
│ │ ├── Largest Number At Least Twice of Others.cpp
│ │ ├── Min Cost Climbing Stairs.cpp
│ │ ├── Network Delay Time.cpp
│ │ ├── Number Of Corner Rectangles.cpp
│ │ ├── Prefix and Suffix Search.cpp
│ │ └── Shortest Completing Word.cpp
│ ├── 751-760/
│ │ ├── Bold Words in String.cpp
│ │ ├── Cracking the Safe.cpp
│ │ ├── Employee Free Time.cpp
│ │ ├── Find Anagram Mappings.cpp
│ │ ├── IP to CIDR.cpp
│ │ ├── Open the Lock.cpp
│ │ ├── Pour Water.cpp
│ │ ├── Pyramid Transition Matrix.cpp
│ │ ├── Reach a Number.cpp
│ │ └── Set Intersection Size At Least Two.cpp
│ ├── 761-770/
│ │ ├── Couples Holding Hands.cpp
│ │ ├── Largest Plus Sign.cpp
│ │ ├── Max Chunks To Make Sorted II.cpp
│ │ ├── Max Chunks To Make Sorted.cpp
│ │ ├── Partition Labels.cpp
│ │ ├── Prime Number of Set Bits in Binary Representation.cpp
│ │ ├── Reorganize String.cpp
│ │ ├── Special Binary String.cpp
│ │ └── Toeplitz Marix.cpp
│ ├── 771-780/
│ │ ├── Basic Calculator III.cpp
│ │ ├── Global and Local Inversions.cpp
│ │ ├── Jewels and Stones.cpp
│ │ ├── K-th Symbol in Grammar.cpp
│ │ ├── Minimize Max Distance to Gas Station.cpp
│ │ ├── Sliding Puzzle.cpp
│ │ ├── Split BST.cpp
│ │ ├── Swap Adjacent in LR String.cpp
│ │ └── Swim in Rising Water.cpp
│ ├── 781-790/
│ │ ├── Cheapest Flights Within K Stops.cpp
│ │ ├── Escape The Ghosts.cpp
│ │ ├── Is Graph Bipartite?.cpp
│ │ ├── K-th Smallest Prime Fraction.cpp
│ │ ├── Letter Case Permutation.cpp
│ │ ├── Minimum Distance Between BST Nodes.cpp
│ │ ├── Rabbits in Forest.cpp
│ │ ├── Rotated Digits.cpp
│ │ └── Transform to Chessboard.cpp
│ ├── 791-800/
│ │ ├── All Paths From Source to Target.cpp
│ │ ├── Champagne Tower.cpp
│ │ ├── Custom Sort String.cpp
│ │ ├── Number of Matching Subsequences.cpp
│ │ ├── Number of Subarrays with Bounded Maximum.cpp
│ │ ├── Preimage Size of Factorial Zeroes Function.cpp
│ │ ├── Rotate String
│ │ ├── Similar RGB Color.cpp
│ │ └── Valid Tic-Tac-Toe State.cpp
│ ├── 801-810/
│ │ ├── Bricks Falling When Hit.cpp
│ │ ├── Chalkboard XOR Game.cpp
│ │ ├── Expressive Words.cpp
│ │ ├── Find Eventual Safe States.cpp
│ │ ├── Max Increase to Keep City Skyline.cpp
│ │ ├── Minimum Swaps To Make Sequences Increasing.cpp
│ │ ├── Number of Lines To Write String.cpp
│ │ ├── Soup Servings.cpp
│ │ └── Unique Morse Code Words.cpp
│ ├── 811-820/
│ │ ├── Ambiguous Coordinates.cpp
│ │ ├── Binary Tree Pruning.cpp
│ │ ├── Bus Routes.cpp
│ │ ├── Largest Sum of Averages.cpp
│ │ ├── Linked List Components.cpp
│ │ ├── Most Common Word.cpp
│ │ ├── Race Car.cpp
│ │ ├── Short Encoding of Words.cpp
│ │ └── Subdomain Visit Count.cpp
│ ├── 821-830/
│ │ ├── Binary Trees With Factors.cpp
│ │ ├── Card Flipping Game.cpp
│ │ ├── Consecutive Numbers Sum.cpp
│ │ ├── Friends Of Appropriate Ages.cpp
│ │ ├── Goat Latin.cpp
│ │ ├── Making A Large Island.cpp
│ │ ├── Most Profit Assigning Work.cpp
│ │ ├── Positions of Large Groups.cpp
│ │ ├── Shortest Distance to a Character.cpp
│ │ └── Unique Letter String.cpp
│ ├── 831-840/
│ │ ├── Find And Replace in String.cpp
│ │ ├── Flipping an Image.cpp
│ │ ├── Image Overlap.cpp
│ │ ├── Magic Squares In Grid.cpp
│ │ ├── Masking Personal Information.cpp
│ │ ├── New 21 Game.cpp
│ │ ├── Push Dominoes.cpp
│ │ ├── Rectangle Overlap.cpp
│ │ ├── Similar String Groups.cpp
│ │ └── Sum of Distances in Tree.cpp
│ ├── 841-850/
│ │ ├── Backspace String Compare.cpp
│ │ ├── Guess the Word.cpp
│ │ ├── Hand of Straights.cpp
│ │ ├── Keys and Rooms.cpp
│ │ ├── Longest Mountain in Array.cpp
│ │ ├── Maximize Distance to Closest Person.cpp
│ │ ├── Shifting Letters.cpp
│ │ ├── Shortest Path Visiting All Nodes.cpp
│ │ └── Split Array into Fibonacci Sequence.cpp
│ ├── 851-860/
│ │ ├── Buddy Strings.cpp
│ │ ├── Car Fleet.cpp
│ │ ├── Exam Room.cpp
│ │ ├── K-Similar Strings.cpp
│ │ ├── Lemonade Change.cpp
│ │ ├── Loud and Rich.cpp
│ │ ├── Peak Index in a Mountain Array.cpp
│ │ └── Score of Parentheses.cpp
│ ├── 861-870/
│ │ ├── Advantage Shuffle.cpp
│ │ ├── All Nodes Distance K in Binary Tree.cpp
│ │ ├── Binary Gap.cpp
│ │ ├── Prime Palindrome.cpp
│ │ ├── Reordered Power of 2.cpp
│ │ ├── Score After Flipping Matrix.cpp
│ │ ├── Smallest Subtree with all the Deepest Nodes.cpp
│ │ └── Transpose Matrix.cpp
│ ├── 871-880/
│ │ ├── Implement Rand10() Using Rand7().cpp
│ │ ├── Koko Eating Bananas.cpp
│ │ ├── Leaf-Similar Trees.cpp
│ │ ├── Length of Longest Fibonacci Subsequence.cpp
│ │ ├── Middle of the Linked List.cpp
│ │ └── Stone Game.cpp
│ ├── 881-890/
│ │ ├── Boats to Save People.cpp
│ │ ├── Possible Bipartition.cpp
│ │ ├── Projection Area of 3D Shapes.cpp
│ │ └── Uncommon Words from Two Sentences.cpp
│ ├── 891-900/
│ │ └── Maximum Frequency Stack.cpp
│ ├── 911-920/
│ │ ├── Complete Binary Tree Inserter.cpp
│ │ ├── Maximum Sum Circular Subarray.cpp
│ │ ├── Number of Music Playlists.cpp
│ │ ├── Online Election.cpp
│ │ ├── Partition Array into Disjoint Intervals.cpp
│ │ ├── Reverse Only Letters.cpp
│ │ ├── Word Subsets.cpp
│ │ └── X of a Kind in a Deck of Cards.cpp
│ ├── 921-930/
│ │ ├── 3Sum With Multiplicity.cpp
│ │ ├── Binary Subarrays With Sum.cpp
│ │ ├── Flip String to Monotone Increasing.cpp
│ │ ├── Long Pressed Name.cpp
│ │ ├── Minimize Malware Spread.cpp
│ │ ├── Minimum Add to Make Parentheses Valid.cpp
│ │ ├── Sort Array By Parity II.cpp
│ │ ├── Three Equal Parts.cpp
│ │ └── Unique Email Addresses.cpp
│ ├── 931-940/
│ │ ├── Beautiful Array.cpp
│ │ ├── Distinct Subsequences II.cpp
│ │ ├── Knight Dialer.cpp
│ │ ├── Minimum Area Rectangle.cpp
│ │ ├── Minimum Falling Path Sum.cpp
│ │ ├── Number of Recent Calls.cpp
│ │ ├── Range Sum of BST.cpp
│ │ ├── Reorder Log Files.cpp
│ │ ├── Shortest Bridge.cpp
│ │ └── Stamping The Sequence.cpp
│ ├── 941-950/
│ │ ├── Bag of Tokens.cpp
│ │ ├── DI String Match.cpp
│ │ ├── Delete Columns to Make Sorted.cpp
│ │ ├── Minimum Increment to Make Array Unique.cpp
│ │ ├── Most Stones Removed with Same Row or Column.cpp
│ │ ├── Valid Mountain Array.cpp
│ │ └── Validate Stack Sequences.cpp
│ ├── 951-960/
│ │ ├── Check Completeness of a Binary Tree.cpp
│ │ ├── Prison Cells After N Days.cpp
│ │ ├── Regions Cut By Slashes.cpp
│ │ └── Verifying an Alien Dictionary.cpp
│ ├── 961-970/
│ │ ├── N-Repeated Element in Size 2N Array.cpp
│ │ └── Pancake Sorting.cpp
│ ├── 971-980/
│ │ ├── Distribute Coins in Binary Tree.cpp
│ │ ├── K Closest Points to Origin.cpp
│ │ ├── Largest Perimeter Triangle.cpp
│ │ ├── Longest Turbulent Subarray.cpp
│ │ ├── Squares of a Sorted Array.cpp
│ │ ├── Subarray Sums Divisible by K.cpp
│ │ └── Unique Paths III.cpp
│ ├── 981-990/
│ │ ├── Add to Array-Form of Integer.cpp
│ │ ├── Interval List Intersections.cpp
│ │ ├── Satisfiability of Equality Equations.cpp
│ │ ├── String Without AAA or BBB.cpp
│ │ └── Time Based Key-Value Store.cpp
│ └── 991-1000/
│ ├── Broken Calculator.cpp
│ ├── Cousins in Binary Tree.cpp
│ ├── Find the Town Judge.cpp
│ ├── Maximum Binary Tree II.cpp
│ ├── Minimum Number of K Consecutive Bit Flips.cpp
│ ├── Number of Squareful Arrays.cpp
│ └── Rotting Oranges.cpp
├── golang/
│ └── 001-010/
│ ├── Add Two Numbers.go
│ ├── Longest Substring Without Repeating Characters.go
│ └── Two Sum.go
├── java/
│ ├── 201-210/
│ │ └── Happy Number.java
│ ├── 291-300/
│ │ └── Nim Game.java
│ └── 331-340/
│ ├── Counting Bits.java
│ └── Nested List Weight Sum.java
├── python/
│ ├── 001-010/
│ │ └── Median of Two Sorted Arrays.py
│ ├── 011-020/
│ │ └── Valid Parentheses.py
│ ├── 021-030/
│ │ └── Reverse Nodes in k-Group.py
│ ├── 031-040/
│ │ ├── Combination Sum II.py
│ │ ├── Combination Sum.py
│ │ ├── Next Permutation.py
│ │ ├── Search Insert Position.py
│ │ ├── Search for a Range.py
│ │ ├── Sudoku Solver.py
│ │ └── Valid Sudoku.py
│ ├── 041-050/
│ │ ├── Jump Game II.py
│ │ └── Rotate Image.py
│ ├── 051-060/
│ │ ├── Jump Game.py
│ │ └── Permutation Sequence.py
│ ├── 061-070/
│ │ ├── Minimum Path Sum.py
│ │ ├── Sqrt(x).py
│ │ ├── Unique Paths II.py
│ │ ├── Unique Paths.py
│ │ └── Valid Number.py
│ ├── 071-080/
│ │ └── Edit Distance.py
│ ├── 081-090/
│ │ ├── Largest Rectangle in Histogram.py
│ │ ├── Maximal Rectangle.py
│ │ ├── Remove Duplicates from Sorted List II.py
│ │ └── Remove Duplicates from Sorted List.py
│ ├── 091-100/
│ │ ├── Decode Ways.py
│ │ └── Interleaving String.py
│ ├── 101-110/
│ │ └── Symmetric Tree.py
│ ├── 111-120/
│ │ ├── Path Sum.py
│ │ ├── Populating Next Right Pointers in Each Node II.py
│ │ └── Populating Next Right Pointers in Each Node.py
│ ├── 121-130/
│ │ ├── Best Time to Buy and Sell Stock.py
│ │ ├── Binary Tree Maximum Path Sum.py
│ │ ├── Word Ladder II.py
│ │ └── Word Ladder.py
│ ├── 131-140/
│ │ ├── Candy.py
│ │ ├── Clone Graph.py
│ │ └── Single Number II.py
│ ├── 141-150/
│ │ ├── Binary Tree Postorder Traversal.py
│ │ └── LRU Cache.py
│ ├── 151-160/
│ │ ├── Find Minimum in Rotated Sorted Array II.py
│ │ └── Find Minimum in Rotated Sorted Array.py
│ ├── 161-170/
│ │ ├── Majority Element.py
│ │ └── Maximum Gap.py
│ ├── 171-180/
│ │ └── Largest Number.py
│ ├── 181-190/
│ │ ├── Best Time to Buy and Sell Stock IV.py
│ │ └── Repeated DNA Sequences.py
│ ├── 191-200/
│ │ ├── Binary Tree Right Side View.py
│ │ └── House Robber.py
│ ├── 201-210/
│ │ ├── Count Primes.py
│ │ └── Implement Trie (Prefix Tree).py
│ ├── 211-220/
│ │ └── House Robber II.py
│ ├── 221-230/
│ │ └── Maximal Square.py
│ └── 231-240/
│ ├── Palindrome Linked List.py
│ ├── Product of Array Except Self.py
│ └── a.py
└── scala/
├── 0001-0010/
│ ├── Add Two Numbers.scala
│ ├── Longest Substring Without Repeating Characters.scala
│ ├── Palindrome Number.scala
│ └── Two Sum.scala
└── 0011-0020/
├── Longest Common Prefix.scala
└── Roman to Integer.scala
Showing preview only (264K chars total). Download the full file or copy to clipboard to get everything.
SYMBOL INDEX (3070 symbols across 1131 files)
FILE: Solve the Equation.cpp
class Solution (line 2) | class Solution {
method string (line 4) | string solveEquation(string equation) {
method coef (line 20) | pair<int, int> coef(string s) {
FILE: cpp/001-010/Add Two Numbers.cpp
class Solution (line 1) | class Solution {
method ListNode (line 3) | ListNode *addTwoNumbers(ListNode *l1, ListNode *l2) {
FILE: cpp/001-010/Longest Palindromic Substring.cpp
class Solution (line 1) | class Solution {
method string (line 3) | string longestPalindrome(string s) {
FILE: cpp/001-010/Longest Substring Without Repeating Characters.cpp
class Solution (line 1) | class Solution {
method lengthOfLongestSubstring (line 3) | int lengthOfLongestSubstring(string s) {
FILE: cpp/001-010/Median of Two Sorted Arrays.cpp
class Solution (line 1) | class Solution {
method findMedianSortedArrays (line 3) | double findMedianSortedArrays(vector<int>& nums1, vector<int>& nums2) {
method findKthElement (line 12) | double findKthElement(int k, const vector<int>& nums1, int idx1, const...
FILE: cpp/001-010/Palindrome Number.cpp
class Solution (line 1) | class Solution {
method isPalindrome (line 3) | bool isPalindrome(int x) {
FILE: cpp/001-010/Regular Expression Matching.cpp
class Solution (line 1) | class Solution {
method isMatch (line 3) | bool isMatch(const string& s, int sidx, const string& p, int pidx) {
method isMatch (line 21) | bool isMatch(string s, string p) {
FILE: cpp/001-010/Reverse Integer.cpp
class Solution (line 1) | class Solution {
method reverse (line 3) | int reverse(int x) {
FILE: cpp/001-010/String to Integer (atoi).cpp
class Solution (line 1) | class Solution {
method myAtoi (line 3) | int myAtoi(string str) {
FILE: cpp/001-010/Two Sum.cpp
class Solution (line 1) | class Solution {
method twoSum (line 3) | vector<int> twoSum(vector<int> &numbers, int target) {
FILE: cpp/001-010/ZigZag Conversion.cpp
class Solution (line 1) | class Solution {
method string (line 3) | string convert(string s, int numRows) {
FILE: cpp/011-020/3Sum Closest.cpp
class Solution (line 1) | class Solution {
method threeSumClosest (line 3) | int threeSumClosest(vector<int>& nums, int target) {
FILE: cpp/011-020/3Sum.cpp
class Solution (line 1) | class Solution {
method threeSum (line 3) | vector<vector<int>> threeSum(vector<int>& nums) {
FILE: cpp/011-020/4Sum.cpp
class Solution (line 1) | class Solution {
method fourSum (line 4) | vector<vector<int> > fourSum(vector<int> &num, int target) {
FILE: cpp/011-020/Container With Most Water.cpp
class Solution (line 1) | class Solution {
method maxArea (line 3) | int maxArea(vector<int>& height) {
FILE: cpp/011-020/Integer to Roman.cpp
class Solution (line 1) | class Solution {
method string (line 3) | string intToRoman(int num) {
FILE: cpp/011-020/Letter Combinations of a Phone Number.cpp
class Solution (line 1) | class Solution {
method letterCombinations (line 4) | vector<string> letterCombinations(string digits) {
FILE: cpp/011-020/Longest Common Prefix.cpp
class Solution (line 1) | class Solution {
method string (line 3) | string longestCommonPrefix(vector<string>& strs) {
FILE: cpp/011-020/Remove Nth Node From End of List.cpp
class Solution (line 1) | class Solution {
method ListNode (line 3) | ListNode* removeNthFromEnd(ListNode* head, int n) {
FILE: cpp/011-020/Roman to Integer.cpp
class Solution (line 1) | class Solution {
method romanToInt (line 4) | int romanToInt(string s) {
FILE: cpp/011-020/Valid Parentheses.cpp
class Solution (line 1) | class Solution {
method isValid (line 3) | bool isValid(string s) {
FILE: cpp/021-030/Divide Two Integers.cpp
class Solution (line 5) | class Solution {
method divide (line 7) | int divide(int dividend, int divisor) {
method divide (line 45) | int divide(int dividend, int divisor) {
class Solution (line 43) | class Solution {
method divide (line 7) | int divide(int dividend, int divisor) {
method divide (line 45) | int divide(int dividend, int divisor) {
FILE: cpp/021-030/Generate Parentheses.cpp
class Solution (line 1) | class Solution {
method dfs (line 3) | void dfs(string s, int open, int close, vector<string>& parentheses) {
method generateParenthesis (line 19) | vector<string> generateParenthesis(int n) {
FILE: cpp/021-030/Implement strStr().cpp
class Solution (line 1) | class Solution {
method strStr (line 3) | int strStr(string haystack, string needle) {
FILE: cpp/021-030/Merge Two Sorted Lists.cpp
class Solution (line 1) | class Solution {
method ListNode (line 3) | ListNode *mergeTwoLists(ListNode *l1, ListNode *l2) {
FILE: cpp/021-030/Merge k Sorted Lists.cpp
class Solution (line 1) | class Solution {
method ListNode (line 3) | ListNode *mergeKLists(vector<ListNode *> &lists) {
FILE: cpp/021-030/Remove Duplicates from Sorted Array.cpp
class Solution (line 1) | class Solution {
method removeDuplicates (line 3) | int removeDuplicates(vector<int>& nums) {
FILE: cpp/021-030/Remove Element.cpp
class Solution (line 1) | class Solution {
method removeElement (line 3) | int removeElement(vector<int>& nums, int val) {
FILE: cpp/021-030/Reverse Nodes in k-Group.cpp
class Solution (line 1) | class Solution {
method length (line 3) | int length(ListNode* head) {
method ListNode (line 12) | ListNode* dfs(ListNode* head, int len, int k) {
method ListNode (line 31) | ListNode* reverseKGroup(ListNode* head, int k) {
FILE: cpp/021-030/Substring with Concatenation of All Words.cpp
class Solution (line 1) | class Solution {
method findSubstring (line 3) | vector<int> findSubstring(string s, vector<string>& words) {
FILE: cpp/021-030/Swap Nodes in Pairs.cpp
class Solution (line 1) | class Solution {
method ListNode (line 3) | ListNode* swapPairs(ListNode* head) {
FILE: cpp/031-040/Combination Sum II.cpp
class Solution (line 9) | class Solution {
method help (line 11) | void help(vector<int>& now, vector<int>&candidates, int index, int tar...
method combinationSum2 (line 31) | vector<vector<int> > combinationSum2(vector<int> &candidates, int targ...
function main (line 41) | int main()
FILE: cpp/031-040/Combination Sum.cpp
class Solution (line 1) | class Solution {
method help (line 3) | void help(vector<int>& now, vector<int>&candidates, int index, int tar...
method combinationSum (line 21) | vector<vector<int> > combinationSum(vector<int> &candidates, int targe...
FILE: cpp/031-040/Count and Say.cpp
class Solution (line 9) | class Solution {
method string (line 11) | string process(string &s)
method string (line 30) | string countAndSay(int n) {
function main (line 40) | int main()
FILE: cpp/031-040/Longest Valid Parentheses.cpp
class Solution (line 2) | class Solution {
method longestValidParentheses (line 4) | int longestValidParentheses(string s) {
method longestValidParentheses (line 30) | int longestValidParentheses(string s) {
class Solution (line 28) | class Solution {
method longestValidParentheses (line 4) | int longestValidParentheses(string s) {
method longestValidParentheses (line 30) | int longestValidParentheses(string s) {
FILE: cpp/031-040/Next Permutation.cpp
class Solution (line 1) | class Solution {
method nextPermutation (line 3) | void nextPermutation(vector<int> &num) {
FILE: cpp/031-040/Search Insert Position.cpp
class Solution (line 1) | class Solution {
method searchInsert (line 3) | int searchInsert(vector<int>& nums, int target) {
FILE: cpp/031-040/Search for a Range.cpp
class Solution (line 1) | class Solution {
method searchRange (line 3) | vector<int> searchRange(vector<int>& nums, int target) {
method FindFirst (line 23) | int FindFirst(const vector<int>& nums, int target) {
method FindLast (line 44) | int FindLast(const vector<int>& nums, int target) {
method searchRange (line 66) | vector<int> searchRange(vector<int>& nums, int target) {
class Solution (line 21) | class Solution {
method searchRange (line 3) | vector<int> searchRange(vector<int>& nums, int target) {
method FindFirst (line 23) | int FindFirst(const vector<int>& nums, int target) {
method FindLast (line 44) | int FindLast(const vector<int>& nums, int target) {
method searchRange (line 66) | vector<int> searchRange(vector<int>& nums, int target) {
FILE: cpp/031-040/Search in Rotated Sorted Array.cpp
class Solution (line 1) | class Solution {
method search (line 3) | int search(vector<int>& nums, int target) {
FILE: cpp/031-040/Sudoku Solver.cpp
class Solution (line 1) | class Solution {
method help (line 7) | bool help(vector<vector<char> > &board, int i, int j) {
method solveSudoku (line 38) | void solveSudoku(vector<vector<char> > &board) {
FILE: cpp/031-040/Valid Sudoku.cpp
class Solution (line 1) | class Solution {
method isValidSudoku (line 3) | bool isValidSudoku(vector<vector<char> > &board) {
FILE: cpp/041-050/First Missing Positive.cpp
class Solution (line 1) | class Solution {
method firstMissingPositive (line 3) | int firstMissingPositive(vector<int>& nums) {
FILE: cpp/041-050/Group Anagrams.cpp
class Solution (line 1) | class Solution {
method groupAnagrams (line 3) | vector<vector<string>> groupAnagrams(vector<string>& strs) {
FILE: cpp/041-050/Jump Game II.cpp
class Solution (line 1) | class Solution {
method jump (line 3) | int jump(vector<int>& nums) {
FILE: cpp/041-050/Multiply Strings.cpp
class Solution (line 1) | class Solution {
method string (line 4) | string multiply(string num1, string num2) {
FILE: cpp/041-050/Permutations II.cpp
class Solution (line 1) | class Solution {
method help (line 3) | void help(vector<vector<int>>& result, int begin, vector<int> num) {
method permuteUnique (line 17) | vector<vector<int> > permuteUnique(vector<int> &num) {
FILE: cpp/041-050/Permutations.cpp
class Solution (line 1) | class Solution {
method help (line 3) | void help(vector<vector<int>>& result, int begin, vector<int> &num)
method permute (line 19) | vector<vector<int> > permute(vector<int> &num) {
FILE: cpp/041-050/Pow.cpp
class Solution (line 1) | class Solution {
method myPow (line 3) | double myPow(double x, int n) {
FILE: cpp/041-050/Rotate Image.cpp
class Solution (line 1) | class Solution {
method rotate (line 3) | void rotate(vector<vector<int> > &matrix) {
FILE: cpp/041-050/Trapping Rain Water.cpp
class Solution (line 1) | class Solution {
method trap (line 3) | int trap(vector<int>& height) {
FILE: cpp/041-050/Wildcard Matching.cpp
class Solution (line 1) | class Solution {
method isMatch (line 3) | bool isMatch(string s, string p) {
FILE: cpp/051-060/Insert Interval.cpp
class Solution (line 1) | class Solution {
method merge (line 3) | vector<Interval> merge(vector<Interval> &intervals) {
method insert (line 26) | vector<Interval> insert(vector<Interval> &intervals, Interval newInter...
FILE: cpp/051-060/Jump Game.cpp
class Solution (line 1) | class Solution {
method canJump (line 3) | bool canJump(vector<int>& nums) {
FILE: cpp/051-060/Length of Last Word.cpp
class Solution (line 1) | class Solution {
method lengthOfLastWord (line 3) | int lengthOfLastWord(string s) {
FILE: cpp/051-060/Maximum_Subarray.cpp
class Solution (line 21) | class Solution {
method maxSubArray (line 23) | int maxSubArray(std::vector<int>& A) {
function main (line 42) | int main() {
FILE: cpp/051-060/Merge Intervals.cpp
class Solution (line 1) | class Solution {
method merge (line 3) | vector<vector<int>> merge(vector<vector<int>> &intervals) {
FILE: cpp/051-060/N-Queens II.cpp
class Solution (line 1) | class Solution {
method valid (line 8) | bool valid(int i, int j) {
method help (line 14) | void help(int i, int &res) {
method totalNQueens (line 30) | int totalNQueens(int n) {
FILE: cpp/051-060/N-Queens.cpp
class Solution (line 1) | class Solution {
method valid (line 8) | bool valid(int i, int j)
method help (line 15) | void help(vector<vector<string>> &result, vector<pair<int, int>> &tmp,...
method solveNQueens (line 41) | vector<vector<string> > solveNQueens(int n) {
FILE: cpp/051-060/Permutation Sequence.cpp
class Solution (line 1) | class Solution {
method string (line 3) | string getPermutation(int n, int k) {
FILE: cpp/051-060/Spiral Matrix II.cpp
class Solution (line 9) | class Solution {
method generateMatrix (line 11) | vector<vector<int> > generateMatrix(int n) {
function main (line 57) | int main()
FILE: cpp/051-060/Spiral Matrix.cpp
class Solution (line 9) | class Solution {
method spiralOrder (line 11) | vector<int> spiralOrder(vector<vector<int> > &matrix) {
function main (line 52) | int main()
FILE: cpp/061-070/Add Binary.cpp
class Solution (line 1) | class Solution {
method string (line 3) | string addBinary(string a, string b) {
FILE: cpp/061-070/Climbing Stairs.cpp
class Solution (line 1) | class Solution {
method climbStairs (line 3) | int climbStairs(int n) {
FILE: cpp/061-070/Plus One.cpp
class Solution (line 1) | class Solution {
method plusOne (line 3) | vector<int> plusOne(vector<int>& digits) {
FILE: cpp/061-070/Rotate List.cpp
class Solution (line 9) | class Solution {
method ListNode (line 11) | ListNode *rotateRight(ListNode *head, int k) {
FILE: cpp/061-070/Sqrt.cpp
class Solution (line 1) | class Solution {
method mySqrt (line 3) | int mySqrt(int x) {
method mySqrt (line 24) | int mySqrt(int x) {
class Solution (line 22) | class Solution {
method mySqrt (line 3) | int mySqrt(int x) {
method mySqrt (line 24) | int mySqrt(int x) {
FILE: cpp/061-070/Text Justification.cpp
class Solution (line 1) | class Solution {
method help (line 3) | vector<int> help(vector<string> &words, int start, int end, int L)
method fullJustify (line 24) | vector<string> fullJustify(vector<string> &words, int L) {
FILE: cpp/061-070/Unique Paths II .cpp
class Solution (line 1) | class Solution {
method uniquePathsWithObstacles (line 3) | int uniquePathsWithObstacles(vector<vector<int> > &obstacleGrid) {
FILE: cpp/061-070/Unique Paths.cpp
class Solution (line 1) | class Solution {
method uniquePaths (line 3) | int uniquePaths(int m, int n) {
FILE: cpp/061-070/Valid Number.cpp
class Solution (line 1) | class Solution {
method isNumber (line 3) | bool isNumber(string str) {
FILE: cpp/071-080/Combinations.cpp
class Solution (line 1) | class Solution {
method help (line 3) | void help(int n, int k, int index, vector<int>&tmp, vector<vector<int>...
method combine (line 20) | vector<vector<int> > combine(int n, int k) {
FILE: cpp/071-080/Edit Distance.cpp
class Solution (line 1) | class Solution {
method minDistance (line 3) | int minDistance(string word1, string word2) {
FILE: cpp/071-080/Minimum Window Substring.cpp
class Solution (line 1) | class Solution {
method string (line 3) | string minWindow(string s, string t) {
FILE: cpp/071-080/Remove Duplicates from Sorted Array II.cpp
class Solution (line 1) | class Solution {
method removeDuplicates (line 3) | int removeDuplicates(vector<int>& nums) {
FILE: cpp/071-080/Search a 2D Matrix.cpp
class Solution (line 1) | class Solution {
method searchMatrix (line 3) | bool searchMatrix(vector<vector<int> > &matrix, int target) {
FILE: cpp/071-080/Set Matrix Zeroes.cpp
class Solution (line 1) | class Solution {
method setZeroes (line 3) | void setZeroes(vector<vector<int> > &matrix) {
FILE: cpp/071-080/Simplify Path.cpp
class Solution (line 1) | class Solution {
method string (line 3) | string simplifyPath(string path) {
FILE: cpp/071-080/Sort Colors.cpp
class Solution (line 1) | class Solution {
method sortColors (line 3) | void sortColors(vector<int>& nums) {
FILE: cpp/071-080/Subsets.cpp
class Solution (line 1) | class Solution {
method subsets (line 3) | vector<vector<int> > subsets(vector<int> &S) {
FILE: cpp/071-080/Word Search.cpp
class Solution (line 1) | class Solution {
method dfs (line 3) | bool dfs(vector<vector<char>>& board, const string &word, int i, int j...
method exist (line 20) | bool exist(vector<vector<char>>& board, string word) {
FILE: cpp/081-090/Gray Code.cpp
class Solution (line 1) | class Solution {
method grayCode (line 3) | vector<int> grayCode(int n) {
FILE: cpp/081-090/Largest Rectangle in Histogram.cpp
class Solution (line 1) | class Solution {
method largestRectangleArea (line 3) | int largestRectangleArea(vector<int> &hist) {
FILE: cpp/081-090/Maximal Rectangle.cpp
class Solution (line 1) | class Solution {
method maximalRectangle (line 3) | int maximalRectangle(vector<vector<char>>& matrix) {
FILE: cpp/081-090/Merge Sorted Array.cpp
class Solution (line 1) | class Solution {
method merge (line 3) | void merge(vector<int>& nums1, int m, vector<int>& nums2, int n) {
FILE: cpp/081-090/Partition List.cpp
class Solution (line 1) | class Solution {
method ListNode (line 3) | ListNode *partition(ListNode *head, int x) {
FILE: cpp/081-090/Remove Duplicates from Sorted List II.cpp
type ListNode (line 11) | struct ListNode {
method ListNode (line 14) | ListNode(int x) : val(x), next(NULL) {}
class Solution (line 17) | class Solution {
method ListNode (line 19) | ListNode *deleteDuplicates(ListNode *head) {
function main (line 44) | int main()
FILE: cpp/081-090/Remove Duplicates from Sorted List.cpp
type ListNode (line 11) | struct ListNode {
method ListNode (line 14) | ListNode(int x) : val(x), next(NULL) {}
class Solution (line 17) | class Solution {
method ListNode (line 19) | ListNode* deleteDuplicates(ListNode* head) {
function main (line 35) | int main()
FILE: cpp/081-090/Scramble String.cpp
class Solution (line 1) | class Solution {
method isScramble (line 4) | bool isScramble(string s1, string s2) {
FILE: cpp/081-090/Search in Rotated Sorted Array II.cpp
class Solution (line 1) | class Solution {
method search (line 3) | bool search(vector<int>& nums, int target) {
FILE: cpp/081-090/Subsets II.cpp
class Solution (line 1) | class Solution {
method subsetsWithDup (line 3) | vector<vector<int>> subsetsWithDup(vector<int>& nums) {
FILE: cpp/091-100/Binary Tree Inorder Traversal.cpp
class Solution (line 1) | class Solution {
method inorderTraversal (line 3) | vector<int> inorderTraversal(TreeNode* root) {
FILE: cpp/091-100/Decode Ways.cpp
class Solution (line 1) | class Solution {
method valid (line 3) | bool valid(char ch1, char ch2)
method numDecodings (line 17) | int numDecodings(string s) {
FILE: cpp/091-100/Interleaving String.cpp
class Solution (line 1) | class Solution {
method isInterleave (line 4) | bool isInterleave(string s1, string s2, string s3) {
FILE: cpp/091-100/Recover Binary Search Tree.cpp
class Solution (line 1) | class Solution {
method recoverTree (line 3) | void recoverTree(TreeNode* root) {
FILE: cpp/091-100/Restore IP Addresses.cpp
class Solution (line 1) | class Solution {
method restoreIpAddresses (line 3) | vector<string> restoreIpAddresses(string s) {
FILE: cpp/091-100/Reverse Linked List II.cpp
class Solution (line 1) | class Solution {
method ListNode (line 3) | ListNode *reverseBetween(ListNode *head, int m, int n) {
FILE: cpp/091-100/Same Tree.cpp
class Solution (line 1) | class Solution {
method isSameTree (line 3) | bool isSameTree(TreeNode* p, TreeNode* q) {
FILE: cpp/091-100/Unique Binary Search Trees II.cpp
class Solution (line 10) | class Solution {
method generate (line 12) | vector<TreeNode *> generate(int beg, int end) {
method generateTrees (line 36) | vector<TreeNode *> generateTrees(int n) {
FILE: cpp/091-100/Unique Binary Search Trees.cpp
class Solution (line 1) | class Solution {
method numTrees (line 3) | int numTrees(int n) {
FILE: cpp/091-100/Validate Binary Search Tree.cpp
class Solution (line 1) | class Solution {
method isValidBST (line 3) | bool isValidBST(TreeNode* root) {
FILE: cpp/1001-10000/1001-1010/Construct Binary Search Tree from Preorder Traversal.cpp
class Solution (line 10) | class Solution {
method TreeNode (line 12) | TreeNode* dfs(int& i, vector<int>& preorder, int lower, int upper) {
method TreeNode (line 31) | TreeNode* bstFromPreorder(vector<int>& preorder) {
FILE: cpp/1001-10000/1011-1020/Best Sightseeing Pair.cpp
class Solution (line 1) | class Solution {
method maxScoreSightseeingPair (line 3) | int maxScoreSightseeingPair(vector<int>& A) {
FILE: cpp/1001-10000/1011-1020/Binary Prefix Divisible By 5.cpp
class Solution (line 1) | class Solution {
method prefixesDivBy5 (line 3) | vector<bool> prefixesDivBy5(vector<int>& A) {
FILE: cpp/1001-10000/1011-1020/Binary String With Substrings Representing 1 To N.cpp
class Solution (line 1) | class Solution {
method queryString (line 3) | bool queryString(string S, int N) {
FILE: cpp/1001-10000/1011-1020/Convert to Base -2.cpp
class Solution (line 1) | class Solution {
method string (line 3) | string baseNeg2(int N) {
FILE: cpp/1001-10000/1011-1020/Next Greater Node In Linked List.cpp
class Solution (line 9) | class Solution {
method nextLargerNodes (line 11) | vector<int> nextLargerNodes(ListNode* head) {
FILE: cpp/1001-10000/1011-1020/Number of Enclaves.cpp
class Solution (line 1) | class Solution {
method dfs (line 8) | void dfs(vector<vector<int>>& A, int i, int j) {
method numEnclaves (line 20) | int numEnclaves(vector<vector<int>>& A) {
FILE: cpp/1001-10000/1011-1020/Partition Array Into Three Parts With Equal Sum.cpp
class Solution (line 1) | class Solution {
method canThreePartsEqualSum (line 3) | bool canThreePartsEqualSum(vector<int>& A) {
FILE: cpp/1001-10000/1021-1030/Camelcase Matching.cpp
class Solution (line 1) | class Solution {
method camelMatch (line 3) | vector<bool> camelMatch(vector<string>& queries, string pattern) {
FILE: cpp/1001-10000/1021-1030/Divisor Game.cpp
class Solution (line 1) | class Solution {
method divisorGame (line 4) | bool divisorGame(int N) {
FILE: cpp/1001-10000/1021-1030/Longest Arithmetic Sequence.cpp
class Solution (line 1) | class Solution {
method longestArithSeqLength (line 3) | int longestArithSeqLength(vector<int>& A) {
FILE: cpp/1001-10000/1021-1030/Matrix Cells in Distance Order.cpp
class Solution (line 1) | class Solution {
method allCellsDistOrder (line 3) | vector<vector<int>> allCellsDistOrder(int R, int C, int r0, int c0) {
FILE: cpp/1001-10000/1021-1030/Maximum Difference Between Node and Ancestor.cpp
class Solution (line 10) | class Solution {
method dfs (line 12) | int dfs(TreeNode* root, int min_, int max_) {
method maxAncestorDiff (line 24) | int maxAncestorDiff(TreeNode* root) {
FILE: cpp/1001-10000/1021-1030/Recover a Tree From Preorder Traversal.cpp
class Solution (line 10) | class Solution {
method TreeNode (line 12) | TreeNode* dfs(const string& S, int& i, int d) {
method TreeNode (line 38) | TreeNode* recoverFromPreorder(string S) {
FILE: cpp/1001-10000/1021-1030/Remove Outermost Parentheses.cpp
class Solution (line 1) | class Solution {
method string (line 3) | string removeOuterParentheses(string S) {
FILE: cpp/1001-10000/1021-1030/Sum of Root To Leaf Binary Numbers.cpp
class Solution (line 10) | class Solution {
method dfs (line 12) | int dfs(TreeNode* root, int carry) {
method sumRootToLeaf (line 23) | int sumRootToLeaf(TreeNode* root) {
FILE: cpp/1001-10000/1021-1030/Two City Scheduling.cpp
class Solution (line 1) | class Solution {
method twoCitySchedCost (line 3) | int twoCitySchedCost(vector<vector<int>>& costs) {
FILE: cpp/1001-10000/1021-1030/Video Stitching.cpp
class Solution (line 1) | class Solution {
method videoStitching (line 3) | int videoStitching(vector<vector<int>>& clips, int T) {
FILE: cpp/1001-10000/1031-1040/Binary Search Tree to Greater Sum Tree.cpp
class Solution (line 10) | class Solution {
method dfs (line 12) | void dfs(TreeNode* root, int& v) {
method TreeNode (line 21) | TreeNode* bstToGst(TreeNode* root) {
FILE: cpp/1001-10000/1031-1040/Coloring A Border.cpp
class Solution (line 1) | class Solution {
method dfs (line 9) | void dfs(vector<vector<int>>& grid, int i, int j, vector<vector<bool>>...
method colorBorder (line 32) | vector<vector<int>> colorBorder(vector<vector<int>>& grid, int r0, int...
FILE: cpp/1001-10000/1031-1040/Escape a Large Maze.cpp
class Solution (line 1) | class Solution {
method isEscapePossibleInternal (line 7) | bool isEscapePossibleInternal(vector<vector<int>>& blocked, vector<int...
method isEscapePossible (line 39) | bool isEscapePossible(vector<vector<int>>& blocked, vector<int>& sourc...
FILE: cpp/1001-10000/1031-1040/Maximum Sum of Two Non-Overlapping Subarrays.cpp
class Solution (line 1) | class Solution {
method maxSumTwoNoOverlap (line 3) | int maxSumTwoNoOverlap(vector<int>& A, int L, int M) {
method help (line 9) | int help(const vector<int>& sum, int L, int M) {
FILE: cpp/1001-10000/1031-1040/Minimum Score Triangulation of Polygon.cpp
class Solution (line 1) | class Solution {
method dfs (line 3) | int dfs(vector<int>& A, map<pair<int, int>, int>& cache, int start_ind...
method minScoreTriangulation (line 27) | int minScoreTriangulation(vector<int>& A) {
FILE: cpp/1001-10000/1031-1040/Moving Stones Until Consecutive.cpp
class Solution (line 1) | class Solution {
method numMovesStones (line 3) | vector<int> numMovesStones(int a, int b, int c) {
FILE: cpp/1001-10000/1031-1040/Stream of Characters.cpp
type TrieNode (line 1) | struct TrieNode {
method TrieNode (line 5) | TrieNode(): word(false) {
class Trie (line 10) | class Trie {
method Trie (line 13) | Trie() {
method insert (line 18) | void insert(const string& s) {
method eat (line 30) | bool eat(char ch) {
class StreamChecker (line 58) | class StreamChecker {
method StreamChecker (line 61) | StreamChecker(vector<string>& words) {
method query (line 67) | bool query(char letter) {
FILE: cpp/1001-10000/1031-1040/Uncrossed Lines.cpp
class Solution (line 1) | class Solution {
method maxUncrossedLines (line 3) | int maxUncrossedLines(vector<int>& A, vector<int>& B) {
FILE: cpp/1001-10000/1031-1040/Valid Boomerang.cpp
class Solution (line 1) | class Solution {
method isBoomerang (line 3) | bool isBoomerang(vector<vector<int>>& points) {
FILE: cpp/1001-10000/1041-1050/Flower Planting With No Adjacent.cpp
class Solution (line 1) | class Solution {
method dfs (line 4) | void dfs(int u, map<int, vector<int>>& edges) {
method gardenNoAdj (line 27) | vector<int> gardenNoAdj(int N, vector<vector<int>>& paths) {
FILE: cpp/1001-10000/1041-1050/Last Stone Weight II.cpp
class Solution (line 1) | class Solution {
method lastStoneWeightII (line 4) | int lastStoneWeightII(vector<int>& stones) {
FILE: cpp/1001-10000/1041-1050/Last Stone Weight.cpp
class Solution (line 1) | class Solution {
method lastStoneWeight (line 3) | int lastStoneWeight(vector<int>& stones) {
FILE: cpp/1001-10000/1041-1050/Longest String Chain.cpp
class Solution (line 1) | class Solution {
method dfs (line 3) | int dfs(const string& word, const unordered_set<string>& dictionary, u...
method longestStrChain (line 20) | int longestStrChain(vector<string>& words) {
FILE: cpp/1001-10000/1041-1050/Partition Array for Maximum Sum.cpp
class Solution (line 1) | class Solution {
method maxSumAfterPartitioning (line 3) | int maxSumAfterPartitioning(vector<int>& A, int K) {
FILE: cpp/1001-10000/1041-1050/Remove All Adjacent Duplicates In String.cpp
class Solution (line 1) | class Solution {
method string (line 3) | string removeDuplicates(string S) {
FILE: cpp/1001-10000/1041-1050/Robot Bounded In Circle.cpp
class Solution (line 1) | class Solution {
method getNextDirection (line 3) | pair<int, int> getNextDirection(pair<int, int> d, char ch) {
method string (line 34) | string GetKey(int x, int y, pair<int, int> d) {
method isRobotBounded (line 39) | bool isRobotBounded(string instructions) {
FILE: cpp/1001-10000/1051-1060/Distant Barcodes.cpp
class Solution (line 1) | class Solution {
method rearrangeBarcodes (line 3) | vector<int> rearrangeBarcodes(vector<int>& barcodes) {
FILE: cpp/1001-10000/1051-1060/Grumpy Bookstore Owner.cpp
class Solution (line 1) | class Solution {
method maxSatisfied (line 3) | int maxSatisfied(vector<int>& customers, vector<int>& grumpy, int X) {
FILE: cpp/1001-10000/1051-1060/Height Checker.cpp
class Solution (line 1) | class Solution {
method heightChecker (line 3) | int heightChecker(vector<int>& heights) {
FILE: cpp/1001-10000/1051-1060/Previous Permutation With One Swap.cpp
class Solution (line 1) | class Solution {
method prevPermOpt1 (line 3) | vector<int> prevPermOpt1(vector<int>& A) {
FILE: cpp/1001-10000/1071-1080/Adding Two Negabinary Numbers.cpp
class Solution (line 1) | class Solution {
method addNegabinary (line 3) | vector<int> addNegabinary(vector<int>& arr1, vector<int>& arr2) {
FILE: cpp/1001-10000/1071-1080/Flip Columns For Maximum Number of Equal Rows.cpp
class Solution (line 1) | class Solution {
method process (line 3) | void process(map<string, int>& mymap, const vector<int>& vec) {
method maxEqualRowsAfterFlips (line 14) | int maxEqualRowsAfterFlips(vector<vector<int>>& matrix) {
FILE: cpp/1001-10000/1071-1080/Greatest Common Divisor of Strings.cpp
class Solution (line 1) | class Solution {
method IsValid (line 3) | bool IsValid(const string& str, const string& candidate) {
method string (line 13) | string gcdOfStrings(string str1, string str2) {
FILE: cpp/1001-10000/1071-1080/Insufficient Nodes in Root to Leaf Paths.cpp
class Solution (line 10) | class Solution {
method TreeNode (line 12) | TreeNode* sufficientSubset(TreeNode* root, int limit) {
FILE: cpp/1001-10000/1071-1080/Letter Tile Possibilities.cpp
class Solution (line 1) | class Solution {
method uniquePerms (line 5) | int uniquePerms(const string& s) {
method dfs (line 13) | int dfs(const string& s, string seq = "", int pos = 0) {
method numTilePossibilities (line 21) | int numTilePossibilities(string tiles) {
FILE: cpp/1001-10000/1071-1080/Number of Submatrices That Sum to Target.cpp
class Solution (line 1) | class Solution {
method numSubmatrixSumTarget (line 3) | int numSubmatrixSumTarget(vector<vector<int>>& matrix, int target) {
FILE: cpp/1001-10000/1071-1080/Occurrences After Bigram.cpp
class Solution (line 1) | class Solution {
method findOcurrences (line 3) | vector<string> findOcurrences(string text, string first, string second) {
FILE: cpp/1001-10000/1081-1090/Duplicate Zeros.cpp
class Solution (line 1) | class Solution {
method duplicateZeros (line 3) | void duplicateZeros(vector<int>& arr) {
FILE: cpp/1001-10000/1081-1090/Largest Values From Labels.cpp
class Solution (line 1) | class Solution {
method largestValsFromLabels (line 3) | int largestValsFromLabels(vector<int>& values, vector<int>& labels, in...
FILE: cpp/1001-10000/1081-1090/Smallest Subsequence of Distinct Characters.cpp
class Solution (line 1) | class Solution {
method string (line 3) | string smallestSubsequence(string text) {
FILE: cpp/1001-10000/1091-1100/Brace Expansion II.cpp
class Solution (line 1) | class Solution {
method merge (line 3) | set<string> merge(const set<string>& set1, const set<string>& set2) {
method process (line 13) | void process(stack<set<string>>& mystack, stack<char>& ops) {
method braceExpansionII (line 30) | vector<string> braceExpansionII(string expression) {
FILE: cpp/1001-10000/1091-1100/Car Pooling.cpp
class Solution (line 1) | class Solution {
method carPooling (line 3) | bool carPooling(vector<vector<int>>& trips, int capacity) {
FILE: cpp/1001-10000/1091-1100/Find in Mountain Array.cpp
class Solution (line 10) | class Solution {
method findInMountainArray (line 13) | int findInMountainArray(int target, MountainArray &mountainArr) {
FILE: cpp/1001-10000/1091-1100/Shortest Common Supersequence.cpp
class Solution (line 1) | class Solution {
method string (line 4) | string shortestCommonSupersequence(string str1, string str2) {
FILE: cpp/1001-10000/1091-1100/Shortest Path in Binary Matrix.cpp
class Solution (line 1) | class Solution {
method shortestPathBinaryMatrix (line 3) | int shortestPathBinaryMatrix(vector<vector<int>>& grid) {
FILE: cpp/1001-10000/1091-1100/Statistics from a Large Sample.cpp
class Solution (line 1) | class Solution {
method sampleStats (line 3) | vector<double> sampleStats(vector<int>& count) {
FILE: cpp/1001-10000/1091-1100/Two Sum Less Than K.cpp
class Solution (line 1) | class Solution {
method twoSumLessThanK (line 3) | int twoSumLessThanK(vector<int>& A, int K) {
FILE: cpp/1001-10000/1101-1110/Corporate Flight Bookings.cpp
class Solution (line 1) | class Solution {
method corpFlightBookings (line 3) | vector<int> corpFlightBookings(vector<vector<int>>& bookings, int n) {
FILE: cpp/1001-10000/1101-1110/Defanging an IP Address.cpp
class Solution (line 1) | class Solution {
method string (line 3) | string defangIPaddr(string address) {
FILE: cpp/1001-10000/1101-1110/Delete Nodes And Return Forest.cpp
class Solution (line 10) | class Solution {
method TreeNode (line 14) | TreeNode* dfs (TreeNode* root, set<int>& to_deleted, bool is_root) {
method delNodes (line 35) | vector<TreeNode*> delNodes(TreeNode* root, vector<int>& to_delete) {
FILE: cpp/1001-10000/1101-1110/Distribute Candies to People.cpp
class Solution (line 1) | class Solution {
method distributeCandies (line 3) | vector<int> distributeCandies(int candies, int num_people) {
FILE: cpp/1001-10000/1101-1110/Filling Bookcase Shelves.cpp
class Solution (line 1) | class Solution {
method minHeightShelves (line 3) | int minHeightShelves(vector<vector<int>>& books, int shelf_width) {
method dfs (line 28) | int dfs(vector<vector<int>>& books, int shelf_width, int ind, int rema...
method minHeightShelves (line 45) | int minHeightShelves(vector<vector<int>>& books, int shelf_width) {
class Solution (line 26) | class Solution {
method minHeightShelves (line 3) | int minHeightShelves(vector<vector<int>>& books, int shelf_width) {
method dfs (line 28) | int dfs(vector<vector<int>>& books, int shelf_width, int ind, int rema...
method minHeightShelves (line 45) | int minHeightShelves(vector<vector<int>>& books, int shelf_width) {
FILE: cpp/1001-10000/1101-1110/Parsing A Boolean Expression.cpp
class Solution (line 1) | class Solution {
method parseBoolExpr (line 3) | bool parseBoolExpr(string expression) {
FILE: cpp/1001-10000/1101-1110/Path In Zigzag Labelled Binary Tree.cpp
class Solution (line 1) | class Solution {
method pathInZigZagTree (line 3) | vector<int> pathInZigZagTree(int label) {
FILE: cpp/1001-10000/1111-1120/Maximum Nesting Depth of Two Valid Parentheses Strings.cpp
class Solution (line 1) | class Solution {
method maxDepthAfterSplit (line 3) | vector<int> maxDepthAfterSplit(string seq) {
FILE: cpp/1001-10000/1111-1120/Print FooBar Alternately.cpp
class FooBar (line 1) | class FooBar {
method FooBar (line 7) | FooBar(int n) {
method foo (line 12) | void foo(function<void()> printFoo) {
method bar (line 24) | void bar(function<void()> printBar) {
FILE: cpp/1001-10000/1111-1120/Print in Order.cpp
class Foo (line 1) | class Foo {
method Foo (line 7) | Foo() {
method first (line 11) | void first(function<void()> printFirst) {
method second (line 17) | void second(function<void()> printSecond) {
method third (line 24) | void third(function<void()> printThird) {
FILE: cpp/1001-10000/1121-1130/Lowest Common Ancestor of Deepest Leaves.cpp
class Solution (line 10) | class Solution {
method dfs (line 12) | pair<int, TreeNode*> dfs(TreeNode* root) {
method TreeNode (line 30) | TreeNode* lcaDeepestLeaves(TreeNode* root) {
FILE: cpp/1001-10000/1121-1130/Minimum Cost Tree From Leaf Values.cpp
class Solution (line 1) | class Solution {
method mctFromLeafValues (line 3) | int mctFromLeafValues(vector<int>& arr) {
FILE: cpp/1001-10000/1121-1130/Number of Equivalent Domino Pairs.cpp
class Solution (line 1) | class Solution {
method numEquivDominoPairs (line 3) | int numEquivDominoPairs(vector<vector<int>>& dominoes) {
FILE: cpp/1001-10000/1121-1130/Relative Sort Array.cpp
class Solution (line 1) | class Solution {
method relativeSortArray (line 3) | vector<int> relativeSortArray(vector<int>& arr1, vector<int>& arr2) {
FILE: cpp/1001-10000/1121-1130/Smallest Sufficient Team.cpp
class Solution (line 1) | class Solution {
method dfs (line 7) | bool dfs(int need_skills, int n, vector<bool>& used, map<string, bool>...
method smallestSufficientTeam (line 53) | vector<int> smallestSufficientTeam(vector<string>& req_skills, vector<...
FILE: cpp/1001-10000/1131-1140/N-th Tribonacci Number.cpp
class Solution (line 1) | class Solution {
method tribonacci (line 3) | int tribonacci(int n) {
FILE: cpp/1001-10000/1141-1150/Binary Tree Coloring Game.cpp
class Solution (line 10) | class Solution {
method dfs (line 15) | int dfs(TreeNode* root, int x) {
method btreeGameWinningMove (line 31) | bool btreeGameWinningMove(TreeNode* root, int n, int x) {
FILE: cpp/1001-10000/1141-1150/Decrease Elements To Make Array Zigzag.cpp
class Solution (line 1) | class Solution {
method movesToMakeZigzag (line 3) | int movesToMakeZigzag(vector<int>& nums) {
FILE: cpp/1001-10000/1141-1150/Longest Chunked Palindrome Decomposition.cpp
class Solution (line 1) | class Solution {
method longestDecomposition (line 3) | int longestDecomposition(string text) {
FILE: cpp/1001-10000/1141-1150/Longest Common Subsequence.cpp
class Solution (line 1) | class Solution {
method longestCommonSubsequence (line 3) | int longestCommonSubsequence(string text1, string text2) {
FILE: cpp/1001-10000/1141-1150/Snapshot Array.cpp
class SnapshotArray (line 1) | class SnapshotArray {
method SnapshotArray (line 6) | SnapshotArray(int length) {
method set (line 10) | void set(int index, int val) {
method snap (line 15) | int snap() {
method get (line 20) | int get(int index, int snap_id) {
FILE: cpp/1001-10000/1151-1160/Day of the Year.cpp
class Solution (line 1) | class Solution {
method dayOfYear (line 3) | int dayOfYear(string date) {
FILE: cpp/1001-10000/1151-1160/Find Words That Can Be Formed by Characters.cpp
class Solution (line 1) | class Solution {
method countCharacters (line 3) | int countCharacters(vector<string>& words, string chars) {
FILE: cpp/1001-10000/1151-1160/Number of Dice Rolls With Target Sum.cpp
class Solution (line 1) | class Solution {
method numRollsToTarget (line 4) | int numRollsToTarget(int d, int f, int target) {
FILE: cpp/1001-10000/1161-1170/As Far from Land as Possible.cpp
class Solution (line 1) | class Solution {
method maxDistance (line 3) | int maxDistance(vector<vector<int>>& grid) {
FILE: cpp/1001-10000/1161-1170/Compare Strings by Frequency of the Smallest Character.cpp
class Solution (line 1) | class Solution {
method getF (line 3) | int getF(const string& word) {
method numSmallerByFrequency (line 15) | vector<int> numSmallerByFrequency(vector<string>& queries, vector<stri...
FILE: cpp/1001-10000/1161-1170/Design File System.cpp
class FileSystem (line 1) | class FileSystem {
method FileSystem (line 4) | FileSystem() {
method create (line 8) | bool create(string path, int value) {
method get (line 20) | int get(string path) {
FILE: cpp/1001-10000/1161-1170/Invalid Transactions.cpp
class Solution (line 1) | class Solution {
method split (line 3) | vector<string> split(const string &s, char delim) {
method invalidTransactions (line 16) | vector<string> invalidTransactions(vector<string>& transactions) {
FILE: cpp/1001-10000/1161-1170/Maximum Level Sum of a Binary Tree.cpp
class Solution (line 10) | class Solution {
method dfs (line 14) | void dfs(TreeNode* root, int level) {
method maxLevelSum (line 22) | int maxLevelSum(TreeNode* root) {
FILE: cpp/1001-10000/1161-1170/Minimum Cost to Connect Sticks.cpp
class Solution (line 1) | class Solution {
method connectSticks (line 3) | int connectSticks(vector<int>& sticks) {
FILE: cpp/1001-10000/1161-1170/Optimize Water Distribution in a Village.cpp
class UF (line 1) | class UF {
method UF (line 11) | UF(int N) : parent(N), rank(N, 0), N(N), count(N) {
method find (line 17) | int find(int p) {
method connected (line 25) | bool connected(int p, int q) {
method Union (line 29) | void Union(int p, int q) {
class Solution (line 46) | class Solution {
method minCostToSupplyWater (line 48) | int minCostToSupplyWater(int n, vector<int>& wells, vector<vector<int>...
FILE: cpp/1001-10000/1161-1170/Single-Row Keyboard.cpp
class Solution (line 1) | class Solution {
method calculateTime (line 3) | int calculateTime(string keyboard, string word) {
FILE: cpp/1001-10000/1171-1180/Can Make Palindrome from Substring.cpp
class Solution (line 1) | class Solution {
method canMakePaliQueries (line 3) | vector<bool> canMakePaliQueries(string s, vector<vector<int>>& queries) {
FILE: cpp/1001-10000/1171-1180/Count Substrings with Only One Distinct Letter.cpp
class Solution (line 1) | class Solution {
method countLetters (line 3) | int countLetters(string S) {
FILE: cpp/1001-10000/1171-1180/Diet Plan Performance.cpp
class Solution (line 1) | class Solution {
method dietPlanPerformance (line 3) | int dietPlanPerformance(vector<int>& calories, int k, int lower, int u...
FILE: cpp/1001-10000/1171-1180/Dinner Plate Stacks.cpp
class DinnerPlates (line 1) | class DinnerPlates {
method DinnerPlates (line 8) | DinnerPlates(int capacity) {
method push (line 13) | void push(int val) {
method pop (line 28) | int pop() {
method popAtStack (line 43) | int popAtStack(int index) {
FILE: cpp/1001-10000/1171-1180/Prime Arrangements.cpp
class Solution (line 1) | class Solution {
method isPrime (line 3) | bool isPrime(int k) {
method numPrimeArrangements (line 14) | int numPrimeArrangements(int n) {
FILE: cpp/1001-10000/1171-1180/Remove Zero Sum Consecutive Nodes from Linked List.cpp
class Solution (line 9) | class Solution {
method ListNode (line 11) | ListNode* removeZeroSumSublists(ListNode* head) {
FILE: cpp/1001-10000/1181-1190/Before and After Puzzle.cpp
class Solution (line 1) | class Solution {
method string (line 3) | string getfirst(string& s) {
method string (line 9) | string getlast(string& s) {
method beforeAndAfterPuzzles (line 16) | vector<string> beforeAndAfterPuzzles(vector<string>& phrases) {
FILE: cpp/1001-10000/1181-1190/Day of the Week.cpp
class Solution (line 1) | class Solution {
method string (line 3) | string dayOfTheWeek(int day, int month, int year) {
FILE: cpp/1001-10000/1181-1190/Design Bounded Blocking Queue.cpp
class BoundedBlockingQueue (line 2) | class BoundedBlockingQueue {
method BoundedBlockingQueue (line 10) | BoundedBlockingQueue(int capacity) {
method enqueue (line 15) | void enqueue(int element) {
method dequeue (line 32) | int dequeue() {
method size (line 50) | int size() {
FILE: cpp/1001-10000/1181-1190/Distance Between Bus Stops.cpp
class Solution (line 1) | class Solution {
method distanceBetweenBusStops (line 3) | int distanceBetweenBusStops(vector<int>& distance, int start, int dest...
FILE: cpp/1001-10000/1181-1190/Make Array Strictly Increasing.cpp
class Solution (line 1) | class Solution {
method makeArrayIncreasing (line 4) | int makeArrayIncreasing(vector<int>& arr1, vector<int>& arr2) {
method dfs (line 13) | int dfs(vector<int>& arr1, vector<int>& arr2, int i, int prev) {
FILE: cpp/1001-10000/1181-1190/Maximum Subarray Sum with One Deletion.cpp
class Solution (line 1) | class Solution {
method getV (line 3) | int getV(vector<int>& dp, int i) {
method maximumSum (line 9) | int maximumSum(vector<int>& arr) {
FILE: cpp/1001-10000/1181-1190/Shortest Distance to Target Color.cpp
class Solution (line 1) | class Solution {
method shortestDistanceColor (line 3) | vector<int> shortestDistanceColor(vector<int>& colors, vector<vector<i...
FILE: cpp/1001-10000/1191-1200/Minimum Knight Moves.cpp
class Solution (line 1) | class Solution {
method minKnightMoves (line 3) | int minKnightMoves(int x, int y) {
FILE: cpp/1001-10000/1201-1210/Design Skiplist.cpp
class Skiplist (line 1) | class Skiplist {
type Node (line 3) | struct Node {
method Node (line 6) | Node(Node *right, Node *down, int val): right(right), down(down), va...
method Skiplist (line 12) | Skiplist() {
method search (line 16) | bool search(int num) {
method add (line 32) | void add(int num) {
method erase (line 60) | bool erase(int num) {
FILE: cpp/1001-10000/1201-1210/Smallest String With Swaps.cpp
class Solution (line 1) | class Solution {
method dfs (line 3) | void dfs(int node, vector<int>& group, vector<int>& colors, map<int, v...
method string (line 15) | string smallestStringWithSwaps(string s, vector<vector<int>>& pairs) {
FILE: cpp/1001-10000/1221-1230/Dice Roll Simulation.cpp
class Solution (line 1) | class Solution {
method dieSimulator (line 3) | int dieSimulator(int n, vector<int>& rollMax) {
FILE: cpp/1001-10000/1221-1230/Queens That Can Attack the King.cpp
class Solution (line 1) | class Solution {
method queensAttacktheKing (line 3) | vector<vector<int>> queensAttacktheKing(vector<vector<int>>& queens, v...
FILE: cpp/1001-10000/1221-1230/Split a String in Balanced Strings.cpp
class Solution (line 1) | class Solution {
method balancedStringSplit (line 3) | int balancedStringSplit(string s) {
FILE: cpp/1001-10000/1231-1240/Maximum Profit in Job Scheduling.cpp
type Entry (line 1) | struct Entry {
class Solution (line 7) | class Solution {
method jobScheduling (line 9) | int jobScheduling(vector<int>& startTime, vector<int>& endTime, vector...
FILE: cpp/1001-10000/1231-1240/Replace the Substring for Balanced String.cpp
class Solution (line 1) | class Solution {
method balancedString (line 4) | int balancedString(string s) {
FILE: cpp/1001-10000/1241-1250/Minimum Remove to Make Valid Parentheses.cpp
class Solution (line 1) | class Solution {
method string (line 3) | string minRemoveToMakeValid(string s) {
FILE: cpp/1001-10000/1241-1250/Web Crawler Multithreaded.cpp
class Solution (line 9) | class Solution {
method string (line 21) | string extractHostName(const string& url){
method startWorker (line 31) | void startWorker(HtmlParser* parser){
method crawl (line 67) | vector<string> crawl(string startUrl, HtmlParser htmlParser) {
FILE: cpp/1001-10000/1261-1270/Greatest Sum Divisible by Three.cpp
class Solution (line 1) | class Solution {
method maxSumDivThree (line 3) | int maxSumDivThree(vector<int>& nums) {
FILE: cpp/1001-10000/1281-1290/Convert Binary Number in a Linked List to Integer.cpp
class Solution (line 9) | class Solution {
method getDecimalValue (line 11) | int getDecimalValue(ListNode* head) {
FILE: cpp/1001-10000/1281-1290/Element Appearing More Than 25% In Sorted Array.cpp
class Solution (line 1) | class Solution {
method findSpecialInteger (line 3) | int findSpecialInteger(vector<int>& arr) {
FILE: cpp/1001-10000/1281-1290/Remove Covered Intervals.cpp
class Solution (line 1) | class Solution {
method removeCoveredIntervals (line 3) | int removeCoveredIntervals(vector<vector<int>>& intervals) {
FILE: cpp/1001-10000/1291-1300/Maximum Side Length of a Square with Sum Less than or Equal to Threshold.cpp
class Solution (line 1) | class Solution {
method check (line 3) | bool check(const vector<vector<long>>& sum, int side_length, int m, in...
method maxSideLength (line 16) | int maxSideLength(vector<vector<int>>& mat, int threshold) {
FILE: cpp/1001-10000/1291-1300/Sequential Digits.cpp
class Solution (line 1) | class Solution {
method sequentialDigits (line 3) | vector<int> sequentialDigits(int low, int high) {
FILE: cpp/1001-10000/1311-1320/Minimum Distance to Type a Word Using Two Fingers.cpp
class Solution (line 1) | class Solution {
method distance (line 3) | int distance(int from, int to) {
method dfs (line 12) | int dfs(vector<vector<vector<int>>>& dp, const string& word, int index...
method minimumDistance (line 24) | int minimumDistance(string word) {
FILE: cpp/1001-10000/1411-1420/Minimum Value to Get Positive Step by Step Sum.cpp
class Solution (line 1) | class Solution {
method minStartValue (line 3) | int minStartValue(vector<int>& nums) {
FILE: cpp/1001-10000/1421-1430/Leftmost Column with at Least a One.cpp
class Solution (line 11) | class Solution {
method leftMostColumnWithOne (line 13) | int leftMostColumnWithOne(BinaryMatrix &binaryMatrix) {
FILE: cpp/1001-10000/1481-1490/Avoid Flood in The City.cpp
class Solution (line 1) | class Solution {
method avoidFlood (line 3) | vector<int> avoidFlood(vector<int>& rains) {
FILE: cpp/1001-10000/1481-1490/Find Critical and Pseudo-Critical Edges in Minimum Spanning Tree.cpp
class UF (line 1) | class UF {
method UF (line 11) | UF(int N) : parent(N), rank(N, 0), N(N), count(N) {
method find (line 17) | int find(int p) {
method getCount (line 25) | int getCount() const {
method connected (line 29) | bool connected(int p, int q) {
method Union (line 33) | void Union(int p, int q) {
class Solution (line 51) | class Solution {
method findCriticalAndPseudoCriticalEdges (line 53) | vector<vector<int>> findCriticalAndPseudoCriticalEdges(int n, vector<v...
FILE: cpp/1001-10000/1481-1490/Making File Names Unique.cpp
class Solution (line 1) | class Solution {
method getFolderNames (line 3) | vector<string> getFolderNames(vector<string>& names) {
FILE: cpp/1001-10000/1481-1490/XOR Operation in an Array.cpp
class Solution (line 1) | class Solution {
method xorOperation (line 3) | int xorOperation(int n, int start) {
FILE: cpp/1001-10000/1501-1510/Stone Game IV.cpp
class Solution (line 1) | class Solution {
method winnerSquareGame (line 3) | bool winnerSquareGame(int n) {
FILE: cpp/1001-10000/1541-1550/Minimum Insertions to Balance a Parentheses String.cpp
class Solution (line 1) | class Solution {
method minInsertions (line 3) | int minInsertions(string s) {
FILE: cpp/1001-10000/1561-1570/Dot Product of Two Sparse Vectors.cpp
class SparseVector (line 1) | class SparseVector {
method SparseVector (line 6) | SparseVector(vector<int> &nums) {
method dotProduct (line 15) | int dotProduct(SparseVector& vec) {
FILE: cpp/1001-10000/1621-1630/Arithmetic Subarrays.cpp
class Solution (line 1) | class Solution {
method check (line 3) | bool check(const vector<int>& vec) {
method checkArithmeticSubarrays (line 11) | vector<bool> checkArithmeticSubarrays(vector<int>& nums, vector<int>& ...
FILE: cpp/1001-10000/1621-1630/Slowest Key.cpp
class Solution (line 1) | class Solution {
method slowestKey (line 3) | char slowestKey(vector<int>& releaseTimes, string keysPressed) {
FILE: cpp/1001-10000/1631-1640/Check Array Formation Through Concatenation.cpp
class Solution (line 1) | class Solution {
method canFormArray (line 3) | bool canFormArray(vector<int>& arr, vector<vector<int>>& pieces) {
FILE: cpp/1001-10000/1631-1640/Number of Ways to Form a Target String Given a Dictionary.cpp
class Solution (line 1) | class Solution {
method numWays (line 3) | int numWays(vector<string>& words, string target) {
FILE: cpp/1001-10000/1631-1640/Path With Minimum Effort.cpp
class Solution (line 1) | class Solution {
method minimumEffortPath (line 3) | int minimumEffortPath(vector<vector<int>>& heights) {
FILE: cpp/1001-10000/1631-1640/Rank Transform of a Matrix.cpp
class UF (line 1) | class UF {
method validate (line 9) | bool validate(int p) {
method UF (line 15) | UF(int N) : parent(N), rank(N, 0), N(N), count(N) {
method find (line 21) | int find(int p) {
method getCount (line 30) | int getCount() const {
method connected (line 34) | bool connected(int p, int q) {
method Union (line 38) | void Union(int p, int q) {
class Solution (line 56) | class Solution {
method group (line 58) | vector<vector<pair<int, int>>> group(const vector<pair<int, int>>& pos...
method matrixRankTransform (line 96) | vector<vector<int>> matrixRankTransform(vector<vector<int>>& matrix) {
FILE: cpp/1001-10000/1641-1650/Count Sorted Vowel Strings.cpp
class Solution (line 1) | class Solution {
method countVowelStrings (line 3) | int countVowelStrings(int n) {
FILE: cpp/1001-10000/1641-1650/Create Sorted Array through Instructions.cpp
class Solution (line 2) | class Solution {
method left (line 6) | int left(int i) { return 2 * i + 1; }
method right (line 7) | int right(int i) { return 2 * i + 2; }
method query (line 9) | int query(int v_min, int v_max, int l, int r, int root) {
method update (line 21) | void update(int v, int l, int r, int root) {
method createSortedArray (line 39) | int createSortedArray(vector<int>& instructions) {
method left (line 66) | int left(int i) { return 2 * i + 1; }
method right (line 67) | int right(int i) { return 2 * i + 2; }
method query (line 69) | int query(int v_min, int v_max, int l, int r, int root) {
method update (line 81) | void update(int v, int l, int r, int root) {
method createSortedArray (line 99) | int createSortedArray(vector<int>& instructions) {
class Solution (line 62) | class Solution {
method left (line 6) | int left(int i) { return 2 * i + 1; }
method right (line 7) | int right(int i) { return 2 * i + 2; }
method query (line 9) | int query(int v_min, int v_max, int l, int r, int root) {
method update (line 21) | void update(int v, int l, int r, int root) {
method createSortedArray (line 39) | int createSortedArray(vector<int>& instructions) {
method left (line 66) | int left(int i) { return 2 * i + 1; }
method right (line 67) | int right(int i) { return 2 * i + 2; }
method query (line 69) | int query(int v_min, int v_max, int l, int r, int root) {
method update (line 81) | void update(int v, int l, int r, int root) {
method createSortedArray (line 99) | int createSortedArray(vector<int>& instructions) {
FILE: cpp/1001-10000/1641-1650/Furthest Building You Can Reach.cpp
class Solution (line 1) | class Solution {
method furthestBuilding (line 3) | int furthestBuilding(vector<int>& heights, int bricks, int ladders) {
FILE: cpp/1001-10000/1641-1650/Get Maximum in Generated Array.cpp
class Solution (line 1) | class Solution {
method getMaximumGenerated (line 3) | int getMaximumGenerated(int n) {
FILE: cpp/1001-10000/1641-1650/Kth Smallest Instructions.cpp
class Solution (line 1) | class Solution {
method string (line 3) | string kthSmallestPath(vector<int>& destination, int k) {
FILE: cpp/1001-10000/1641-1650/Lowest Common Ancestor of a Binary Tree II.cpp
class Solution (line 10) | class Solution {
method dfs (line 12) | pair<TreeNode*, int> dfs(TreeNode* root, TreeNode* p, TreeNode* q) {
method TreeNode (line 32) | TreeNode* lowestCommonAncestor(TreeNode* root, TreeNode* p, TreeNode* ...
FILE: cpp/1001-10000/1641-1650/Lowest Common Ancestor of a Binary Tree III.cpp
class Solution (line 12) | class Solution {
method Node (line 14) | Node* lowestCommonAncestor(Node* p, Node * q) {
FILE: cpp/1001-10000/1641-1650/Minimum Deletions to Make Character Frequencies Unique.cpp
class Solution (line 1) | class Solution {
method minDeletions (line 3) | int minDeletions(string s) {
FILE: cpp/1001-10000/1641-1650/Sell Diminishing-Valued Colored Balls.cpp
class Solution (line 1) | class Solution {
method get (line 3) | long get(long a, long b) {
method maxProfit (line 8) | int maxProfit(vector<int>& inventory, int orders) {
FILE: cpp/1001-10000/1671-1680/Lowest Common Ancestor of a Binary Tree IV.cpp
class Solution (line 12) | class Solution {
method TreeNode (line 14) | TreeNode* lowestCommonAncestor(TreeNode* root, const set<TreeNode*>& n...
method TreeNode (line 34) | TreeNode* lowestCommonAncestor(TreeNode* root, vector<TreeNode*> &node...
FILE: cpp/1001-10000/1671-1680/Minimum Moves to Make Array Complementary.cpp
class Solution (line 1) | class Solution {
method minMoves (line 3) | int minMoves(vector<int>& nums, int limit) {
FILE: cpp/1001-10000/1681-1690/Delivering Boxes from Storage to Ports.cpp
class Solution (line 1) | class Solution {
method boxDelivering (line 3) | int boxDelivering(vector<vector<int>>& boxes, int portsCount, int maxB...
FILE: cpp/1001-10000/1681-1690/Stone Game VI.cpp
class Solution (line 1) | class Solution {
method stoneGameVI (line 3) | int stoneGameVI(vector<int>& aliceValues, vector<int>& bobValues) {
FILE: cpp/1001-10000/1681-1690/Sum of Absolute Differences in a Sorted Array.cpp
class Solution (line 1) | class Solution {
method getSumAbsoluteDifferences (line 3) | vector<int> getSumAbsoluteDifferences(vector<int>& nums) {
FILE: cpp/1001-10000/1701-1710/Determine if String Halves Are Alike.cpp
class Solution (line 1) | class Solution {
method halvesAreAlike (line 3) | bool halvesAreAlike(string s) {
FILE: cpp/1001-10000/1701-1710/Maximum Number of Eaten Apples.cpp
class Solution (line 1) | class Solution {
method eatenApples (line 3) | int eatenApples(vector<int>& apples, vector<int>& days) {
FILE: cpp/1001-10000/1701-1710/Maximum Units on a Truck.cpp
class Solution (line 1) | class Solution {
method maximumUnits (line 3) | int maximumUnits(vector<vector<int>>& boxTypes, int truckSize) {
FILE: cpp/1001-10000/1701-1710/Maximum XOR With an Element From Array.cpp
class Solution (line 1) | class Solution {
class TreeNode (line 3) | class TreeNode {
method TreeNode (line 6) | TreeNode () {next[0] = nullptr; next[1] = nullptr;}
method TreeNode (line 8) | TreeNode* buildTree(vector<int>& nums) {
method TreeNode (line 6) | TreeNode () {next[0] = nullptr; next[1] = nullptr;}
method dfs (line 24) | int dfs(TreeNode* root, int x, int limit, int value, int height) {
method maximizeXor (line 44) | vector<int> maximizeXor(vector<int>& nums, vector<vector<int>>& querie...
FILE: cpp/1001-10000/1701-1710/Where Will the Ball Fall.cpp
class Solution (line 1) | class Solution {
method findBall (line 4) | vector<int> findBall(vector<vector<int>>& grid) {
FILE: cpp/1001-10000/1711-1720/Count Good Meals.cpp
class Solution (line 1) | class Solution {
method countPairs (line 3) | int countPairs(vector<int>& deliciousness) {
FILE: cpp/1001-10000/1711-1720/Decode XORed Array.cpp
class Solution (line 1) | class Solution {
method decode (line 3) | vector<int> decode(vector<int>& encoded, int first) {
FILE: cpp/1001-10000/1711-1720/Minimum Operations to Make a Subsequence.cpp
class Solution (line 1) | class Solution {
method lengthOfLIS (line 3) | int lengthOfLIS(vector<int>& nums) {
method minOperations (line 14) | int minOperations(vector<int>& target, vector<int>& arr) {
FILE: cpp/1001-10000/1711-1720/Ways to Split Array Into Three Subarrays.cpp
class Solution (line 1) | class Solution {
method waysToSplit (line 3) | int waysToSplit(vector<int>& nums) {
method waysToSplit (line 47) | int waysToSplit(vector<int>& nums) {
class Solution (line 45) | class Solution {
method waysToSplit (line 3) | int waysToSplit(vector<int>& nums) {
method waysToSplit (line 47) | int waysToSplit(vector<int>& nums) {
FILE: cpp/1001-10000/1721-1730/Find Minimum Time to Finish All Jobs.cpp
class Solution (line 1) | class Solution {
method dfs (line 5) | void dfs(vector<int>& jobs, int k, vector<int>& workers, int curr) {
method minimumTimeRequired (line 24) | int minimumTimeRequired(vector<int>& jobs, int k) {
FILE: cpp/1001-10000/1721-1730/Largest Submatrix With Rearrangements.cpp
class Solution (line 1) | class Solution {
method largestSubmatrix (line 3) | int largestSubmatrix(vector<vector<int>>& matrix) {
FILE: cpp/1001-10000/1721-1730/Minimize Hamming Distance After Swap Operations.cpp
class UF (line 1) | class UF {
method validate (line 9) | bool validate(int p) {
method UF (line 15) | UF(int N) : parent(N), rank(N, 0), N(N), count(N) {
method find (line 21) | int find(int p) {
method getCount (line 30) | int getCount() const {
method connected (line 34) | bool connected(int p, int q) {
method Union (line 38) | void Union(int p, int q) {
class Solution (line 56) | class Solution {
method minimumHammingDistance (line 58) | int minimumHammingDistance(vector<int>& source, vector<int>& target, v...
FILE: cpp/1001-10000/1721-1730/Number Of Rectangles That Can Form The Largest Square.cpp
class Solution (line 1) | class Solution {
method countGoodRectangles (line 3) | int countGoodRectangles(vector<vector<int>>& rectangles) {
FILE: cpp/1001-10000/1721-1730/Swapping Nodes in a Linked List.cpp
class Solution (line 11) | class Solution {
method ListNode (line 13) | ListNode* swapNodes(ListNode* head, int k) {
FILE: cpp/1001-10000/1721-1730/Tuple with Same Product.cpp
class Solution (line 1) | class Solution {
method tupleSameProduct (line 3) | int tupleSameProduct(vector<int>& nums) {
FILE: cpp/1001-10000/1731-1740/Building Boxes.cpp
class Solution (line 1) | class Solution {
method minimumBoxes (line 3) | int minimumBoxes(int n) {
FILE: cpp/1001-10000/1751-1760/Closest Subsequence Sum.cpp
class Solution (line 1) | class Solution {
method maxValue (line 4) | int maxValue(vector<vector<int>>& events, int k) {
FILE: cpp/1001-10000/1751-1760/Largest Merge Of Two Strings.cpp
class Solution (line 1) | class Solution {
method string (line 4) | string largestMerge(string word1, string word2) {
FILE: cpp/1001-10000/1751-1760/Maximum Number of Events That Can Be Attended II.cpp
class Solution (line 1) | class Solution {
method maxValue (line 4) | int maxValue(vector<vector<int>>& events, int k) {
FILE: cpp/1001-10000/1751-1760/Minimum Limit of Balls in a Bag.cpp
class Solution (line 1) | class Solution {
method check (line 3) | bool check(const vector<int>& nums, int maxOperations, int penalty) {
method minimumSize (line 12) | int minimumSize(vector<int>& nums, int maxOperations) {
FILE: cpp/1001-10000/1761-1770/Form Array by Concatenating Subarrays of Another Array.cpp
class Solution (line 1) | class Solution {
method MatchGroup (line 3) | int MatchGroup(const vector<int>& group, const vector<int>& nums, int...
method canChoose (line 22) | bool canChoose(vector<vector<int>>& groups, vector<int>& nums) {
FILE: cpp/1001-10000/1761-1770/Map of Highest Peak.cpp
class Solution (line 1) | class Solution {
method highestPeak (line 3) | vector<vector<int>> highestPeak(vector<vector<int>>& isWater) {
FILE: cpp/1001-10000/1761-1770/Maximum Score from Performing Multiplication Operations.cpp
class Solution (line 1) | class Solution {
method maximumScore (line 3) | int maximumScore(vector<int>& nums, vector<int>& multipliers) {
FILE: cpp/1001-10000/1761-1770/Minimum Degree of a Connected Trio in a Graph.cpp
class Solution (line 1) | class Solution {
method minTrioDegree (line 3) | int minTrioDegree(int n, vector<vector<int>>& edges) {
FILE: cpp/1001-10000/1761-1770/Tree of Coprimes.cpp
class Solution (line 1) | class Solution {
method dfs (line 3) | void dfs(int node, const vector<int>& nums, const vector<vector<int>>&...
method getCoprimes (line 33) | vector<int> getCoprimes(vector<int>& nums, vector<vector<int>>& edges) {
FILE: cpp/1001-10000/1771-1780/Car Fleet II.cpp
class Solution (line 1) | class Solution {
method getCollisionTimes (line 3) | vector<double> getCollisionTimes(vector<vector<int>>& cars) {
FILE: cpp/1001-10000/1771-1780/Check if Number is a Sum of Powers of Three.cpp
class Solution (line 1) | class Solution {
method checkPowersOfThree (line 3) | bool checkPowersOfThree(int n) {
FILE: cpp/1001-10000/1771-1780/Closest Dessert Cost.cpp
class Solution (line 1) | class Solution {
method closestCost (line 3) | int closestCost(vector<int>& baseCosts, vector<int>& toppingCosts, int...
FILE: cpp/1001-10000/1771-1780/Equal Sum Arrays With Minimum Number of Operations.cpp
class Solution (line 1) | class Solution {
method process (line 3) | int process(int* table1, int* table2, int diff) {
method minOperations (line 24) | int minOperations(vector<int>& nums1, vector<int>& nums2) {
FILE: cpp/1001-10000/1771-1780/Find Nearest Point That Has the Same X or Y Coordinate.cpp
class Solution (line 1) | class Solution {
method nearestValidPoint (line 3) | int nearestValidPoint(int x, int y, vector<vector<int>>& points) {
FILE: cpp/1001-10000/1771-1780/Maximize Palindrome Length From Subsequences.cpp
class Solution (line 1) | class Solution {
method longestPalindrome (line 3) | int longestPalindrome(string word1, string word2) {
FILE: cpp/1001-10000/1771-1780/Shortest Path in a Hidden Grid.cpp
class Solution (line 12) | class Solution {
method ConstructGrid (line 15) | void ConstructGrid(vector<vector<int>>& grid, GridMaster &master, int ...
method findShortestPath (line 40) | int findShortestPath(GridMaster &master) {
FILE: cpp/1001-10000/1781-1790/Check if Binary String Has at Most One Segment of Ones.cpp
class Solution (line 1) | class Solution {
method checkOnesSegment (line 3) | bool checkOnesSegment(string s) {
FILE: cpp/1001-10000/1781-1790/Check if One String Swap Can Make Strings Equal.cpp
class Solution (line 1) | class Solution {
method areAlmostEqual (line 3) | bool areAlmostEqual(string s1, string s2) {
FILE: cpp/1001-10000/1781-1790/Count Pairs Of Nodes.cpp
class Solution (line 1) | class Solution {
method countPairs (line 3) | vector<int> countPairs(int n, vector<vector<int>>& edges, vector<int>&...
FILE: cpp/1001-10000/1781-1790/Make the XOR of All Segments Equal to Zero.cpp
class Solution (line 1) | class Solution {
method minChanges (line 3) | int minChanges(vector<int>& nums, int k) {
FILE: cpp/1001-10000/1781-1790/Maximize the Beauty of the Garden.cpp
class Solution (line 1) | class Solution {
method maximumBeauty (line 3) | int maximumBeauty(vector<int>& flowers) {
FILE: cpp/1001-10000/1781-1790/Minimum Elements to Add to Form a Given Sum.cpp
class Solution (line 1) | class Solution {
method minElements (line 3) | int minElements(vector<int>& nums, int limit, int goal) {
FILE: cpp/1001-10000/1781-1790/Number of Restricted Paths From First to Last Node.cpp
class Solution (line 1) | class Solution {
method bfs (line 4) | void bfs(int n, const vector<vector<pair<int, int>>>& graph, vector<in...
method countRestrictedPaths (line 33) | int countRestrictedPaths(int n, vector<vector<int>>& edges) {
FILE: cpp/1001-10000/1781-1790/Sum of Beauty of All Substrings.cpp
class Solution (line 1) | class Solution {
method beautySum (line 3) | int beautySum(string s) {
FILE: cpp/1001-10000/1791-1800/Count Pairs of Equal Substrings With Minimum Difference.cpp
class Solution (line 1) | class Solution {
method countQuadruples (line 3) | int countQuadruples(string firstString, string secondString) {
FILE: cpp/1001-10000/1791-1800/Design Authentication Manager.cpp
class AuthenticationManager (line 1) | class AuthenticationManager {
method AuthenticationManager (line 5) | AuthenticationManager(int timeToLive) {
method generate (line 9) | void generate(string tokenId, int currentTime) {
method renew (line 13) | void renew(string tokenId, int currentTime) {
method countUnexpiredTokens (line 25) | int countUnexpiredTokens(int currentTime) {
FILE: cpp/1001-10000/1791-1800/Find Center of Star Graph.cpp
class Solution (line 1) | class Solution {
method findCenter (line 3) | int findCenter(vector<vector<int>>& edges) {
FILE: cpp/1001-10000/1791-1800/Maximize Score After N Operations.cpp
class Solution (line 1) | class Solution {
method dfs (line 2) | int dfs(const vector<int>& nums, int round, int state, unordered_map<i...
method maxScore (line 23) | int maxScore(vector<int>& nums) {
FILE: cpp/1001-10000/1791-1800/Maximum Ascending Subarray Sum.cpp
class Solution (line 1) | class Solution {
method maxAscendingSum (line 3) | int maxAscendingSum(vector<int>& nums) {
FILE: cpp/1001-10000/1791-1800/Maximum Average Pass Ratio.cpp
class Solution (line 4) | class Solution {
method maxAverageRatio (line 6) | double maxAverageRatio(vector<vector<int>>& classes, int extraStudents) {
method GetIncrease (line 45) | double GetIncrease(int dividend, int divisor) {
method maxAverageRatio (line 51) | double maxAverageRatio(vector<vector<int>>& classes, int extraStudents) {
class Solution (line 44) | class Solution {
method maxAverageRatio (line 6) | double maxAverageRatio(vector<vector<int>>& classes, int extraStudents) {
method GetIncrease (line 45) | double GetIncrease(int dividend, int divisor) {
method maxAverageRatio (line 51) | double maxAverageRatio(vector<vector<int>>& classes, int extraStudents) {
FILE: cpp/1001-10000/1791-1800/Maximum Number of Consecutive Values You Can Make.cpp
class Solution (line 1) | class Solution {
method getMaximumConsecutive (line 3) | int getMaximumConsecutive(vector<int>& coins) {
FILE: cpp/1001-10000/1791-1800/Maximum Score of a Good Subarray.cpp
class Solution (line 1) | class Solution {
method maximumScore (line 3) | int maximumScore(vector<int>& nums, int k) {
FILE: cpp/1001-10000/1791-1800/Second Largest Digit in a String.cpp
class Solution (line 1) | class Solution {
method secondHighest (line 3) | int secondHighest(string s) {
FILE: cpp/1001-10000/1801-1810/Count Pairs With XOR in a Range.cpp
class Solution (line 1) | class Solution {
class TreeNode (line 5) | class TreeNode {
method TreeNode (line 9) | TreeNode () {
method insert (line 16) | void insert(TreeNode* root, int num) {
method GetCount (line 27) | int GetCount(TreeNode* root, int num, int limit) {
method countPairs (line 52) | int countPairs(vector<int>& nums, int low, int high) {
FILE: cpp/1001-10000/1801-1810/Evaluate the Bracket Pairs of a String.cpp
class Solution (line 1) | class Solution {
method string (line 3) | string evaluate(string s, vector<vector<string>>& knowledge) {
FILE: cpp/1001-10000/1801-1810/Implement Trie II (Prefix Tree).cpp
class Trie (line 1) | class Trie {
type TrieNode (line 3) | struct TrieNode {
method TrieNode (line 8) | TrieNode() {
method Trie (line 18) | Trie() {
method insert (line 22) | void insert(string word) {
method countWordsEqualTo (line 35) | int countWordsEqualTo(string word) {
method countWordsStartingWith (line 47) | int countWordsStartingWith(string prefix) {
method erase (line 59) | void erase(string word) {
FILE: cpp/1001-10000/1801-1810/Maximize Number of Nice Divisors.cpp
class Solution (line 1) | class Solution {
method maxNiceDivisors (line 6) | int maxNiceDivisors(int primeFactors) {
FILE: cpp/1001-10000/1801-1810/Maximum Value at a Given Index in a Bounded Array.cpp
class Solution (line 1) | class Solution {
method getSumInRange (line 3) | long getSumInRange(long peak, int length) {
method check (line 15) | bool check(int n, int index, int maxSum, int peak) {
method maxValue (line 21) | int maxValue(int n, int index, int maxSum) {
FILE: cpp/1001-10000/1801-1810/Minimum Path Cost in a Hidden Grid.cpp
class Solution (line 12) | class Solution {
method ConstructGrid (line 16) | void ConstructGrid(vector<vector<int>>& grid, GridMaster &master, int ...
method findShortestPath (line 42) | int findShortestPath(GridMaster &master) {
FILE: cpp/1001-10000/1801-1810/Number of Different Integers in a String.cpp
class Solution (line 1) | class Solution {
method numDifferentIntegers (line 3) | int numDifferentIntegers(string word) {
FILE: cpp/1001-10000/1801-1810/Number of Orders in the Backlog.cpp
class Solution (line 1) | class Solution {
method getNumberOfBacklogOrders (line 3) | int getNumberOfBacklogOrders(vector<vector<int>>& orders) {
FILE: cpp/1001-10000/1811-1820/Count Nice Pairs in an Array.cpp
class Solution (line 1) | class Solution {
method reverse (line 3) | int reverse(int x) {
method countNicePairs (line 12) | int countNicePairs(vector<int>& nums) {
FILE: cpp/1001-10000/1811-1820/Determine Color of a Chessboard Square.cpp
class Solution (line 1) | class Solution {
method squareIsWhite (line 3) | bool squareIsWhite(string coordinates) {
FILE: cpp/1001-10000/1811-1820/Finding the Users Active Minutes.cpp
class Solution (line 1) | class Solution {
method findingUsersActiveMinutes (line 3) | vector<int> findingUsersActiveMinutes(vector<vector<int>>& logs, int k) {
FILE: cpp/1001-10000/1811-1820/Maximum Number of Accepted Invitations.cpp
class Solution (line 1) | class Solution {
method BipartiteMatch (line 4) | bool BipartiteMatch(const vector<vector<int>>& grid, int u, vector<boo...
method maximumInvitations (line 20) | int maximumInvitations(vector<vector<int>>& grid) {
FILE: cpp/1001-10000/1811-1820/Maximum Number of Groups Getting Fresh Donuts.cpp
class Solution (line 1) | class Solution {
method string (line 3) | string GetKey(const vector<int>& cnts) {
method dfs (line 11) | int dfs(vector<int>& cnts, int remain, int batchSize, unordered_map<st...
method maxHappyGroups (line 30) | int maxHappyGroups(int batchSize, vector<int>& groups) {
FILE: cpp/1001-10000/1811-1820/Minimum Absolute Sum Difference.cpp
class Solution (line 1) | class Solution {
method minAbsoluteSumDiff (line 3) | int minAbsoluteSumDiff(vector<int>& nums1, vector<int>& nums2) {
FILE: cpp/1001-10000/1811-1820/Number of Different Subsequences GCDs.cpp
class Solution (line 1) | class Solution {
method countDifferentSubsequenceGCDs (line 3) | int countDifferentSubsequenceGCDs(vector<int>& nums) {
FILE: cpp/1001-10000/1811-1820/Sentence Similarity III.cpp
class Solution (line 1) | class Solution {
method split (line 3) | vector<string> split(const string &s, char delim) {
method areSentencesSimilar (line 15) | bool areSentencesSimilar(string sentence1, string sentence2) {
FILE: cpp/1001-10000/1811-1820/Truncate Sentence.cpp
class Solution (line 1) | class Solution {
method string (line 3) | string truncateSentence(string s, int k) {
FILE: cpp/1001-10000/1821-1830/Faulty Sensor.cpp
class Solution (line 1) | class Solution {
method badSensor (line 3) | int badSensor(vector<int>& sensor1, vector<int>& sensor2) {
FILE: cpp/1001-10000/1821-1830/Finding MK Average.cpp
class MKAverage (line 1) | class MKAverage {
method InitializeMultiset (line 12) | void InitializeMultiset() {
method MKAverage (line 32) | MKAverage(int m, int k) {
method AddElement (line 37) | void AddElement(int val) {
method RemoveElement (line 62) | void RemoveElement() {
method addElement (line 83) | void addElement(int num) {
method calculateMKAverage (line 90) | int calculateMKAverage() {
FILE: cpp/1001-10000/1821-1830/Maximum XOR for Each Query.cpp
class Solution (line 1) | class Solution {
method getMaximumXor (line 3) | vector<int> getMaximumXor(vector<int>& nums, int maximumBit) {
FILE: cpp/1001-10000/1821-1830/Minimum Number of Operations to Make String Sorted.cpp
class Solution (line 1) | class Solution {
method pow (line 4) | long pow(long a, long p, long mod) {
method makeStringSorted (line 17) | int makeStringSorted(string s) {
FILE: cpp/1001-10000/1821-1830/Minimum Operations to Make the Array Increasing.cpp
class Solution (line 1) | class Solution {
method minOperations (line 3) | int minOperations(vector<int>& nums) {
FILE: cpp/1001-10000/1821-1830/Minimum Sideway Jumps.cpp
class Solution (line 1) | class Solution {
method minSideJumps (line 3) | int minSideJumps(vector<int>& obstacles) {
FILE: cpp/1001-10000/1821-1830/Queries on Number of Points Inside a Circle.cpp
class Solution (line 1) | class Solution {
method countPoints (line 3) | vector<int> countPoints(vector<vector<int>>& points, vector<vector<int...
FILE: cpp/1001-10000/1821-1830/Sign of the Product of an Array.cpp
class Solution (line 1) | class Solution {
method arraySign (line 3) | int arraySign(vector<int>& nums) {
FILE: cpp/1001-10000/1831-1840/Check if the Sentence Is Pangram.cpp
class Solution (line 1) | class Solution {
method checkIfPangram (line 3) | bool checkIfPangram(string sentence) {
FILE: cpp/1001-10000/1831-1840/Find XOR Sum of All Pairs Bitwise AND.cpp
class Solution (line 1) | class Solution {
method getXORSum (line 3) | int getXORSum(vector<int>& arr1, vector<int>& arr2) {
FILE: cpp/1001-10000/1831-1840/Longest Substring Of All Vowels in Order.cpp
class Solution (line 1) | class Solution {
method longestBeautifulSubstring (line 3) | int longestBeautifulSubstring(string word) {
FILE: cpp/1001-10000/1831-1840/Maximum Building Height.cpp
class Solution (line 1) | class Solution {
method maxBuilding (line 3) | int maxBuilding(int n, vector<vector<int>>& restrictions) {
FILE: cpp/1001-10000/1831-1840/Maximum Ice Cream Bars.cpp
class Solution (line 1) | class Solution {
method maxIceCream (line 3) | int maxIceCream(vector<int>& costs, int coins) {
FILE: cpp/1001-10000/1831-1840/Remove Duplicates From an Unsorted Linked List.cpp
class Solution (line 11) | class Solution {
method ListNode (line 13) | ListNode* deleteDuplicatesUnsorted(ListNode* head) {
FILE: cpp/1001-10000/1831-1840/Single-Threaded CPU.cpp
class Solution (line 1) | class Solution {
method getOrder (line 3) | vector<int> getOrder(vector<vector<int>>& tasks) {
FILE: cpp/1001-10000/1831-1840/Sum of Digits in Base K.cpp
class Solution (line 1) | class Solution {
method sumBase (line 3) | int sumBase(int n, int k) {
FILE: cpp/1001-10000/1841-1850/Closest Room.cpp
class Solution (line 1) | class Solution {
method closestRoom (line 3) | vector<int> closestRoom(vector<vector<int>>& rooms, vector<vector<int>...
FILE: cpp/1001-10000/1841-1850/Minimum Adjacent Swaps to Reach the Kth Smallest Number.cpp
class Solution (line 1) | class Solution {
method getMinSwaps (line 3) | int getMinSwaps(string num, int k) {
FILE: cpp/1001-10000/1851-1860/Minimum Interval to Include Each Query.cpp
class Solution (line 1) | class Solution {
method minInterval (line 3) | vector<int> minInterval(vector<vector<int>>& intervals, vector<int>& q...
FILE: cpp/101-110/Balanced Binary Tree.cpp
class Solution (line 1) | class Solution {
method help (line 3) | int help(TreeNode *root, bool& flag) {
method isBalanced (line 13) | bool isBalanced(TreeNode *root) {
FILE: cpp/101-110/Binary Tree Level Order Traversal II.cpp
class Solution (line 1) | class Solution {
method help (line 3) | void help(TreeNode *root, int level, vector<vector<int>>& results)
method levelOrderBottom (line 19) | vector<vector<int> > levelOrderBottom(TreeNode *root) {
FILE: cpp/101-110/Binary Tree Level Order Traversal.cpp
class Solution (line 10) | class Solution {
method levelOrder (line 12) | vector<vector<int>> levelOrder(TreeNode* root) {
FILE: cpp/101-110/Binary Tree Zigzag Level Order Traversal.cpp
class Solution (line 1) | class Solution {
method zigzagLevelOrder (line 4) | vector<vector<int> > zigzagLevelOrder(TreeNode *root) {
FILE: cpp/101-110/Construct Binary Tree from Inorder and Postorder Traversal.cpp
class Solution (line 1) | class Solution {
method TreeNode (line 3) | TreeNode* helper(vector<int>& postorder,int i,int j,vector<int>& inord...
method TreeNode (line 15) | TreeNode* buildTree(vector<int>& inorder, vector<int>& postorder) {
FILE: cpp/101-110/Construct Binary Tree from Preorder and Inorder Traversal.cpp
class Solution (line 1) | class Solution {
method TreeNode (line 3) | TreeNode* helper(vector<int>& preorder,int i,int j,vector<int>& inorde...
method TreeNode (line 15) | TreeNode* buildTree(vector<int>& preorder, vector<int>& inorder) {
FILE: cpp/101-110/Convert Sorted Array to Binary Search Tree.cpp
class Solution (line 1) | class Solution {
method TreeNode (line 3) | TreeNode *help(vector<int>::iterator it1, vector<int>::iterator it2) {
method TreeNode (line 16) | TreeNode *sortedArrayToBST(vector<int> &num) {
FILE: cpp/101-110/Convert Sorted List to Binary Search Tree.cpp
class Solution (line 18) | class Solution {
method len (line 22) | int len(ListNode *head)
method TreeNode (line 32) | TreeNode *help(int n)
method TreeNode (line 44) | TreeNode *sortedListToBST(ListNode *head) {
FILE: cpp/101-110/Maximum Depth of Binary Tree.cpp
class Solution (line 1) | class Solution {
method maxDepth (line 3) | int maxDepth(TreeNode *root) {
FILE: cpp/101-110/Symmetric Tree.cpp
class Solution (line 1) | class Solution {
method isSymmetric (line 3) | bool isSymmetric(TreeNode *root) {
FILE: cpp/111-120/Distinct Subsequences.cpp
class Solution (line 1) | class Solution {
method numDistinct (line 3) | int numDistinct(string s, string t) {
FILE: cpp/111-120/Flatten Binary Tree to Linked List.cpp
class Solution (line 1) | class Solution {
method TreeNode (line 3) | TreeNode* flatten(TreeNode* root, TreeNode* pre) {
method flatten (line 14) | void flatten(TreeNode* root) {
FILE: cpp/111-120/Minimum Depth of Binary Tree.cpp
class Solution (line 1) | class Solution {
method help (line 3) | int help(TreeNode *root)
method minDepth (line 16) | int minDepth(TreeNode *root) {
FILE: cpp/111-120/Pascal's Triangle II.cpp
class Solution (line 1) | class Solution {
method getRow (line 3) | vector<int> getRow(int rowIndex) {
FILE: cpp/111-120/Pascal's Triangle.cpp
class Solution (line 1) | class Solution {
method generate (line 3) | vector<vector<int> > generate(int numRows) {
FILE: cpp/111-120/Path Sum II.cpp
class Solution (line 1) | class Solution {
method pathSum (line 3) | vector<vector<int>> pathSum(TreeNode* root, int sum) {
method findPaths (line 10) | void findPaths(TreeNode* node, int sum, vector<int>& path, vector<vect...
FILE: cpp/111-120/Path Sum.cpp
class Solution (line 1) | class Solution {
method hasPathSum (line 4) | bool hasPathSum(TreeNode *root, int sum) {
FILE: cpp/111-120/Populating Next Right Pointers in Each Node II.cpp
class Solution (line 9) | class Solution {
method connect (line 11) | void connect(TreeLinkNode *root) {
FILE: cpp/111-120/Populating Next Right Pointers in Each Node.cpp
class Solution (line 1) | class Solution {
method connect (line 3) | void connect(TreeLinkNode *root) {
FILE: cpp/111-120/Triangle.cpp
class Solution (line 1) | class Solution {
method minimumTotal (line 3) | int minimumTotal(vector<vector<int> > &triangle) {
FILE: cpp/121-130/Best Time to Buy and Sell Stock II.cpp
class Solution (line 1) | class Solution {
method maxProfit (line 3) | int maxProfit(vector<int> &prices) {
FILE: cpp/121-130/Best Time to Buy and Sell Stock III.cpp
class Solution (line 1) | class Solution {
method maxProfit (line 6) | int maxProfit(vector<int> &prices) {
FILE: cpp/121-130/Best Time to Buy and Sell Stock.cpp
class Solution (line 1) | class Solution {
method maxProfit (line 3) | int maxProfit(vector<int> &prices) {
FILE: cpp/121-130/Binary Tree Maximum Path Sum.cpp
class Solution (line 1) | class Solution {
method dfs (line 3) | int dfs(TreeNode *root, int& result) {
method maxPathSum (line 16) | int maxPathSum(TreeNode *root) {
FILE: cpp/121-130/Longest Consecutive Sequence.cpp
class Solution (line 1) | class Solution {
method longestConsecutive (line 3) | int longestConsecutive(vector<int>& nums) {
FILE: cpp/121-130/Sum Root to Leaf Numbers.cpp
class Solution (line 1) | class Solution {
method help (line 3) | int help(TreeNode *root, int pVal)
method sumNumbers (line 19) | int sumNumbers(TreeNode *root) {
FILE: cpp/121-130/Surrounded Regions.cpp
class Solution (line 1) | class Solution {
method help (line 3) | void help(vector<vector<char>> &board, int ii, int jj)
method solve (line 31) | void solve(vector<vector<char>> &board) {
FILE: cpp/121-130/Valid Palindrome.cpp
class Solution (line 1) | class Solution {
method isPalindrome (line 4) | bool isPalindrome(string s) {
FILE: cpp/121-130/Word Ladder II.cpp
class Solution (line 1) | class Solution {
method findLadders (line 3) | vector<vector<string>> findLadders(string beginWord, string endWord, v...
method helper (line 37) | void helper(string start, string end, unordered_map<string, vector<str...
FILE: cpp/121-130/Word Ladder.cpp
class Solution (line 3) | class Solution {
method ladderLength (line 5) | int ladderLength(string beginWord, string endWord, vector<string>& wor...
FILE: cpp/131-140/Candy.cpp
class Solution (line 1) | class Solution {
method candy (line 3) | int candy(vector<int>& ratings) {
FILE: cpp/131-140/Clone Graph.cpp
class Solution (line 16) | class Solution {
method Node (line 20) | Node* cloneGraph(Node* node) {
FILE: cpp/131-140/Copy List with Random Pointer.cpp
class Solution (line 1) | class Solution {
method RandomListNode (line 3) | RandomListNode *copyRandomList(RandomListNode *head) {
FILE: cpp/131-140/Gas Station.cpp
class Solution (line 1) | class Solution {
method canCompleteCircuit (line 3) | int canCompleteCircuit(vector<int>& gas, vector<int>& cost) {
FILE: cpp/131-140/Palindrome Partitioning II.cpp
class Solution (line 1) | class Solution {
method minCut (line 3) | int minCut(string s) {
FILE: cpp/131-140/Palindrome Partitioning.cpp
class Solution (line 1) | class Solution {
method dfs (line 3) | void dfs(int index, string& s, vector<string>& path, vector<vector<str...
method partition (line 19) | vector<vector<string>> partition(string s) {
FILE: cpp/131-140/Single Number II.cpp
class Solution (line 1) | class Solution {
method singleNumber (line 3) | int singleNumber(vector<int>& nums) {
FILE: cpp/131-140/Single Number.cpp
class Solution (line 1) | class Solution {
method singleNumber (line 3) | int singleNumber(vector<int>& nums) {
FILE: cpp/131-140/Word Break II.cpp
class Solution (line 1) | class Solution {
method dfs (line 5) | vector<string> dfs(string s, unordered_set<string>& dict) {
method wordBreak (line 28) | vector<string> wordBreak(string s, vector<string>& wordDict) {
FILE: cpp/131-140/Word Break.cpp
class Solution (line 1) | class Solution {
method wordBreak (line 3) | bool wordBreak(string s, vector<string>& wordDict) {
FILE: cpp/141-150/Binary Tree Postorder Traversal.cpp
class Solution (line 1) | class Solution {
method postorderTraversal (line 3) | vector<int> postorderTraversal(TreeNode* root) {
FILE: cpp/141-150/Evaluate Reverse Polish Notation.cpp
class Solution (line 1) | class Solution {
method evalRPN (line 3) | int evalRPN(vector<string> &tokens) {
FILE: cpp/141-150/Insertion Sort List.cpp
class Solution (line 1) | class Solution {
method ListNode (line 4) | ListNode *insertionSortList(ListNode *head) {
FILE: cpp/141-150/LRU Cache.cpp
class LRUCache (line 1) | class LRUCache {
method LRUCache (line 3) | LRUCache(int capacity) : _capacity(capacity) {}
method get (line 5) | int get(int key) {
method set (line 12) | void set(int key, int value) {
method touch (line 30) | void touch(HIPII::iterator it) {
FILE: cpp/141-150/Linked List Cycle II.cpp
class Solution (line 9) | class Solution {
method ListNode (line 11) | ListNode *detectCycle(ListNode *head) {
FILE: cpp/141-150/Linked List Cycle.cpp
class Solution (line 9) | class Solution {
method hasCycle (line 11) | bool hasCycle(ListNode *head) {
FILE: cpp/141-150/Max Points on a Line.cpp
class Solution (line 1) | class Solution {
method maxPoints (line 3) | int maxPoints(vector<vector<int>> &points) {
FILE: cpp/141-150/Reorder List.cpp
class Solution (line 1) | class Solution {
method ListNode (line 3) | ListNode* reverse(ListNode *head)
method reorderList (line 19) | void reorderList(ListNode *head) {
FILE: cpp/141-150/Sort List.cpp
class Solution (line 1) | class Solution {
method ListNode (line 5) | ListNode* merge(ListNode *node1, int n1, ListNode *node2, int n2, List...
method lengthOfList (line 58) | int lengthOfList(ListNode *node)
method ListNode (line 69) | ListNode* find(ListNode* node, int L)
method ListNode (line 79) | ListNode *sortList(ListNode *head) {
FILE: cpp/141-150/Tree Preorder Traversal.cpp
class Solution (line 1) | class Solution {
method preorderTraversal (line 3) | vector<int> preorderTraversal(TreeNode *root) {
FILE: cpp/151-160/Binary Tree Upside Down.cpp
class Solution (line 10) | class Solution {
method TreeNode (line 14) | TreeNode* upsideDownBinaryTree(TreeNode* root) {
FILE: cpp/151-160/Find Minimum in Rotated Sorted Array II.cpp
class Solution (line 1) | class Solution {
method findMin (line 3) | int findMin(vector<int>& nums) {
FILE: cpp/151-160/Find Minimum in Rotated Sorted Array.cpp
class Solution (line 1) | class Solution {
method findMin (line 3) | int findMin(vector<int>& nums) {
FILE: cpp/151-160/Intersection of Two Linked Lists.cpp
class Solution (line 1) | class Solution {
method getLen (line 3) | int getLen(ListNode *head) {
method ListNode (line 13) | ListNode *getIntersectionNode(ListNode *headA, ListNode *headB) {
FILE: cpp/151-160/Longest Substring with At Most Two Distinct Characters.cpp
class Solution (line 1) | class Solution {
method lengthOfLongestSubstringTwoDistinct (line 3) | int lengthOfLongestSubstringTwoDistinct(string s) {
FILE: cpp/151-160/Maximum Product Subarray.cpp
class Solution (line 1) | class Solution {
method maxProduct (line 3) | int maxProduct(vector<int>& nums) {
FILE: cpp/151-160/Min Stack.cpp
class MinStack (line 1) | class MinStack {
method push (line 7) | void push(int x) {
method pop (line 12) | void pop() {
method top (line 19) | int top() {
method getMin (line 23) | int getMin() {
FILE: cpp/151-160/Read N Characters Given Read4 II - Call multiple times.cpp
class Solution (line 1) | class Solution {
method read (line 12) | int read(char *buf, int n) {
FILE: cpp/151-160/Read N Characters Given Read4.cpp
class Solution (line 6) | class Solution {
method read (line 8) | int read(char *buf, int n) {
FILE: cpp/151-160/Reverse Words in a String.cpp
class Solution (line 1) | class Solution {
method reverseWords (line 3) | void reverseWords(string &s) {
FILE: cpp/161-170/Compare Version Numbers.cpp
class Solution (line 1) | class Solution {
method compareVersion (line 3) | int compareVersion(string version1, string version2) {
FILE: cpp/161-170/Excel Sheet Column Title.cpp
class Solution (line 1) | class Solution {
method string (line 3) | string convertToTitle(int n) {
FILE: cpp/161-170/Find Peak Element.cpp
class Solution (line 1) | class Solution {
method findPeakElement (line 3) | int findPeakElement(const vector<int> &num)
FILE: cpp/161-170/Fraction to Recurring Decimal.cpp
class Solution (line 1) | class Solution {
method string (line 3) | string fractionToDecimal(int64_t numerator, int64_t denominator) {
FILE: cpp/161-170/Majority Element.cpp
class Solution (line 1) | class Solution {
method majorityElement (line 3) | int majorityElement(vector<int> &num) {
FILE: cpp/161-170/Maximum Gap.cpp
class Solution (line 1) | class Solution {
method maximumGap (line 3) | int maximumGap(vector<int> &num) {
FILE: cpp/161-170/Missing Ranges.cpp
class Solution (line 1) | class Solution {
method string (line 3) | inline string get_range(int start, int end) {
method findMissingRanges (line 9) | vector<string> findMissingRanges(vector<int>& nums, int lower, int upp...
FILE: cpp/161-170/One Edit Distance.cpp
class Solution (line 1) | class Solution {
method isOneEditDistance (line 4) | bool isOneEditDistance(string s, string t) {
FILE: cpp/161-170/Two Sum II - Input array is sorted.cpp
class Solution (line 1) | class Solution {
method twoSum (line 3) | vector<int> twoSum(vector<int>& numbers, int target) {
FILE: cpp/161-170/Two Sum III - Data structure design.cpp
class TwoSum (line 1) | class TwoSum {
method add (line 4) | void add(int number) {
method find (line 7) | bool find(int value) {
FILE: cpp/171-180/Binary Search Tree Iterator.cpp
class BSTIterator (line 1) | class BSTIterator {
method BSTIterator (line 6) | BSTIterator(TreeNode *root) {
method hasNext (line 17) | bool hasNext() {
method next (line 22) | int next() {
FILE: cpp/171-180/Dungeon Game.cpp
class Solution (line 1) | class Solution {
method calculateMinimumHP (line 3) | int calculateMinimumHP(vector<vector<int> > &dungeon) {
FILE: cpp/171-180/Excel Sheet Column Number.cpp
class Solution (line 1) | class Solution {
method titleToNumber (line 3) | int titleToNumber(string s) {
FILE: cpp/171-180/Factorial Trailing Zeroes.cpp
class Solution (line 1) | class Solution {
method trailingZeroes (line 3) | int trailingZeroes(int n) {
FILE: cpp/171-180/Largest Number.cpp
class Solution (line 1) | class Solution {
method string (line 3) | string largestNumber(vector<int>& nums) {
FILE: cpp/181-190/Best Time to Buy and Sell Stock IV.cpp
class Solution (line 1) | class Solution {
method help (line 3) | int help(vector<int> &prices)
method maxProfit (line 13) | int maxProfit(int k, vector<int> &prices) {
FILE: cpp/181-190/Repeated DNA Sequences.cpp
class Solution (line 1) | class Solution {
method change (line 4) | inline int change(char ch) {
method findRepeatedDnaSequences (line 12) | vector<string> findRepeatedDnaSequences(string s) {
FILE: cpp/181-190/Reverse Bits.cpp
class Solution (line 1) | class Solution {
method reverseBits (line 3) | uint32_t reverseBits(uint32_t n) {
FILE: cpp/181-190/Reverse Words in a String II.cpp
class Solution (line 1) | class Solution {
method reverseWords (line 3) | void reverseWords(string &s) {
FILE: cpp/181-190/Rotate Array.cpp
class Solution (line 1) | class Solution {
method rotate (line 3) | void rotate(vector<int>& nums, int k) {
FILE: cpp/191-200/Binary Tree Right Side View.cpp
type TreeNode (line 8) | struct TreeNode {
method TreeNode (line 12) | TreeNode(int x) : val(x), left(NULL), right(NULL) {}
class Solution (line 15) | class Solution {
method rightSideView (line 17) | vector<int> rightSideView(TreeNode *root) {
function main (line 43) | int main()
FILE: cpp/191-200/House Robber.cpp
class Solution (line 1) | class Solution {
method rob (line 3) | int rob(vector<int> &num) {
FILE: cpp/191-200/Number of 1 Bits.cpp
class Solution (line 1) | class Solution {
method hammingWeight (line 3) | int hammingWeight(uint32_t n) {
FILE: cpp/191-200/Number of Islands.cpp
class Solution (line 1) | class Solution {
method valid (line 3) | inline bool valid(int i, int j) {
method mark (line 8) | void mark(vector<vector<char>> &grid, int i, int j) {
method numIslands (line 21) | int numIslands(vector<vector<char>> &grid) {
FILE: cpp/191-200/Reverse Bits.cpp
class Solution (line 7) | class Solution {
method reverseBits (line 9) | uint32_t reverseBits(uint32_t n) {
function main (line 21) | int main()
FILE: cpp/201-210/Bitwise AND of Numbers Range.cpp
class Solution (line 1) | class Solution {
method maxBit (line 3) | int maxBit(int num) {
method rangeBitwiseAnd (line 14) | int rangeBitwiseAnd(int m, int n) {
FILE: cpp/201-210/Count Primes.cpp
class Solution (line 9) | class Solution {
method countPrimes (line 11) | int countPrimes(int n) {
function main (line 38) | int main()
FILE: cpp/201-210/Course Schedule II.cpp
type Node (line 1) | struct Node {
method Node (line 4) | Node() : state(0) { }
class Solution (line 7) | class Solution {
method DFS_VISIT (line 11) | bool DFS_VISIT(int u, vector<int>& v) {
method findOrder (line 28) | vector<int> findOrder(int numCourses, vector<pair<int, int>>& prerequi...
FILE: cpp/201-210/Course Schedule.cpp
type Node (line 1) | struct Node {
method Node (line 4) | Node() : state(0) { }
class Solution (line 7) | class Solution {
type Node (line 9) | struct Node
method dfs_visit (line 11) | bool dfs_visit(int u) {
method canFinish (line 27) | bool canFinish(int numCourses, vector<pair<int, int>>& prerequisites) {
FILE: cpp/201-210/Happy Number.cpp
class Solution (line 1) | class Solution {
method SumSquare (line 3) | int SumSquare(int n)
method isHappy (line 16) | bool isHappy(int n) {
FILE: cpp/201-210/Implement Trie (Prefix Tree).cpp
type TrieNode (line 1) | struct TrieNode {
method TrieNode (line 5) | TrieNode(): word(false) {
class Trie (line 10) | class Trie {
method Trie (line 13) | Trie() {
method insert (line 18) | void insert(const string& s) {
method search (line 31) | bool search(const string& key) const {
method startsWith (line 45) | bool startsWith(const string& prefix) const {
FILE: cpp/201-210/Isomorphic Strings.cpp
class Solution (line 1) | class Solution {
method isIsomorphic (line 3) | bool isIsomorphic(string s, string t) {
FILE: cpp/201-210/Minimum Size Subarray Sum.cpp
class Solution (line 1) | class Solution {
method minSubArrayLen (line 3) | int minSubArrayLen(int s, vector<int>& nums) {
FILE: cpp/201-210/Remove Linked List Elements.cpp
class Solution (line 1) | class Solution {
method ListNode (line 3) | ListNode* removeElements(ListNode* head, int val) {
FILE: cpp/201-210/Reverse Linked List.cpp
class Solution (line 9) | class Solution {
method ListNode (line 11) | ListNode* reverseList(ListNode* head) {
FILE: cpp/211-220/Add and Search Word - Data structure design.cpp
class TrieNode (line 1) | class TrieNode {
method TrieNode (line 7) | TrieNode() {
class Trie (line 14) | class Trie {
method _search (line 16) | bool _search(string word, int offset, TrieNode *node) {
method Trie (line 32) | Trie() {
method insert (line 37) | void insert(string s) {
method search (line 49) | bool search(string word) {
class WordDictionary (line 57) | class WordDictionary {
method addWord (line 64) | void addWord(string word) {
method search (line 70) | bool search(string word) {
FILE: cpp/211-220/Combination Sum III.cpp
class Solution (line 1) | class Solution {
method help (line 3) | void help(vector<int>& now, int index, int num, int target, vector<vec...
method combinationSum3 (line 22) | vector<vector<int>> combinationSum3(int k, int n) {
FILE: cpp/211-220/Contains Duplicate II.cpp
class Solution (line 1) | class Solution {
method containsNearbyDuplicate (line 3) | bool containsNearbyDuplicate(vector<int>& nums, int k)
FILE: cpp/211-220/Contains Duplicate III.cpp
class Solution (line 1) | class Solution {
method containsNearbyAlmostDuplicate (line 3) | bool containsNearbyAlmostDuplicate(vector<int>& nums, int k, int t) {
FILE: cpp/211-220/Contains Duplicate.cpp
class Solution (line 1) | class Solution {
method containsDuplicate (line 3) | bool containsDuplicate(std::vector<int>& nums) {
FILE: cpp/211-220/House Robber II.cpp
class Solution (line 1) | class Solution {
method rob (line 3) | int rob(vector<int>& nums) {
FILE: cpp/211-220/Kth Largest Element in an Array.cpp
class Solution (line 1) | class Solution {
method kthSmallest (line 3) | int kthSmallest(vector<int>& arr, int l, int r, int k)
method partition (line 19) | int partition(vector<int>& arr, int l, int r)
method randomPartition (line 34) | int randomPartition(vector<int>& arr, int l, int r)
method findKthLargest (line 43) | int findKthLargest(vector<int>& nums, int k) {
FILE: cpp/211-220/Shortest Palindrome.cpp
class Solution (line 1) | class Solution {
method string (line 4) | string preProcess(string s) {
method string (line 16) | string shortestPalindrome(string s) {
FILE: cpp/211-220/The Skyline Problem.cpp
class Solution (line 1) | class Solution {
method getSkyline (line 3) | vector<pair<int, int>> getSkyline(vector<vector<int>>& buildings) {
FILE: cpp/211-220/Word Search II.cpp
type TrieNode (line 3) | struct TrieNode{
method TrieNode (line 8) | TrieNode() :isEndOfWord(false), father(NULL), ch(0)
class Solution (line 15) | class Solution {
method Solution (line 21) | Solution(){
method insert (line 25) | void insert(string word){
method string (line 41) | string getWord(TrieNode *curnode){
method DFS (line 52) | void DFS(vector<vector<char>>& board, int r, int c, TrieNode *curnode){
method findWords (line 82) | vector<string> findWords(vector<vector<char>>& board, vector<string>& ...
FILE: cpp/221-230/Basic Calculator II.cpp
class Solution (line 1) | class Solution {
method apply (line 3) | void apply(stack<int>& s, stack<char>& symbol) {
method calculate (line 14) | int calculate(string s) {
FILE: cpp/221-230/Basic Calculator.cpp
class Solution (line 1) | class Solution {
method apply (line 3) | void apply(stack<int>& s, stack<char>& symbol) {
method calculate (line 13) | int calculate(string s) {
FILE: cpp/221-230/Count Complete Tree Nodes.cpp
class Solution (line 1) | class Solution {
method countNodes (line 4) | int countNodes(TreeNode* root) {
FILE: cpp/221-230/Implement Stack using Queues.cpp
class Stack (line 1) | class Stack {
method push (line 9) | void push(int x) {
method pop (line 18) | void pop() {
method top (line 40) | int top() {
method empty (line 45) | bool empty() {
FILE: cpp/221-230/Invert Binary Tree.cpp
class Solution (line 1) | class Solution {
method TreeNode (line 3) | TreeNode* invertTree(TreeNode* root) {
FILE: cpp/221-230/Kth Smallest Element in a BST.cpp
class Solution (line 10) | class Solution {
method kthSmallest (line 12) | int kthSmallest(TreeNode* root, int k) {
FILE: cpp/221-230/Majority Element II.cpp
class Solution (line 1) | class Solution {
method majorityElement (line 3) | vector<int> majorityElement(vector<int>& nums) {
FILE: cpp/221-230/Maximal Square.cpp
class Solution (line 1) | class Solution {
method maximalSquare (line 3) | int maximalSquare(vector<vector<char>>& matrix) {
FILE: cpp/221-230/Rectangle Area.cpp
class Solution (line 1) | class Solution {
method overlapLen (line 3) | int overlapLen(int a1, int a2, int b1, int b2) {
method computeArea (line 12) | int computeArea(int A, int B, int C, int D, int E, int F, int G, int H) {
FILE: cpp/221-230/Summary Ranges.cpp
class Solution (line 1) | class Solution {
method summaryRanges (line 3) | vector<string> summaryRanges(vector<int>& nums) {
FILE: cpp/231-240/Delete Node in a Linked List.cpp
class Solution (line 9) | class Solution {
method deleteNode (line 11) | void deleteNode(ListNode* node) {
FILE: cpp/231-240/Implement Queue using Stacks.cpp
class MyQueue (line 1) | class MyQueue {
method MyQueue (line 6) | MyQueue() {
method push (line 11) | void push(int x) {
method pop (line 16) | int pop() {
method peek (line 23) | int peek() {
method transit (line 28) | void transit() {
method empty (line 38) | bool empty() {
FILE: cpp/231-240/Lowest Common Ancestor of a Binary Search Tree.cpp
class Solution (line 10) | class Solution {
method TreeNode (line 12) | TreeNode* lowestCommonAncestor(TreeNode* root, TreeNode* p, TreeNode* ...
FILE: cpp/231-240/Lowest Common Ancestor of a Binary Tree.cpp
class Solution (line 1) | class Solution {
method TreeNode (line 3) | TreeNode* lowestCommonAncestor(TreeNode* root, TreeNode* p, TreeNode* ...
FILE: cpp/231-240/Number of Digit One.cpp
class Solution (line 1) | class Solution {
method countDigitOne (line 4) | int countDigitOne(int n) {
FILE: cpp/231-240/Palindrome Linked List.cpp
class Solution (line 9) | class Solution {
method isPalindrome (line 11) | bool isPalindrome(ListNode* head) {
method ListNode (line 31) | ListNode* reverseList(ListNode* head) {
FILE: cpp/231-240/Power of Two.cpp
class Solution (line 1) | class Solution {
method isPowerOfTwo (line 3) | bool isPowerOfTwo(int n) {
FILE: cpp/231-240/Product of Array Except Self.cpp
class Solution (line 1) | class Solution {
method productExceptSelf (line 3) | vector<int> productExceptSelf(vector<int>& nums) {
FILE: cpp/231-240/Search a 2D Matrix II.cpp
class Solution (line 1) | class Solution {
method searchMatrix (line 3) | bool searchMatrix(vector<vector<int>>& matrix, int target) {
FILE: cpp/231-240/Sliding Window Maximum.cpp
class Solution (line 1) | class Solution {
method maxSlidingWindow (line 3) | vector<int> maxSlidingWindow(vector<int>& nums, int k) {
FILE: cpp/241-250/Count Univalue Subtrees.cpp
class Solution (line 10) | class Solution {
method help (line 14) | bool help(TreeNode* root)
method countUnivalSubtrees (line 39) | int countUnivalSubtrees(TreeNode* root) {
FILE: cpp/241-250/Different Ways to Add Parentheses.cpp
class Solution (line 1) | class Solution {
method diffWaysToCompute (line 3) | vector<int> diffWaysToCompute(string input) {
FILE: cpp/241-250/Group Shifted Strings.cpp
class Solution (line 1) | class Solution {
method pattern_match (line 3) | bool pattern_match(const string &s1, const string &s2) {
method groupStrings (line 16) | vector<vector<string>> groupStrings(vector<string>& strings) {
FILE: cpp/241-250/Shortest Word Distance II.cpp
class WordDistance (line 1) | class WordDistance {
method WordDistance (line 6) | WordDistance(vector<string>& words) {
method shortest (line 12) | int shortest(string word1, string word2) {
FILE: cpp/241-250/Shortest Word Distance III.cpp
class Solution (line 1) | class Solution {
method shortestWordDistance (line 3) | int shortestWordDistance(vector<string>& words, string word1, string w...
FILE: cpp/241-250/Shortest Word Distance.cpp
class Solution (line 1) | class Solution {
method shortestDistance (line 3) | int shortestDistance(vector<string>& words, string word1, string word2) {
FILE: cpp/241-250/Strobogrammatic Number II.cpp
class Solution (line 1) | class Solution {
method findStrobogrammatic (line 3) | vector<string> findStrobogrammatic(int n) {
method helper (line 6) | vector<string> helper(int m, int n){
FILE: cpp/241-250/Strobogrammatic Number III.cpp
class Solution (line 1) | class Solution {
method check (line 7) | bool check(const string& low, const string& high) {
method help (line 13) | void help(string temp, int cur, int n, const string& low, const string...
method strobogrammaticInRange (line 29) | int strobogrammaticInRange(string low, string high) {
FILE: cpp/241-250/Strobogrammatic Number.cpp
class Solution (line 1) | class Solution {
method isStrobogrammatic (line 4) | bool isStrobogrammatic(string num) {
FILE: cpp/241-250/Valid Anagram.cpp
class Solution (line 1) | class Solution {
method isAnagram (line 3) | bool isAnagram(string s, string t) {
FILE: cpp/251-260/3Sum Smaller.cpp
class Solution (line 1) | class Solution {
method threeSumSmaller (line 3) | int threeSumSmaller(vector<int>& nums, int target) {
FILE: cpp/251-260/Add Digits.cpp
class Solution (line 1) | class Solution {
method addDigits (line 3) | int addDigits(int num) {
FILE: cpp/251-260/Binary Tree Paths.cpp
class Solution (line 10) | class Solution {
method help (line 12) | void help(TreeNode* root, string path, vector<string>&paths)
method binaryTreePaths (line 24) | vector<string> binaryTreePaths(TreeNode* root) {
FILE: cpp/251-260/Factor Combinations.cpp
class Solution (line 1) | class Solution {
method getFactors (line 5) | vector<vector<int>> getFactors(int n) {
method getFHelp (line 10) | void getFHelp(int n, int bottom, vector<int> line) {
FILE: cpp/251-260/Flatten 2D Vector.cpp
class Vector2D (line 1) | class Vector2D {
method Vector2D (line 7) | Vector2D(vector<vector<int>>& vec2d) {
method next (line 13) | int next() {
method hasNext (line 18) | bool hasNext() {
FILE: cpp/251-260/Meeting Rooms II.cpp
class Solution (line 10) | class Solution {
method minMeetingRooms (line 12) | int minMeetingRooms(vector<Interval>& intervals) {
FILE: cpp/251-260/Meeting Rooms.cpp
class Solution (line 10) | class Solution {
method canAttendMeetings (line 12) | bool canAttendMeetings(vector<Interval>& intervals) {
method overlap (line 22) | bool overlap(Interval& interval1, Interval& interval2) {
FILE: cpp/251-260/Paint House.cpp
class Solution (line 1) | class Solution {
method minCost (line 3) | int minCost(vector<vector<int>>& costs) {
FILE: cpp/251-260/Single Number III.cpp
class Solution (line 1) | class Solution {
method singleNumber (line 3) | vector<int> singleNumber(vector<int>& nums) {
FILE: cpp/251-260/Verify Preorder Sequence in Binary Search Tree.cpp
class Solution (line 9) | class Solution {
method verifyPreorder (line 11) | bool verifyPreorder(vector<int>& preorder) {
FILE: cpp/261-270/Alien Dictionary.cpp
class Solution (line 1) | class Solution {
method dfs (line 2) | bool dfs(char ch,
method string (line 24) | string alienOrder(vector<string>& words) {
FILE: cpp/261-270/Closest Binary Search Tree Value.cpp
class Solution (line 10) | class Solution {
method closestValue (line 12) | int closestValue(TreeNode* root, double target) {
FILE: cpp/261-270/Factor Combinations.cpp
class Solution (line 1) | class Solution {
method help (line 3) | void help(vector<vector<int>>& result, vector<int>& factors, vector<in...
method getFactors (line 22) | vector<vector<int>> getFactors(int n) {
FILE: cpp/261-270/Graph Valid Tree.cpp
class Solution (line 1) | class Solution {
method findParent (line 3) | int findParent(const vector<int>& vec, int node) {
method validTree (line 12) | bool validTree(int n, vector<vector<int>>& edges) {
FILE: cpp/261-270/Missing Number.cpp
class Solution (line 1) | class Solution {
method missingNumber (line 3) | int missingNumber(vector<int>& nums) {
method missingNumber (line 13) | int missingNumber(vector<int>& nums) {
class Solution (line 11) | class Solution {
method missingNumber (line 3) | int missingNumber(vector<int>& nums) {
method missingNumber (line 13) | int missingNumber(vector<int>& nums) {
FILE: cpp/261-270/Paint House II.cpp
class Solution (line 1) | class Solution {
method minCostII (line 3) | int minCostII(vector<vector<int>>& costs) {
FILE: cpp/261-270/Palindrome Permutation II.cpp
class Solution (line 1) | class Solution {
method help (line 7) | void help(vector<string>& result, string &temp, const string &s, int cur)
method generatePalindromes (line 34) | vector<string> generatePalindromes(string s) {
FILE: cpp/261-270/Palindrome Permutation.cpp
class Solution (line 1) | class Solution {
method canPermutePalindrome (line 4) | bool canPermutePalindrome(string s) {
FILE: cpp/261-270/Ugly Number II.cpp
class Solution (line 1) | class Solution {
method nthUglyNumber (line 3) | int nthUglyNumber(int n) {
FILE: cpp/261-270/Ugly Number.cpp
class Solution (line 1) | class Solution {
method isUgly (line 3) | bool isUgly(int num) {
FILE: cpp/271-280/Closest Binary Search Tree Value II.cpp
class Solution (line 10) | class Solution {
method dfs (line 12) | void dfs(TreeNode* root, priority_queue<pair<double, int>>& pq, double...
method closestKValues (line 25) | vector<int> closestKValues(TreeNode* root, double target, int k) {
FILE: cpp/271-280/Encode and Decode Strings.cpp
class Codec (line 1) | class Codec {
method string (line 5) | string encode(vector<string>& strs) {
method decode (line 15) | vector<string> decode(string s) {
FILE: cpp/271-280/Find the Celebrity.cpp
class Solution (line 4) | class Solution {
method findCelebrity (line 6) | int findCelebrity(int n) {
FILE: cpp/271-280/First Bad Version.cpp
class Solution (line 4) | class Solution {
method firstBadVersion (line 6) | int firstBadVersion(int n) {
FILE: cpp/271-280/H-Index II.cpp
class Solution (line 1) | class Solution {
method hIndex (line 3) | int hIndex(vector<int>& citations) {
FILE: cpp/271-280/H-Index.cpp
class Solution (line 1) | class Solution {
method hIndex (line 3) | int hIndex(vector<int>& citations) {
FILE: cpp/271-280/Integer to English Words.cpp
class Solution (line 1) | class Solution {
method string (line 3) | string hundredStr(int num){
method string (line 12) | string numberToWords(int num) {
FILE: cpp/271-280/Paint Fence.cpp
class Solution (line 1) | class Solution {
method numWays (line 3) | int numWays(int n, int k) {
FILE: cpp/271-280/Perfect Squares.cpp
class Solution (line 1) | class Solution {
method numSquares (line 3) | int numSquares(int n) {
FILE: cpp/271-280/Wiggle Sort.cpp
class Solution (line 1) | class Solution {
method wiggleSort (line 3) | void wiggleSort(vector<int>& nums) {
FILE: cpp/281-290/Expression Add Operators.cpp
class Solution (line 1) | class Solution {
method help (line 3) | void help(vector<string>& result, string& num, int& target, int index,...
method addOperators (line 20) | vector<string> addOperators(string num, int target) {
FILE: cpp/281-290/Find the Duplicate Number.cpp
class Solution (line 1) | class Solution {
method findDuplicate (line 3) | int findDuplicate(vector<int>& nums) {
FILE: cpp/281-290/Game of Life.cpp
class Solution (line 1) | class Solution {
method gameOfLife (line 3) | void gameOfLife(vector<vector<int>>& board) {
FILE: cpp/281-290/Inorder Successor in BST.cpp
class Solution (line 10) | class Solution {
method TreeNode (line 12) | TreeNode* inorderSuccessor(TreeNode* root, TreeNode* p) {
FILE: cpp/281-290/Move Zeroes.cpp
class Solution (line 1) | class Solution {
method moveZeroes (line 3) | void moveZeroes(vector<int>& nums) {
FILE: cpp/281-290/Peeking Iterator.cpp
class PeekingIterator (line 1) | class PeekingIterator : public Iterator {
method PeekingIterator (line 7) | PeekingIterator(const vector<int>& num) : Iterator(num) {
method peek (line 13) | int peek() {
method next (line 23) | int next() {
method hasNext (line 29) | bool hasNext() const {
FILE: cpp/281-290/Unique Word Abbreviation.cpp
class ValidWordAbbr (line 1) | class ValidWordAbbr {
method ValidWordAbbr (line 6) | ValidWordAbbr(vector<string> &dictionary) {
method isUnique (line 14) | bool isUnique(string word) {
FILE: cpp/281-290/Walls and Gates.cpp
type point (line 1) | struct point {
method point (line 5) | point(int _i, int _j, int _v):i(_i), j(_j), v(_v) { }
class mycomparison (line 8) | class mycomparison {
method mycomparison (line 10) | mycomparison() { }
class Solution (line 16) | class Solution {
method wallsAndGates (line 21) | void wallsAndGates(vector<vector<int>>& rooms) {
FILE: cpp/281-290/Word Pattern.cpp
class Solution (line 1) | class Solution {
method wordPattern (line 3) | bool wordPattern(string pattern, string str) {
FILE: cpp/281-290/Zigzag Iterator.cpp
class ZigzagIterator (line 1) | class ZigzagIterator {
method ZigzagIterator (line 7) | ZigzagIterator(vector<int>& v1, vector<int>& v2) {
method next (line 16) | int next() {
method hasNext (line 25) | bool hasNext() {
FILE: cpp/291-300/Best Meeting Point.cpp
class Solution (line 1) | class Solution {
method minTotalDistance (line 4) | int minTotalDistance(vector<vector<int>>& grid) {
FILE: cpp/291-300/Binary Tree Longest Consecutive Sequence.cpp
class Solution (line 10) | class Solution {
method help (line 14) | void help(TreeNode* root, int h) {
method longestConsecutive (line 32) | int longestConsecutive(TreeNode* root) {
FILE: cpp/291-300/Bulls and Cows.cpp
class Solution (line 1) | class Solution {
method string (line 3) | string getHint(string secret, string guess) {
FILE: cpp/291-300/Find Median from Data Stream.cpp
class MedianFinder (line 1) | class MedianFinder {
method MedianFinder (line 6) | MedianFinder() {
method addNum (line 10) | void addNum(int num) {
method findMedian (line 22) | double findMedian() {
FILE: cpp/291-300/Flip Game II.cpp
class Solution (line 1) | class Solution {
method help (line 6) | bool help() {
method canWin (line 20) | bool canWin(string s) {
FILE: cpp/291-300/Flip Game.cpp
class Solution (line 1) | class Solution {
method generatePossibleNextMoves (line 3) | vector<string> generatePossibleNextMoves(string s) {
FILE: cpp/291-300/Longest Increasing Subsequence.cpp
class Solution (line 1) | class Solution {
method lengthOfLIS (line 4) | int lengthOfLIS(vector<int>& nums) {
FILE: cpp/291-300/Nim Game.cpp
class Solution (line 1) | class Solution {
method canWinNim (line 4) | bool canWinNim(int n) {
FILE: cpp/291-300/Serialize and Deserialize Binary Tree.cpp
class Codec (line 7) | class Codec {
method readNext (line 9) | void readNext(stringstream& ss, int& val, bool &isnumber) {
method TreeNode (line 21) | TreeNode* help(stringstream& ss) {
method string (line 36) | string _serialize(TreeNode* root) {
method string (line 44) | string serialize(TreeNode* root) {
method TreeNode (line 50) | TreeNode* deserialize(string data) {
method preorderDFS (line 64) | void preorderDFS(TreeNode* root, string& serialized_data) {
method TreeNode (line 77) | inline TreeNode* reconstruct(const string& buffer, int& pos) {
method string (line 100) | string serialize(TreeNode* root) {
method TreeNode (line 107) | TreeNode* deserialize(string data) {
class Codec (line 62) | class Codec {
method readNext (line 9) | void readNext(stringstream& ss, int& val, bool &isnumber) {
method TreeNode (line 21) | TreeNode* help(stringstream& ss) {
method string (line 36) | string _serialize(TreeNode* root) {
method string (line 44) | string serialize(TreeNode* root) {
method TreeNode (line 50) | TreeNode* deserialize(string data) {
method preorderDFS (line 64) | void preorderDFS(TreeNode* root, string& serialized_data) {
method TreeNode (line 77) | inline TreeNode* reconstruct(const string& buffer, int& pos) {
method string (line 100) | string serialize(TreeNode* root) {
method TreeNode (line 107) | TreeNode* deserialize(string data) {
FILE: cpp/291-300/Word Pattern II.cpp
class Solution (line 1) | class Solution {
method help (line 3) | bool help(int pindex, int sindex, string &pattern, string &str, map<ch...
method wordPatternMatch (line 37) | bool wordPatternMatch(string pattern, string str) {
FILE: cpp/301-310/Additive Number.cpp
class Solution (line 1) | class Solution {
method check (line 3) | bool check(string add1, string add2, int index, string &num) {
method isAdditiveNumber (line 25) | bool isAdditiveNumber(string num) {
FILE: cpp/301-310/Best Time to Buy and Sell Stock with Cooldown.cpp
class Solution (line 1) | class Solution {
method maxProfit (line 3) | int maxProfit(vector<int>& prices) {
FILE: cpp/301-310/Minimum Height Trees.cpp
class Solution (line 1) | class Solution {
method findMinHeightTrees (line 4) | vector<int> findMinHeightTrees(int n, vector<pair<int, int>>& edges) {
FILE: cpp/301-310/Number of Islands II.cpp
class UF (line 1) | class UF {
method UF (line 11) | UF(int N) {
method find (line 22) | int find(int p) {
method getCount (line 30) | int getCount() {
method connected (line 34) | bool connected(int p, int q) {
method Union (line 38) | void Union(int p, int q) {
class Solution (line 54) | class Solution {
method convert (line 56) | inline int convert(int m, int n, int col) {
method numIslands2 (line 61) | vector<int> numIslands2(int m, int n, vector<pair<int, int>>& position...
FILE: cpp/301-310/Range Sum Query - Immutable.cpp
class NumArray (line 1) | class NumArray {
method NumArray (line 4) | NumArray(vector<int> &nums) {
method sumRange (line 12) | int sumRange(int i, int j) {
FILE: cpp/301-310/Range Sum Query - Mutable.cpp
class SegmentTreeNode (line 1) | class SegmentTreeNode {
method SegmentTreeNode (line 6) | SegmentTreeNode(int start, int end, int sum) {
class NumArray (line 14) | class NumArray {
method SegmentTreeNode (line 18) | SegmentTreeNode * build(int start, int end, vector<int>& A) {
method modify (line 35) | void modify(SegmentTreeNode *root, int i, int val) {
method query (line 45) | int query(SegmentTreeNode *root, int i, int j) {
method NumArray (line 59) | NumArray(vector<int> &nums) {
method update (line 63) | void update(int i, int val) {
method sumRange (line 67) | int sumRange(int i, int j) {
FILE: cpp/301-310/Range Sum Query 2D - Immutable.cpp
class NumMatrix (line 1) | class NumMatrix {
method NumMatrix (line 4) | NumMatrix(vector<vector<int>> &matrix) {
method sumRegion (line 16) | int sumRegion(int row1, int col1, int row2, int col2) {
FILE: cpp/301-310/Range Sum Query 2D - Mutable.cpp
class NumMatrix (line 1) | class NumMatrix {
method NumMatrix (line 7) | NumMatrix(vector<vector<int>> &matrix) {
method update (line 21) | void update(int row, int col, int val) {
method sumRegion (line 29) | int sumRegion(int row1, int col1, int row2, int col2) {
FILE: cpp/301-310/Remove Invalid Parentheses.cpp
class Solution (line 2) | class Solution {
method GetErrors (line 4) | int GetErrors(const string &s) {
method removeInvalidParentheses (line 23) | vector<string> removeInvalidParentheses(string s) {
method GetErrors (line 73) | int GetErrors(const string &s) {
method dfs (line 93) | void dfs(const string& s, int ind, int validLen, int leftCnt, int righ...
method removeInvalidParentheses (line 124) | vector<string> removeInvalidParentheses(string s) {
class Solution (line 71) | class Solution {
method GetErrors (line 4) | int GetErrors(const string &s) {
method removeInvalidParentheses (line 23) | vector<string> removeInvalidParentheses(string s) {
method GetErrors (line 73) | int GetErrors(const string &s) {
method dfs (line 93) | void dfs(const string& s, int ind, int validLen, int leftCnt, int righ...
method removeInvalidParentheses (line 124) | vector<string> removeInvalidParentheses(string s) {
FILE: cpp/301-310/Smallest Rectangle Enclosing Black Pixels.cpp
class Solution (line 1) | class Solution {
method bfs (line 12) | void bfs(vector<vector<char>>& image, int x, int y) {
method minArea (line 30) | int minArea(vector<vector<char>>& image, int x, int y) {
FILE: cpp/311-320/Binary Tree Vertical Order Traversal.cpp
class Solution (line 10) | class Solution {
method verticalOrder (line 13) | vector<vector<int>> verticalOrder(TreeNode* root) {
FILE: cpp/311-320/Bulb Switcher.cpp
class Solution (line 1) | class Solution {
method bulbSwitch (line 3) | int bulbSwitch(int n) {
FILE: cpp/311-320/Burst Balloons.cpp
class Solution (line 1) | class Solution {
method getValue (line 3) | int getValue(vector<int>& nums, int i) {
method maxCoins (line 9) | int maxCoins(vector<int>& nums) {
FILE: cpp/311-320/Count of Smaller Numbers After Self.cpp
type tree (line 1) | struct tree{
method tree (line 6) | tree(int v):val(v),left(nullptr),right(nullptr),count(1){}
class Solution (line 9) | class Solution {
method countSmaller (line 11) | vector<int> countSmaller(vector<int>& nums) {
FILE: cpp/311-320/Generalized Abbreviation.cpp
class Solution (line 1) | class Solution {
method help (line 3) | void help(int i, string &word, vector<string>& result, int previous, s...
method generateAbbreviations (line 17) | vector<string> generateAbbreviations(string word) {
FILE: cpp/311-320/Maximum Product of Word Lengths.cpp
class Solution (line 1) | class Solution {
method maxProduct (line 3) | int maxProduct(vector<string>& words) {
FILE: cpp/311-320/Remove Duplicate Letters.cpp
class Solution (line 1) | class Solution {
method string (line 3) | string removeDuplicateLetters(string s) {
FILE: cpp/311-320/Shortest Distance from All Buildings.cpp
type point (line 1) | struct point {
method point (line 5) | point(int _i, int _j, int _v){i = _i; j = _j; v = _v;}
class Solution (line 8) | class Solution {
method BFS (line 10) | void BFS(int i, int j, vector<vector<int>>& grid, vector<vector<int>>&...
method shortestDistance (line 50) | int shortestDistance(vector<vector<int>>& grid) {
FILE: cpp/311-320/Sparse Matrix Multiplication.cpp
class Solution (line 1) | class Solution {
method multiply (line 3) | vector<vector<int>> multiply(vector<vector<int>>& A, vector<vector<int...
FILE: cpp/311-320/Super Ugly Number.cpp
class Solution (line 1) | class Solution {
method nthSuperUglyNumber (line 3) | int nthSuperUglyNumber(int n, vector<int>& primes) {
FILE: cpp/321-330/Coin Change.cpp
class Solution (line 1) | class Solution {
method coinChange (line 4) | int coinChange(vector<int>& coins, int amount) {
FILE: cpp/321-330/Count of Range Sum.cpp
type SegmentTreeNode (line 2) | struct SegmentTreeNode {
method SegmentTreeNode (line 6) | SegmentTreeNode(LL L, LL R) :L(L), R(R), cnt(0), left(NULL), right(NUL...
class SegmentTree (line 9) | class SegmentTree {
method SegmentTreeNode (line 11) | SegmentTreeNode * buildTree(vector<LL> &nums, int L, int R) {
method update (line 21) | void update(SegmentTreeNode * root, LL val) {
method sum (line 29) | int sum(SegmentTreeNode * root, LL L, LL R) {
method SegmentTree (line 36) | SegmentTree(vector<LL> &nums, int L, int R) { root = buildTree(nums, L...
method sum (line 38) | int sum(LL L, LL R) {
method update (line 42) | void update(LL val) {
class Solution (line 47) | class Solution {
method countRangeSum (line 49) | int countRangeSum(vector<int>& nums, int lower, int upper) {
FILE: cpp/321-330/Create Maximum Number.cpp
class Solution (line 1) | class Solution {
method merge (line 3) | vector<int> merge(vector<int> nums1, vector<int> nums2) {
method getMax (line 25) | vector<int> getMax(const vector<int>& nums, int t) {
method greater (line 41) | bool greater(const vector<int> &nums1, const vector<int> &nums2, int i...
method maxNumber (line 52) | vector<int> maxNumber(vector<int>& nums1, vector<int>& nums2, int k) {
FILE: cpp/321-330/Longest Increasing Path in a Matrix.cpp
class Solution (line 1) | class Solution {
method dfsvisit (line 3) | int dfsvisit(int i, int j, vector<vector<bool>> &visited, vector<vecto...
method longestIncreasingPath (line 21) | int longestIncreasingPath(vector<vector<int>>& matrix) {
FILE: cpp/321-330/Maximum Size Subarray Sum Equals k.cpp
class Solution (line 7) | class Solution {
method maxSubArrayLen (line 9) | int maxSubArrayLen(vector<int>& nums, int k) {
FILE: cpp/321-330/Number of Connected Components in an Undirected Graph.cpp
class Solution (line 1) | class Solution {
method findroot (line 3) | int findroot(int c, vector<int> &u)
method countComponents (line 10) | int countComponents(int n, vector<pair<int, int>>& edges) {
FILE: cpp/321-330/Odd Even Linked List.cpp
class Solution (line 9) | class Solution {
method ListNode (line 11) | ListNode* oddEvenList(ListNode* head) {
FILE: cpp/321-330/Patching Array.cpp
class Solution (line 1) | class Solution {
method minPatches (line 3) | int minPatches(vector<int>& nums, int n) {
FILE: cpp/321-330/Power of Three.cpp
class Solution (line 1) | class Solution {
method isPowerOfThree (line 3) | bool isPowerOfThree(int n) {
FILE: cpp/321-330/Wiggle Sort II.cpp
class Solution (line 1) | class Solution {
method wiggleSort (line 3) | void wiggleSort(vector<int>& nums) {
FILE: cpp/331-340/Counting Bits.cpp
class Solution (line 6) | class Solution {
method countBits (line 8) | vector<int> countBits(int num) {
FILE: cpp/331-340/House Robber III.cpp
class Solution (line 10) | class Solution {
method help (line 12) | void help(TreeNode* root, int &a, int &b) {
method rob (line 31) | int rob(TreeNode* root) {
FILE: cpp/331-340/Increasing Triplet Subsequence.cpp
class Solution (line 1) | class Solution {
method increasingTriplet (line 3) | bool increasingTriplet(vector<int>& nums) {
FILE: cpp/331-340/Largest BST Subtree.cpp
class Solution (line 1) | class Solution {
method isBST (line 3) | bool isBST(TreeNode* node, int& res, int& mini, int& maxi) {
method largestBSTSubtree (line 30) | int largestBSTSubtree(TreeNode* root) {
FILE: cpp/331-340/Longest Substring with At Most K Distinct Characters.cpp
class Solution (line 1) | class Solution {
method lengthOfLongestSubstringKDistinct (line 3) | int lengthOfLongestSubstringKDistinct(string s, int k) {
FILE: cpp/331-340/Nested List Weight Sum.cpp
class Solution (line 18) | class Solution {
method DFS (line 20) | int DFS(vector<NestedInteger>& nestedList, int depth){
method depthSum (line 32) | int depthSum(vector<NestedInteger>& nestedList) {
FILE: cpp/331-340/Palindrome Pairs.cpp
class Solution (line 1) | class Solution {
method isPalindrome (line 3) | bool isPalindrome(const string& s) {
method palindromePairs (line 17) | vector<vector<int>> palindromePairs(vector<string>& words) {
method palindromePairs (line 142) | vector<vector<int>> palindromePairs(vector<string>& words) {
class Trie (line 64) | class Trie {
method isPalindrome (line 65) | bool isPalindrome(const string& s) {
type TrieNode (line 79) | struct TrieNode {
method TrieNode (line 84) | TrieNode(): isWord(false) {
method Trie (line 91) | Trie() {
method insert (line 95) | void insert(string& s, int wordIndex) {
method findPalindrome (line 113) | void findPalindrome(const vector<string>& words, int wordIndex, vector...
class Solution (line 140) | class Solution {
method isPalindrome (line 3) | bool isPalindrome(const string& s) {
method palindromePairs (line 17) | vector<vector<int>> palindromePairs(vector<string>& words) {
method palindromePairs (line 142) | vector<vector<int>> palindromePairs(vector<string>& words) {
FILE: cpp/331-340/Reconstruct Itinerary.cpp
class Solution (line 1) | class Solution {
method findItinerary (line 3) | vector<string> findItinerary(vector<pair<string, string>> tickets) {
method dfs (line 15) | void dfs(string u, vector<string> &ans, unordered_map<string, multiset...
FILE: cpp/331-340/Self Crossing.cpp
class Solution (line 1) | class Solution {
method isSelfCrossing (line 3) | bool isSelfCrossing(vector<int>& x) {
FILE: cpp/331-340/Verify Preorder Serialization of a Binary Tree.cpp
class Solution (line 1) | class Solution {
method isValidSerialization (line 4) | bool isValidSerialization(string preorder) {
FILE: cpp/341-350/Design Tic-Tac-Toe.cpp
class TicTacToe (line 1) | class TicTacToe {
method TicTacToe (line 11) | TicTacToe(int n):total(n), rowJudge(n), colJudge(n),diag(0),anti(0){}
method move (line 13) | int move(int row, int col, int player) {
FILE: cpp/341-350/Flatten Nested List Iterator.cpp
class NestedIterator (line 18) | class NestedIterator {
method NestedIterator (line 25) | NestedIterator(vector<NestedInteger> &nestedList) {
method next (line 31) | int next() {
method hasNext (line 37) | bool hasNext() {
method NestedIterator (line 90) | NestedIterator(vector<NestedInteger> &nestedList) {
method next (line 96) | int next() {
method hasNext (line 102) | bool hasNext() {
class NestedIterator (line 85) | class NestedIterator {
method NestedIterator (line 25) | NestedIterator(vector<NestedInteger> &nestedList) {
method next (line 31) | int next() {
method hasNext (line 37) | bool hasNext() {
method NestedIterator (line 90) | NestedIterator(vector<NestedInteger> &nestedList) {
method next (line 96) | int next() {
method hasNext (line 102) | bool hasNext() {
FILE: cpp/341-350/Integer Break.cpp
class Solution (line 1) | class Solution {
method integerBreak (line 3) | long long integerBreak(long long n) {
FILE: cpp/341-350/Intersection of Two Arrays II.cpp
class Solution (line 1) | class Solution {
method intersect (line 3) | vector<int> intersect(vector<int>& nums1, vector<int>& nums2) {
FILE: cpp/341-350/Intersection of Two Arrays.cpp
class Solution (line 1) | class Solution {
method intersection (line 3) | vector<int> intersection(vector<int>& nums1, vector<int>& nums2) {
FILE: cpp/341-350/Moving Average from Data Stream.cpp
class MovingAverage (line 1) | class MovingAverage {
method MovingAverage (line 9) | MovingAverage(int size) {
method next (line 14) | double next(int val) {
FILE: cpp/341-350/Power of Four.cpp
class Solution (line 1) | class Solution {
method isPowerOfFour (line 3) | bool isPowerOfFour(int num) {
FILE: cpp/341-350/Reverse String.cpp
class Solution (line 1) | class Solution {
method string (line 3) | string reverseString(string s) {
FILE: cpp/341-350/Reverse Vowels of a String.cpp
class Solution (line 1) | class Solution {
method string (line 3) | string reverseVowels(string s) {
FILE: cpp/341-350/Top K Frequent Elements.cpp
class Solution (line 1) | class Solution {
type greater_than (line 3) | struct greater_than
method topKFrequent (line 12) | vector<int> topKFrequent(vector<int>& nums, int k) {
type greater_than (line 29) | struct greater_than{
method topKFrequent (line 36) | vector<int> topKFrequent(vector<int>& nums, int k) {
class Solution (line 28) | class Solution {
type greater_than (line 3) | struct greater_than
method topKFrequent (line 12) | vector<int> topKFrequent(vector<int>& nums, int k) {
type greater_than (line 29) | struct greater_than{
method topKFrequent (line 36) | vector<int> topKFrequent(vector<int>& nums, int k) {
FILE: cpp/351-360/Android Unlock Patterns.cpp
class Solution (line 1) | class Solution {
method DFS (line 3) | int DFS(vector<bool> &vis, vector<vector<int>> &skip, int cur, int rem...
method numberOfPatterns (line 17) | int numberOfPatterns(int m, int n) {
FILE: cpp/351-360/Count Numbers with Unique Digits.cpp
class Solution (line 1) | class Solution {
method countNumbersWithUniqueDigits (line 3) | int countNumbersWithUniqueDigits(int n) {
FILE: cpp/351-360/Data Stream as Disjoint Intervals.cpp
class SummaryRanges (line 10) | class SummaryRanges {
method addNum (line 15) | void addNum(int val) {
method getIntervals (line 29) | vector<Interval> getIntervals() {
FILE: cpp/351-360/Design Snake Game.cpp
class SnakeGame (line 1) | class SnakeGame {
method SnakeGame (line 21) | SnakeGame(int width, int height, vector<pair<int, int>> food) {
method move (line 36) | int move(string direction) {
FILE: cpp/351-360/Design Twitter.cpp
class Twitter (line 1) | class Twitter {
method Twitter (line 10) | Twitter() {
method postTweet (line 15) | void postTweet(int userId, int tweetId) {
method getNewsFeed (line 25) | vector<int> getNewsFeed(int userId) {
method follow (line 65) | void follow(int followerId, int followeeId) {
method unfollow (line 81) | void unfollow(int followerId, int followeeId) {
FILE: cpp/351-360/Line Reflection.cpp
class Solution (line 1) | class Solution {
method isReflected (line 6) | bool isReflected(vector<pair<int, int>>& points) {
FILE: cpp/351-360/Logger Rate Limiter.cpp
class Logger (line 1) | class Logger {
method Logger (line 7) | Logger() {
method shouldPrintMessage (line 12) | bool shouldPrintMessage(int timestamp, string message) {
FILE: cpp/351-360/Rearrange String k Distance Apart.cpp
class Solution (line 1) | class Solution {
method string (line 3) | string rearrangeString(string str, int k) {
FILE: cpp/351-360/Russian Doll Envelopes.cpp
class Solution (line 1) | class Solution {
method maxEnvelopes (line 3) | int maxEnvelopes(vector<pair<int, int>>& envelopes) {
FILE: cpp/351-360/Sort Transformed Array.cpp
class Solution (line 1) | class Solution {
method transform (line 3) | int transform(int num, int a, int b, int c) {
method sortTransformedArray (line 8) | vector<int> sortTransformedArray(vector<int>& nums, int a, int b, int ...
FILE: cpp/361-370/Bomb Enemy.cpp
class Solution (line 1) | class Solution {
method maxKilledEnemies (line 3) | int maxKilledEnemies(vector<vector<char>>& grid) {
FILE: cpp/361-370/Design Hit Counter.cpp
class HitCounter (line 1) | class HitCounter {
method HitCounter (line 8) | HitCounter() {
method hit (line 14) | void hit(int timestamp) {
method getHits (line 21) | int getHits(int timestamp) {
FILE: cpp/361-370/Find Leaves of Binary Tree.cpp
class Solution (line 10) | class Solution {
method dfs (line 12) | int dfs(TreeNode* root, vector<vector<int>> &myvec) {
method findLeaves (line 25) | vector<vector<int>> findLeaves(TreeNode* root) {
FILE: cpp/361-370/Largest Divisible Subset.cpp
class Solution (line 1) | class Solution {
method largestDivisibleSubset (line 3) | vector<int> largestDivisibleSubset(vector<int>& nums) {
FILE: cpp/361-370/Max Sum of Rectangle No Larger Than K.cpp
class Solution (line 1) | class Solution {
method maxSumSubmatrix (line 4) | int maxSumSubmatrix(vector<vector<int>>& matrix, int k) {
FILE: cpp/361-370/Nested List Weight Sum II.cpp
class Solution (line 18) | class Solution {
method depthSumInverse (line 20) | int depthSumInverse(vector<NestedInteger>& nestedList) {
FILE: cpp/361-370/Plus One Linked List.cpp
class Solution (line 9) | class Solution {
method ListNode (line 11) | ListNode* reverseList(ListNode* head) {
method ListNode (line 23) | ListNode* plusOne(ListNode* head) {
FILE: cpp/361-370/Range Addition.cpp
class Solution (line 1) | class Solution {
method getModifiedArray (line 3) | vector<int> getModifiedArray(int length, vector<vector<int>>& updates) {
FILE: cpp/361-370/Valid Perfect Square.cpp
class Solution (line 1) | class Solution {
method isPerfectSquare (line 3) | bool isPerfectSquare(int num) {
FILE: cpp/361-370/Water and Jug Problem.cpp
class Solution (line 1) | class Solution {
method canMeasureWater (line 3) | bool canMeasureWater(int x, int y, int z) {
method gcd (line 11) | int gcd(int a, int b){
FILE: cpp/371-380/Combination Sum IV.cpp
class Solution (line 1) | class Solution {
method combinationSum4 (line 3) | int combinationSum4(vector<int>& nums, int target) {
FILE: cpp/371-380/Design Phone Directory.cpp
class PhoneDirectory (line 1) | class PhoneDirectory {
method PhoneDirectory (line 7) | PhoneDirectory(int maxNumbers) {
method get (line 17) | int get() {
method check (line 28) | bool check(int number) {
method release (line 33) | void release(int number) {
FILE: cpp/371-380/Find K Pairs with Smallest Sums.cpp
class Solution (line 1) | class Solution {
method kSmallestPairs (line 6) | vector<vector<int>> kSmallestPairs(vector<int>& nums1, vector<int>& nu...
FILE: cpp/371-380/Guess Number Higher or Lower II.cpp
class Solution (line 1) | class Solution {
method getMoneyAmount (line 3) | int getMoneyAmount(int n) {
FILE: cpp/371-380/Guess Number Higher or Lower.cpp
class Solution (line 6) | class Solution {
method guessNumber (line 8) | int guessNumber(int n) {
FILE: cpp/371-380/Insert Delete GetRandom O(1).cpp
class RandomizedSet (line 1) | class RandomizedSet {
method RandomizedSet (line 6) | RandomizedSet() {
method insert (line 11) | bool insert(int val) {
method remove (line 21) | bool remove(int val) {
method getRandom (line 34) | int getRandom() {
FILE: cpp/371-380/Kth Smallest Element in a Sorted Matrix.cpp
class Solution (line 1) | class Solution {
method kthSmallest (line 3) | int kthSmallest(vector<vector<int>>& matrix, int k) {
method search_lower_than_mid (line 14) | int search_lower_than_mid(const vector<vector<int>>& matrix, int x) {
FILE: cpp/371-380/Sum of Two Integers.cpp
class Solution (line 1) | class Solution {
method getSum (line 4) | int getSum(int a, int b) {
FILE: cpp/371-380/Super Pow.cpp
class Solution (line 1) | class Solution {
method help (line 3) | int help(int a, int b) {
method superPow (line 13) | int superPow(int a, vector<int>& b) {
FILE: cpp/371-380/Wiggle Subsequence.cpp
class Solution (line 1) | class Solution {
method wiggleMaxLength (line 3) | int wiggleMaxLength(vector<int>& nums) {
FILE: cpp/381-390/Elimination Game.cpp
class Solution (line 6) | class Solution {
method lastRemaining (line 13) | int lastRemaining(int n) {
FILE: cpp/381-390/Find the Difference.cpp
class Solution (line 1) | class Solution {
method findTheDifference (line 3) | char findTheDifference(string s, string t) {
FILE: cpp/381-390/First Unique Character in a String.cpp
class Solution (line 1) | class Solution {
method firstUniqChar (line 3) | int firstUniqChar(string s) {
FILE: cpp/381-390/Insert Delete GetRandom O(1) - Duplicates allowed.cpp
class RandomizedCollection (line 1) | class RandomizedCollection {
method RandomizedCollection (line 6) | RandomizedCollection() {
method insert (line 11) | bool insert(int val) {
method remove (line 22) | bool remove(int val) {
method getRandom (line 36) | int getRandom() {
FILE: cpp/381-390/Lexicographical Numbers.cpp
class Solution (line 1) | class Solution {
method dfs (line 3) | void dfs(int curr, int n, vector<int>& result, int& index) {
method lexicalOrder (line 16) | vector<int> lexicalOrder(int n) {
FILE: cpp/381-390/Linked List Random Node.cpp
class Solution (line 1) | class Solution {
method Solution (line 5) | Solution(ListNode* head) {
method getRandom (line 13) | int getRandom() {
FILE: cpp/381-390/Longest Absolute File Path.cpp
class Solution (line 1) | class Solution {
method lengthLongestPath (line 3) | int lengthLongestPath(string input) {
FILE: cpp/381-390/Mini Parser.cpp
class Solution (line 30) | class Solution {
method NestedInteger (line 32) | NestedInteger deserialize(string s) {
FILE: cpp/381-390/Ransom Note.cpp
class Solution (line 1) | class Solution {
method canConstruct (line 3) | bool canConstruct(string ransomNote, string magazine) {
FILE: cpp/381-390/Shuffle an Array.cpp
class Solution (line 1) | class Solution {
method Solution (line 4) | Solution(vector<int> nums) {
method reset (line 9) | vector<int> reset() {
method shuffle (line 14) | vector<int> shuffle() {
FILE: cpp/391-400/Decode String.cpp
class Solution (line 1) | class Solution {
method string (line 3) | string solve(const string& s, int& i) {
method string (line 25) | string decodeString(string s) {
FILE: cpp/391-400/Evaluate Division.cpp
class Solution (line 1) | class Solution {
method calcEquation (line 3) | vector<double> calcEquation(vector<pair<string, string>> equations, ve...
method findRoot (line 52) | int findRoot(vector<int>& par, vector<double>& parEq, int v, double& t) {
FILE: cpp/391-400/Integer Replacement.cpp
class Solution (line 1) | class Solution
method integerReplacement (line 4) | int integerReplacement(int n) {
FILE: cpp/391-400/Is Subsequence.cpp
class Solution (line 1) | class Solution {
method isSubsequence (line 3) | bool isSubsequence(string s, string t) {
FILE: cpp/391-400/Longest Substring with At Least K Repeating Characters.cpp
class Solution (line 1) | class Solution {
method dfs (line 3) | int dfs(const string& s, int k, int start, int end) {
method longestSubstring (line 24) | int longestSubstring(string s, int k) {
FILE: cpp/391-400/Nth Digit.cpp
class Solution (line 1) | class Solution {
method process (line 3) | int process(long long num, long long n) {
method findNthDigit (line 12) | int findNthDigit(int n) {
FILE: cpp/391-400/Perfect Rectangle.cpp
class Solution (line 1) | class Solution {
method isRectangleCover (line 3) | bool isRectangleCover(vector<vector<int>>& rectangles) {
FILE: cpp/391-400/Random Pick Index.cpp
class Solution (line 1) | class Solution {
method Solution (line 4) | Solution(vector<int> nums) {
method pick (line 8) | int pick(int target) {
FILE: cpp/391-400/Rotate Function.cpp
class Solution (line 1) | class Solution {
method maxRotateFunction (line 4) | int maxRotateFunction(vector<int>& A) {
FILE: cpp/391-400/UTF-8 Validation.cpp
class Solution (line 1) | class Solution {
method validUtf8 (line 3) | bool validUtf8(vector<int>& data) {
FILE: cpp/401-410/Binary Watch.cpp
class Solution (line 1) | class Solution {
method readBinaryWatch (line 3) | vector<string> readBinaryWatch(int num) {
FILE: cpp/401-410/Convert a Number to Hexadecimal.cpp
class Solution (line 1) | class Solution {
method string (line 3) | string toHex(int num) {
FILE: cpp/401-410/Frog Jump.cpp
class Solution (line 1) | class Solution {
method dfs (line 3) | bool dfs(const vector<int>& stones, int stone_index, int speed, unorde...
method canCross (line 23) | bool canCross(vector<int>& stones) {
FILE: cpp/401-410/Longest Palindrome.cpp
class Solution (line 1) | class Solution {
method longestPalindrome (line 3) | int longestPalindrome(string s) {
FILE: cpp/401-410/Queue Reconstruction by Height.cpp
class Solution (line 1) | class Solution {
method reconstructQueue (line 3) | vector<pair<int, int>> reconstructQueue(vector<pair<int, int>>& people) {
FILE: cpp/401-410/Remove K Digits.cpp
class Solution (line 1) | class Solution {
method string (line 3) | string removeKdigits(string num, int k) {
FILE: cpp/401-410/Split Array Largest Sum.cpp
class Solution (line 1) | class Solution {
method canSplit (line 5) | bool canSplit(vector<int>& nums, int m, ll sum) {
method splitArray (line 18) | int splitArray(vector<int>& nums, int m) {
FILE: cpp/401-410/Sum of Left Leaves.cpp
class Solution (line 10) | class Solution {
method sumOfLeftLeaves (line 12) | int sumOfLeftLeaves(TreeNode* root) {
FILE: cpp/401-410/Trapping Rain Water II.cpp
class Solution (line 1) | class Solution {
method trapRainWater (line 3) | int trapRainWater(vector<vector<int>>& heightMap) {
FILE: cpp/401-410/Valid Word Abbreviation.cpp
class Solution (line 1) | class Solution {
method validWordAbbreviation (line 3) | bool validWordAbbreviation(string word, string abbr) {
FILE: cpp/411-420/Add Strings.cpp
class Solution (line 1) | class Solution {
method string (line 3) | string addStrings(string num1, string num2) {
FILE: cpp/411-420/Arithmetic Slices.cpp
class Solution (line 1) | class Solution {
method numberOfArithmeticSlices (line 3) | int numberOfArithmeticSlices(vector<int>& A) {
FILE: cpp/411-420/Battleships in a Board.cpp
class Solution (line 1) | class Solution {
method countBattleships (line 3) | int countBattleships(vector<vector<char>>& board) {
FILE: cpp/411-420/Fizz Buzz.cpp
class Solution (line 1) | class Solution {
method fizzBuzz (line 3) | vector<string> fizzBuzz(int n) {
FILE: cpp/411-420/Minimum Unique Word Abbreviation.cpp
class Solution (line 1) | class Solution {
type TrieNode (line 2) | struct TrieNode {
method TrieNode (line 4) | TrieNode () {
method string (line 9) | string minAbbreviation(string target, vector<string>& dictionary) {
method generate_abb (line 33) | void generate_abb(vector<string>& abbrs, string& s, string cur, int po...
method TrieNode (line 58) | TrieNode* build(vector<string>& dic) {
method TrieNode (line 4) | TrieNode () {
method valid (line 71) | bool valid(TrieNode* root, const string& s, int i) {
method string (line 87) | string encode(const string& s) {
FILE: cpp/411-420/Pacific Atlantic Water Flow.cpp
class Solution (line 1) | class Solution {
method dfs (line 5) | void dfs(vector<vector<int>>& matrix, int x, int y, int pre, int preval){
method pacificAtlantic (line 17) | vector<pair<int, int>> pacificAtlantic(vector<vector<int>>& matrix) {
FILE: cpp/411-420/Partition Equal Subset Sum.cpp
class Solution (line 1) | class Solution {
method canPartition (line 4) | bool canPartition(vector<int>& nums) {
FILE: cpp/411-420/Sentence Screen Fitting.cpp
class Solution (line 1) | class Solution {
method wordsTyping (line 3) | int wordsTyping(vector<string>& sentence, int rows, int cols) {
FILE: cpp/411-420/Third Maximum Number.cpp
class Solution (line 1) | class Solution {
method thirdMax (line 3) | int thirdMax(vector<int>& nums) {
FILE: cpp/421-430/Convert Binary Search Tree to Sorted Doubly Linked List.cpp
class Solution (line 1) | class Solution {
method inorder (line 3) | void inorder(Node* cur, Node*& prev, Node*& head) {
method Node (line 27) | Node* treeToDoublyList(Node* root) {
FILE: cpp/421-430/Maximum XOR of Two Numbers in an Array.cpp
class Solution (line 1) | class Solution {
class TreeNode (line 3) | class TreeNode {
method TreeNode (line 6) | TreeNode () {next[0] = NULL; next[1] = NULL;}
method TreeNode (line 8) | TreeNode* buildTree(vector<int>& nums) {
method TreeNode (line 6) | TreeNode () {next[0] = NULL; next[1] = NULL;}
method helper (line 24) | int helper(TreeNode* cur, int num) {
method findMaximumXOR (line 41) | int findMaximumXOR(vector<int>& nums) {
FILE: cpp/421-430/Serialize and Deserialize N-ary Tree.cpp
class Codec (line 21) | class Codec {
method string (line 26) | string serialize(Node* root) {
method encode_dfs (line 32) | void encode_dfs(Node* root, string& data){
method Node (line 41) | Node* deserialize(string data) {
method Node (line 46) | Node* decode(stringstream& ss) {
FILE: cpp/421-430/Valid Word Square.cpp
class Solution (line 1) | class Solution {
method validWordSquare (line 3) | bool validWordSquare(vector<string>& words) {
FILE: cpp/421-430/Word Squares.cpp
class Solution (line 1) | class Solution {
type TrieNode (line 3) | struct TrieNode {
method TrieNode (line 6) | TrieNode(): children(26, nullptr) { }
method TrieNode (line 9) | TrieNode* buildTrie(const vector<string>& words) {
method TrieNode (line 6) | TrieNode(): children(26, nullptr) { }
method backtrack (line 25) | void backtrack(const vector<string>& words, int level, TrieNode* root) {
method wordSquares (line 42) | vector<vector<string>> wordSquares(vector<string>& words) {
FILE: cpp/431-440/All O`one Data Structure.cpp
class AllOne (line 1) | class AllOne {
method inc (line 4) | void inc(string key) {
method dec (line 23) | void dec(string key) {
method string (line 46) | string getMaxKey() {
method string (line 50) | string getMinKey() {
type Bucket (line 55) | struct Bucket { int value; unordered_set<string> keys; }
FILE: cpp/431-440/Find All Anagrams in a String.cpp
class Solution (line 1) | class Solution {
method findAnagrams (line 3) | vector<int> findAnagrams(string s, string p) {
FILE: cpp/431-440/Find Right Interval.cpp
class Solution (line 10) | class Solution {
method findRightInterval (line 12) | vector<int> findRightInterval(vector<Interval>& intervals) {
FILE: cpp/431-440/K-th Smallest in Lexicographical Order.cpp
class Solution (line 1) | class Solution {
method dfs (line 3) | int dfs(string prefix, int n) {
method findKthNumber (line 32) | int findKthNumber(int n, int k) {
FILE: cpp/431-440/Minimum Genetic Mutation.cpp
class Solution (line 1) | class Solution {
method minMutation (line 3) | int minMutation(string start, string end, vector<string>& bank) {
method addWord (line 25) | void addWord(string word, unordered_set<string>& dict, queue<string>& ...
FILE: cpp/431-440/Number of Segments in a String.cpp
class Solution (line 1) | class Solution {
method countSegments (line 3) | int countSegments(string s) {
FILE: cpp/431-440/Path Sum III.cpp
class Solution (line 10) | class Solution {
method dfs (line 13) | void dfs(TreeNode* root, map<int, int>& mymap, int currentSum, int tar...
method pathSum (line 24) | int pathSum(TreeNode* root, int sum) {
FILE: cpp/431-440/Ternary Expression Parser.cpp
class Solution (line 1) | class Solution {
method string (line 3) | string parseTernary(string expression) {
FILE: cpp/441-450/Add Two Numbers II.cpp
class Solution (line 9) | class Solution {
method ListNode (line 11) | ListNode* addToFront(int val, ListNode* head){
method length (line 17) | int length(ListNode* head) {
method ListNode (line 27) | ListNode* addTwoNumbers(ListNode* l1, ListNode* l2) {
FILE: cpp/441-450/Arithmetic Slices II - Subsequence.cpp
class Solution (line 1) | class Solution {
method numberOfArithmeticSlices (line 3) | int numberOfArithmeticSlices(vector<int>& A) {
FILE: cpp/441-450/Arranging Coins.cpp
class Solution (line 1) | class Solution {
method arrangeCoins (line 3) | int arrangeCoins(int n) {
FILE: cpp/441-450/Delete Node in a BST.cpp
class Solution (line 11) | class Solution {
method TreeNode (line 13) | TreeNode* deleteNode(TreeNode* root, int key) {
FILE: cpp/441-450/Find All Duplicates in an Array.cpp
class Solution (line 1) | class Solution {
method findDuplicates (line 3) | vector<int> findDuplicates(vector<int>& nums) {
FILE: cpp/441-450/Number of Boomerangs.cpp
class Solution (line 1) | class Solution {
method numberOfBoomerangs (line 3) | int numberOfBoomerangs(vector<pair<int, int>>& points) {
FILE: cpp/441-450/Sequence Reconstruction.cpp
class Solution (line 1) | class Solution {
method sequenceReconstruction (line 3) | bool sequenceReconstruction(vector<int>& org, vector<vector<int>>& seq...
FILE: cpp/441-450/Serialize and Deserialize BST.cpp
class Codec (line 1) | class Codec {
method string (line 5) | string serialize(TreeNode* root) {
method preorderDFS (line 11) | void preorderDFS(TreeNode* root, string& order) {
method TreeNode (line 21) | TreeNode* deserialize(string data) {
method TreeNode (line 26) | inline TreeNode* reconstruct(const string& buffer, int& pos, int minVa...
FILE: cpp/441-450/String Compression.cpp
class Solution (line 1) | class Solution {
method compress (line 3) | int compress(vector<char>& chars) {
FILE: cpp/451-460/132 Pattern.cpp
class Solution (line 1) | class Solution {
method find132pattern (line 3) | bool find132pattern(vector<int>& nums) {
FILE: cpp/451-460/4Sum II.cpp
class Solution (line 1) | class Solution {
method fillMap (line 3) | void fillMap(const vector<int>& A, const vector<int>& B, unordered_map...
method fourSumCount (line 10) | int fourSumCount(vector<int>& A, vector<int>& B, vector<int>& C, vecto...
FILE: cpp/451-460/Assign Cookies.cpp
class Solution (line 1) | class Solution {
method findContentChildren (line 3) | int findContentChildren(vector<int>& g, vector<int>& s) {
FILE: cpp/451-460/LFU Cache.cpp
class LFUCache (line 1) | class LFUCache {
method LFUCache (line 12) | LFUCache(int capacity) {
method get (line 17) | int get(int key) {
method put (line 31) | void put(int key, int value) {
FILE: cpp/451-460/Minimum Moves to Equal Array Elements.cpp
class Solution (line 1) | class Solution {
method minMoves (line 3) | int minMoves(vector<int>& nums) {
FILE: cpp/451-460/Minimum Number of Arrows to Burst Balloons.cpp
class Solution (line 1) | class Solution {
method findMinArrowShots (line 3) | int findMinArrowShots(vector<pair<int, int>>& points) {
FILE: cpp/451-460/Repeated Substring Pattern.cpp
class Solution (line 1) | class Solution {
method repeatedSubstringPattern (line 3) | bool repeatedSubstringPattern(string str) {
FILE: cpp/451-460/Sort Characters By Frequency.cpp
class Solution (line 1) | class Solution {
method string (line 3) | string frequencySort(string s) {
FILE: cpp/461-470/Can I Win.cpp
class Solution (line 1) | class Solution {
method buildkey (line 3) | int buildkey (bool *nums, int N) {
method caniwin (line 9) | bool caniwin (bool *nums, int N, int desiredTotal, map<int, bool> &cac...
method canIWin (line 33) | bool canIWin(int maxChoosableInteger, int desiredTotal) {
FILE: cpp/461-470/Convex Polygon.cpp
class Solution (line 1) | class Solution {
method isConvex (line 3) | bool isConvex(vector<vector<int>>& points) {
FILE: cpp/461-470/Count The Repetitions.cpp
class Solution (line 52) | class Solution {
method getMaxRepetitions (line 54) | int getMaxRepetitions(string s1, int n1, string s2, int n2) {
FILE: cpp/461-470/Hamming Distance.cpp
class Solution (line 1) | class Solution {
method hammingDistance (line 3) | int hammingDistance(int x, int y) {
FILE: cpp/461-470/Island Perimeter.cpp
class Solution (line 1) | class Solution {
method islandPerimeter (line 3) | int islandPerimeter(vector<vector<int>>& grid) {
FILE: cpp/461-470/Minimum Moves to Equal Array Elements II.cpp
class Solution (line 1) | class Solution {
method minMoves2 (line 3) | int minMoves2(vector<int>& nums) {
FILE: cpp/461-470/Optimal Account Balancing.cpp
class Solution (line 1) | class Solution {
method helper (line 3) | int helper(vector<int>& a, int start, int n) {
method minTransfers (line 17) | int minTransfers(vector<vector<int>>& transactions) {
FILE: cpp/461-470/Unique Substrings in Wraparound String.cpp
class Solution (line 1) | class Solution {
method findSubstringInWraproundString (line 3) | int findSubstringInWraproundString(string p) {
FILE: cpp/461-470/Validate IP Address.cpp
class Solution (line 1) | class Solution {
method split (line 3) | void split(const std::string &s, char delim, std::vector<std::string> ...
method split (line 12) | std::vector<std::string> split(const std::string &s, char delim) {
method validateV4num (line 18) | static bool validateV4num(const string& num) {
method validateV6num (line 28) | static bool validateV6num(const string& num) {
method string (line 39) | string checkV4(const string& IP) {
method string (line 46) | string checkV6(const string& IP) {
method string (line 54) | string validIPAddress(string IP) {
FILE: cpp/471-480/Concatenated Words.cpp
class Solution (line 1) | class Solution {
method findAllConcatenatedWordsInADict (line 3) | vector<string> findAllConcatenatedWordsInADict(vector<string>& words) {
method wordBreak (line 17) | bool wordBreak(const string& s, const unordered_set<string>& wordDict) {
FILE: cpp/471-480/Encode String with Shortest Length.cpp
class Solution (line 1) | class Solution {
method numRepetition (line 2) | int numRepetition(const string &s, const string &t) {
method string (line 12) | string dfs(const string& s, unordered_map<string, string> &m) {
method string (line 30) | string encode(string s) {
FILE: cpp/471-480/Heaters.cpp
class Solution (line 1) | class Solution {
method findRadius (line 3) | int findRadius(vector<int>& houses, vector<int>& heaters) {
FILE: cpp/471-480/Largest Palindrome Product.cpp
class Solution (line 1) | class Solution {
method largestPalindrome (line 3) | int largestPalindrome(int n) {
method buildPalindrome (line 18) | long buildPalindrome(int n) {
FILE: cpp/471-480/Matchsticks to Square.cpp
class Solution (line 1) | class Solution {
method genKey (line 5) | int genKey(const vector<int>& nums) {
method dfs (line 14) | bool dfs(vector<int>& nums, int sidelength, int remain, int sideidx, i...
method makesquare (line 42) | bool makesquare(vector<int>& nums) {
FILE: cpp/471-480/Number Complement.cpp
class Solution (line 1) | class Solution {
method findComplement (line 3) | int findComplement(int num) {
FILE: cpp/471-480/Ones and Zeroes.cpp
class Solution (line 1) | class Solution {
method count (line 3) | pair<int, int> count(const string& str) {
method findMaxForm (line 13) | int findMaxForm(vector<string>& strs, int m, int n) {
FILE: cpp/471-480/Sliding Window Median.cpp
class Solution (line 1) | class Solution {
method medianSlidingWindow (line 3) | vector<double> medianSlidingWindow(vector<int>& nums, int k) {
FILE: cpp/471-480/Total Hamming Distance.cpp
class Solution (line 1) | class Solution {
method totalHammingDistance (line 3) | int totalHammingDistance(vector<int>& nums) {
FILE: cpp/481-490/Find Permutation.cpp
class Solution (line 1) | class Solution {
method findPermutation (line 3) | vector<int> findPermutation(string s) {
FILE: cpp/481-490/License Key Formatting.cpp
class Solution (line 1) | class Solution {
method string (line 3) | string licenseKeyFormatting(string S, int K) {
FILE: cpp/481-490/Magical String.cpp
class Solution (line 1) | class Solution {
method magicalString (line 3) | int magicalString(int n) {
FILE: cpp/481-490/Max Consecutive Ones II.cpp
class Solution (line 1) | class Solution {
method findMaxConsecutiveOnes (line 3) | int findMaxConsecutiveOnes(vector<int>& nums) {
FILE: cpp/481-490/Max Consecutive Ones.cpp
class Solution (line 1) | class Solution {
method findMaxConsecutiveOnes (line 3) | int findMaxConsecutiveOnes(vector<int>& nums) {
FILE: cpp/481-490/Predict the Winner.cpp
class Solution (line 1) | class Solution {
method PredictTheWinner (line 4) | bool PredictTheWinner(vector<int>& nums) {
FILE: cpp/481-490/Robot Room Cleaner.cpp
class Solution (line 20) | class Solution {
method dfs (line 22) | void dfs(Robot &robot, set<pair<int, int>>& visited, int i, int j, int...
method cleanRoom (line 43) | void cleanRoom(Robot& robot) {
FILE: cpp/481-490/Smallest Good Base.cpp
class Solution (line 1) | class Solution {
method string (line 3) | string smallestGoodBase(string n) {
FILE: cpp/481-490/The Maze.cpp
class Solution (line 1) | class Solution {
method isStone (line 3) | int isStone(vector<vector<int>>& maze, int i, int j) {
method hasPath (line 11) | bool hasPath(vector<vector<int>>& maze, vector<int>& start, vector<int...
FILE: cpp/481-490/Zuma Game.cpp
class Solution (line 1) | class Solution {
method dfs (line 3) | int dfs(string board, string hand, unordered_map<string, int>& cache) {
method findMinStep (line 41) | int findMinStep(string board, string hand) {
method simplify (line 52) | void simplify(string& str) {
FILE: cpp/491-500/Construct the Rectangle.cpp
class Solution (line 1) | class Solution {
method constructRectangle (line 3) | vector<int> constructRectangle(int area) {
FILE: cpp/491-500/Diagonal Traverse.cpp
class Solution (line 1) | class Solution {
method findDiagonalOrder (line 3) | vector<int> findDiagonalOrder(vector<vector<int>>& matrix) {
FILE: cpp/491-500/Increasing Subsequences.cpp
class Solution (line 1) | class Solution {
method findSubsequences (line 3) | void findSubsequences(const vector<int> &nums, vector<int> &subsequenc...
method findSubsequences (line 17) | vector<vector<int>> findSubsequences(vector<int>& nums) {
FILE: cpp/491-500/Keyboard Row.cpp
class Solution (line 1) | class Solution {
method findWords (line 3) | vector<string> findWords(vector<string>& words) {
FILE: cpp/491-500/Next Greater Element I.cpp
class Solution (line 1) | class Solution {
method nextGreaterElement (line 3) | vector<int> nextGreaterElement(vector<int>& findNums, vector<int>& num...
FILE: cpp/491-500/Reverse Pairs.cpp
class Solution (line 1) | class Solution {
method merge (line 6) | void merge(vector<int>& nums, int start, int mid, int end){
method mergeSort (line 19) | void mergeSort(vector<int>& nums, int start, int end){
method reversePairs (line 29) | int reversePairs(vector<int>& nums) {
FILE: cpp/491-500/Target Sum.cpp
class Solution (line 1) | class Solution {
method dfs (line 3) | int dfs(const vector<int>& nums, int i, int S, map<pair<int, int>, int...
method findTargetSumWays (line 17) | int findTargetSumWays(vector<int>& nums, int S) {
FILE: cpp/491-500/Teemo Attacking.cpp
class Solution (line 1) | class Solution {
method findPoisonedDuration (line 3) | int findPoisonedDuration(vector<int>& timeSeries, int duration) {
FILE: cpp/491-500/The Maze III.cpp
class Solution (line 1) | class Solution {
method isStone (line 3) | int isStone(vector<vector<int>>& maze, int i, int j) {
method string (line 12) | string findShortestWay(vector<vector<int>>& maze, vector<int>& ball, v...
FILE: cpp/501-510/Base 7.cpp
class Solution (line 1) | class Solution {
method string (line 3) | string convertToBase7(int num) {
FILE: cpp/501-510/Find Mode in Binary Search Tree.cpp
class Solution (line 10) | class Solution {
method dfs (line 12) | void dfs(TreeNode* root, int& maximum_count, map<int, int>& mymap) {
method findMode (line 22) | vector<int> findMode(TreeNode* root) {
FILE: cpp/501-510/IPO.cpp
class Compare1 (line 1) | class Compare1 {
class Compare2 (line 8) | class Compare2 {
class Solution (line 15) | class Solution {
method findMaximizedCapital (line 17) | int findMaximizedCapital(int k, int W, vector<int>& Profits, vector<in...
FILE: cpp/501-510/Most Frequent Subtree Sum.cpp
class Solution (line 10) | class Solution {
method findFrequentTreeSum (line 12) | vector<int> findFrequentTreeSum(TreeNode* root) {
method countSubtreeSums (line 24) | int countSubtreeSums(TreeNode *r, unordered_map<int,int> &counts, int&...
FILE: cpp/501-510/Next Greater Element II.cpp
class Solution (line 1) | class Solution {
method nextGreaterElements (line 3) | vector<int> nextGreaterElements(vector<int>& nums) {
FILE: cpp/501-510/Perfect Number.cpp
class Solution (line 1) | class Solution {
method checkPerfectNumber (line 3) | bool checkPerfectNumber(int num) {
FILE: cpp/501-510/Relative Ranks.cpp
class Solution (line 1) | class Solution {
method findRelativeRanks (line 3) | vector<string> findRelativeRanks(vector<int>& nums) {
FILE: cpp/501-510/The Maze II.cpp
class Solution (line 1) | class Solution {
method isStone (line 3) | int isStone(vector<vector<int>>& maze, int i, int j) {
method shortestDistance (line 11) | int shortestDistance(vector<vector<int>>& maze, vector<int>& start, ve...
FILE: cpp/511-520/Coin Change 2.cpp
class Solution (line 1) | class Solution {
method change (line 3) | int change(int amount, vector<int>& coins) {
FILE: cpp/511-520/Detect Capital.cpp
class Solution (line 1) | class Solution {
method detectCapitalUse (line 3) | bool detectCapitalUse(string word) {
FILE: cpp/511-520/Find Bottom Left Tree Value.cpp
class Solution (line 10) | class Solution {
method findBottomLeftValue (line 12) | int findBottomLeftValue(TreeNode* root) {
FILE: cpp/511-520/Find Largest Value in Each Tree Row.cpp
class Solution (line 10) | class Solution {
method largestValues (line 12) | vector<int> largestValues(TreeNode* root) {
FILE: cpp/511-520/Freedom Trail.cpp
class Solution (line 1) | class Solution {
method dfs (line 3) | int dfs(const string& ring, const string& key, int index, map<string, ...
method findRotateSteps (line 24) | int findRotateSteps(string ring, string key) {
FILE: cpp/511-520/Longest Palindromic Subsequence.cpp
class Solution (line 1) | class Solution {
method longestPalindromeSubseq (line 3) | int longestPalindromeSubseq(string s) {
FILE: cpp/511-520/Super Washing Machines.cpp
class Solution (line 1) | class Solution {
method findMinMoves (line 3) | int findMinMoves(vector<int>& machines) {
FILE: cpp/521-530/Beautiful Arrangement.cpp
class Solution (line 1) | class Solution {
method countArrangement (line 3) | int countArrangement(int N) {
method counts (line 8) | int counts(int n, vector<int>& vs) {
FILE: cpp/521-530/Contiguous Array.cpp
class Solution (line 1) | class Solution {
method get (line 3) | int get(int v) {
method findMaxLength (line 8) | int findMaxLength(vector<int>& nums) {
FILE: cpp/521-530/Continuous Subarray Sum.cpp
class Solution (line 1) | class Solution {
method checkSubarraySum (line 3) | bool checkSubarraySum(vector<int>& nums, int k) {
FILE: cpp/521-530/Longest Uncommon Subsequence I.cpp
class Solution (line 1) | class Solution {
method findLUSlength (line 3) | int findLUSlength(string a, string b) {
FILE: cpp/521-530/Longest Uncommon Subsequence II.cpp
class Solution (line 1) | class Solution {
method isS1subsOfS2 (line 3) | bool isS1subsOfS2(const string &s1, const string &s2){
method findLUSlength (line 16) | int findLUSlength(vector<string>& strs) {
FILE: cpp/521-530/Longest Word in Dictionary through Deleting.cpp
class Solution (line 1) | class Solution {
method string (line 3) | string findLongestWord(string s, vector<string>& d) {
FILE: cpp/521-530/Minimum Distance Between BST Nodes.cpp
class Solution (line 10) | class Solution {
method dfs (line 12) | void dfs(TreeNode* root, int &pv, int& result) {
method getMinimumDifference (line 21) | int getMinimumDifference(TreeNode* root) {
FILE: cpp/521-530/Word Abbreviation.cpp
class Solution (line 1) | class Solution {
method wordsAbbreviation (line 3) | vector<string> wordsAbbreviation(vector<string>& dict) {
method string (line 32) | string abbreviate(const string& s, int len) {
FILE: cpp/531-540/Complex Number Multiplication.cpp
class Solution (line 1) | class Solution {
method string (line 3) | string complexNumberMultiply(string a, string b) {
FILE: cpp/531-540/Convert BST to Greater Tree.cpp
class Solution (line 10) | class Solution {
method dfs (line 12) | void dfs(TreeNode* root, int& sum) {
method TreeNode (line 21) | TreeNode* convertBST(TreeNode* root) {
FILE: cpp/531-540/Encode and Decode TinyURL.cpp
class Solution (line 1) | class Solution {
method string (line 9) | string encode(string longUrl) {
method string (line 17) | string decode(string shortUrl) {
FILE: cpp/531-540/Lonely Pixel I.cpp
class Solution (line 1) | class Solution {
method findLonelyPixel (line 3) | int findLonelyPixel(vector<vector<char>>& picture) {
FILE: cpp/531-540/Lonely Pixel II.cpp
class Solution (line 1) | class Solution {
method findBlackPixel (line 3) | int findBlackPixel(vector<vector<char>>& picture, int N) {
FILE: cpp/531-540/Single Element in a Sorted Array.cpp
class Solution (line 1) | class Solution {
method singleNonDuplicate (line 3) | int singleNonDuplicate(vector<int>& nums) {
FILE: cpp/541-550/01 Matrix.cpp
class Solution (line 1) | class Solution {
type point (line 3) | struct point {
method point (line 7) | point (int _i, int _j, int _d): i(_i), j(_j), d(_d) { }
method updateMatrix (line 11) | vector<vector<int>> updateMatrix(vector<vector<int>>& matrix) {
FILE: cpp/541-550/Binary Tree Longest Consecutive Sequence II.cpp
class Solution (line 10) | class Solution {
method longestConsecutive (line 12) | int longestConsecutive(TreeNode* root) {
method dfs (line 18) | pair<int, int> dfs(TreeNode * node, TreeNode * parent, int & longest) {
FILE: cpp/541-550/Boundary of Binary Tree.cpp
class Solution (line 10) | class Solution {
method leftBoundary (line 12) | void leftBoundary(TreeNode* root, vector<int>& nodes) {
method rightBoundary (line 19) | void rightBoundary(TreeNode* root, vector<int>& nodes) {
method leaves (line 26) | void leaves(TreeNode* root, vector<int>& nodes) {
method boundaryOfBinaryTree (line 37) | vector<int> boundaryOfBinaryTree(TreeNode* root) {
FILE: cpp/541-550/Diameter of Binary Tree.cpp
class Solution (line 10) | class Solution {
method dfs (line 12) | int dfs(TreeNode* root, int& ans) {
method diameterOfBinaryTree (line 22) | int diameterOfBinaryTree(TreeNode* root) {
FILE: cpp/541-550/Friend Circles.cpp
class Solution (line 1) | class Solution {
method dfs (line 3) | void dfs(int i, vector<vector<int>>& M, vector<int>& colors) {
method findCircleNum (line 14) | int findCircleNum(vector<vector<int>>& M) {
FILE: cpp/541-550/Output Contest Matches.cpp
class Solution (line 1) | class Solution {
method string (line 3) | string findContestMatch(int n) {
FILE: cpp/541-550/Reverse String II.cpp
class Solution (line 1) | class Solution {
method _reverse (line 3) | void _reverse(string &str, int i, int j) {
method string (line 8) | string reverseStr(string s, int k) {
FILE: cpp/541-550/Split Array with Equal Sum.cpp
class Solution (line 1) | class Solution {
method splitArray (line 3) | bool splitArray(vector<int>& nums) {
FILE: cpp/551-560/Brick Wall.cpp
class Solution (line 1) | class Solution {
method leastBricks (line 3) | int leastBricks(vector<vector<int>>& wall) {
FILE: cpp/551-560/Next Greater Element III.cpp
class Solution (line 1) | class Solution {
method nextPermutation (line 3) | void nextPermutation(vector<int> &num) {
method nextGreaterElement (line 25) | int nextGreaterElement(int n) {
FILE: cpp/551-560/Optimal Division.cpp
class Solution (line 1) | class Solution {
method string (line 3) | string optimalDivision(vector<int>& nums) {
FILE: cpp/551-560/Reverse Words in a String III.cpp
class Solution (line 1) | class Solution {
method string (line 3) | string reverseWords(string s) {
FILE: cpp/551-560/Split Concatenated Strings.cpp
class Solution (line 1) | class Solution {
method string (line 3) | string splitLoopedString(vector<string>& strs) {
FILE: cpp/551-560/Student Attendance Record I.cpp
class Solution (line 1) | class Solution {
method checkRecord (line 3) | bool checkRecord(string s) {
FILE: cpp/551-560/Student Attendance Record II.cpp
class Solution (line 1) | class Solution {
method sum (line 5) | long sum(long nums[]) {
method checkRecord (line 9) | int checkRecord(int n) {
FILE: cpp/551-560/Subarray Sum Equals K.cpp
class Solution (line 1) | class Solution {
method subarraySum (line 3) | int subarraySum(vector<int>& nums, int k) {
FILE: cpp/561-570/Array Nesting.cpp
class Solution (line 1) | class Solution {
method arrayNesting (line 3) | int arrayNesting(vector<int>& nums) {
FILE: cpp/561-570/Array Partition I.cpp
class Solution (line 1) | class Solution {
method arrayPairSum (line 3) | int arrayPairSum(vector<int>& nums) {
FILE: cpp/561-570/Binary Tree Tilt.cpp
class Solution (line 10) | class Solution {
method dfs (line 11) | int dfs(TreeNode* root, int &result) {
method findTilt (line 19) | int findTilt(TreeNode* root) {
FILE: cpp/561-570/Longest Line of Consecutive One in Matrix.cpp
class Solution (line 1) | class Solution {
method longestLine (line 3) | int longestLine(vector<vector<int>>& M) {
FILE: cpp/561-570/Maximum Vacation Days.cpp
class Solution (line 1) | class Solution {
method maxVacationDays (line 3) | int maxVacationDays(vector<vector<int>>& flights, vector<vector<int>>&...
method dfs (line 10) | int dfs(int city, int week, vector<vector<int>>& dp, const vector<vect...
FILE: cpp/561-570/Permutation in String.cpp
class Solution (line 1) | class Solution {
method checkInclusion (line 3) | bool checkInclusion(string s1, string s2) {
FILE: cpp/561-570/Reshape the Matrix.cpp
class Solution (line 1) | class Solution {
method matrixReshape (line 3) | vector<vector<int>> matrixReshape(vector<vector<int>>& nums, int r, in...
FILE: cpp/571-580/Distribute Candies.cpp
class Solution (line 1) | class Solution {
method distributeCandies (line 3) | int distributeCandies(vector<int>& candies) {
FILE: cpp/571-580/Out of Boundary Paths.cpp
class Solution (line 1) | class Solution {
method inBox (line 3) | bool inBox(int i, int j, int m, int n) {
method get (line 8) | long get(int i, int j, int k, vector<vector<vector<long>>>& dp, int m,...
method coeff (line 13) | int coeff(int i, int j, int m, int n) {
method findPaths (line 23) | int findPaths(int m, int n, int N, int i, int j) {
FILE: cpp/571-580/Squirrel Simulation.cpp
class Solution (line 1) | class Solution {
method minDistance (line 3) | int minDistance(int height, int width, vector<int>& tree, vector<int>&...
method dis (line 15) | int dis(int a1, int b1, int a2, int b2) {
FILE: cpp/571-580/Subtree of Another Tree.cpp
class Solution (line 10) | class Solution {
method string (line 12) | string serialize(TreeNode* root) {
method string (line 17) | string serialize2(TreeNode* root, const string& target, bool &b) {
method isSubtree (line 24) | bool isSubtree(TreeNode* s, TreeNode* t) {
FILE: cpp/581-590/Delete Operation for Two Strings.cpp
class Solution (line 1) | class Solution {
method lcs (line 2) | int lcs(const string& X, const string& Y) {
method minDistance (line 21) | int minDistance(string word1, string word2) {
FILE: cpp/581-590/Design In-Memory File System.cpp
class FileSystem (line 1) | class FileSystem {
type TrieNode (line 3) | struct TrieNode {
method TrieNode (line 7) | TrieNode() : isFile(false) {}
method getPaths (line 12) | vector<string> getPaths(const string &path) {
method FileSystem (line 25) | FileSystem() {
method ls (line 29) | vector<string> ls(string path) {
method mkdir (line 45) | void mkdir(string path) {
method addContentToFile (line 55) | void addContentToFile(string filePath, string content) {
method string (line 67) | string readContentFromFile(string filePath) {
FILE: cpp/581-590/Erect the Fence.cpp
class Solution (line 11) | class Solution {
method coord2_t (line 18) | coord2_t cross(const Point &O, const Point &A, const Point &B) {
method cmp (line 23) | static bool cmp(Point &p1, Point &p2) {
method equ (line 27) | static bool equ(Point &p1, Point &p2) { return p1.x == p2.x && p1.y ==...
method outerTrees (line 30) | vector<Point> outerTrees(vector<Point> &P) {
FILE: cpp/581-590/Kill Process.cpp
class Solution (line 1) | class Solution {
method killProcess (line 3) | vector<int> killProcess(vector<int>& pid, vector<int>& ppid, int kill) {
FILE: cpp/581-590/Shortest Unsorted Continuous Subarray.cpp
class Solution (line 1) | class Solution {
method findUnsortedSubarray (line 3) | int findUnsortedSubarray(vector<int>& nums) {
FILE: cpp/591-600/Fraction Addition and Subtraction.cpp
class Solution (line 2) | class Solution {
method string (line 4) | string fractionAddition(string expression) {
FILE: cpp/591-600/Longest Harmonious Subsequence.cpp
class Solution (line 1) | class Solution {
method findLHS (line 3) | int findLHS(vector<int>& nums) {
FILE: cpp/591-600/Minimum Index Sum of Two Lists.cpp
class Solution (line 1) | class Solution {
method findRestaurant (line 3) | vector<string> findRestaurant(vector<string>& list1, vector<string>& l...
FILE: cpp/591-600/Non-negative Integers without Consecutive Ones.cpp
class Solution (line 1) | class Solution {
method help (line 2) | int help(int num, int highestPos) {
method findIntegers (line 17) | int findIntegers(int num) {
FILE: cpp/591-600/Range Addition II.cpp
class Solution (line 1) | class Solution {
method maxCount (line 3) | int maxCount(int m, int n, vector<vector<int>>& ops) {
FILE: cpp/591-600/Tag Validator.cpp
class Solution (line 1) | class Solution {
method isValid (line 3) | bool isValid(string code) {
FILE: cpp/591-600/Valid Square.cpp
class Solution (line 1) | class Solution {
method dSquare (line 2) | int dSquare(vector<int>& p1, vector<int>& p2) {
method validSquare (line 7) | bool validSquare(vector<int>& p1, vector<int>& p2, vector<int>& p3, ve...
FILE: cpp/601-610/Can Place Flowers.cpp
class Solution (line 1) | class Solution {
method canPlaceFlowers (line 3) | bool canPlaceFlowers(vector<int>& flowerbed, int n) {
FILE: cpp/601-610/Construct String from Binary Tree.cpp
class Solution (line 10) | class Solution {
method string (line 12) | string tree2str(TreeNode* t) {
FILE: cpp/601-610/Design Compressed String Iterator.cpp
class StringIterator (line 1) | class StringIterator {
method StringIterator (line 7) | StringIterator(string compressedString) {
method next (line 13) | char next() {
method hasNext (line 21) | bool hasNext() {
FILE: cpp/601-610/Find Duplicate File in System.cpp
class Solution (line 1) | class Solution {
method findDuplicate (line 3) | vector<vector<string>> findDuplicate(vector<string>& paths) {
FILE: cpp/611-620/Add Bold Tag in String.cpp
class Solution (line 1) | class Solution {
method string (line 3) | string addBoldTag(string s, vector<string>& dict) {
method findpairs (line 14) | vector<pair<int, int>> findpairs(const string& s, const vector<string>...
method merge (line 25) | vector<pair<int, int>> merge(vector<pair<int, int>>& a) {
FILE: cpp/611-620/Merge Two Binary Trees.cpp
class Solution (line 10) | class Solution {
method TreeNode (line 12) | TreeNode* mergeTrees(TreeNode* t1, TreeNode* t2) {
FILE: cpp/611-620/Valid Triangle Number.cpp
class Solution (line 1) | class Solution {
method triangleNumber (line 3) | int triangleNumber(vector<int>& nums) {
FILE: cpp/621-630/Add One Row to Tree.cpp
class Solution (line 10) | class Solution {
method dfs (line 11) | void dfs(TreeNode* root, TreeNode* parent, int v, int d, bool left) {
method TreeNode (line 28) | TreeNode* addOneRow(TreeNode* root, int v, int d) {
FILE: cpp/621-630/Course Schedule III.cpp
class Solution (line 1) | class Solution {
method scheduleCourse (line 3) | int scheduleCourse(vector<vector<int>>& courses) {
FILE: cpp/621-630/Design Circular Queue.cpp
class MyCircularQueue (line 1) | class MyCircularQueue {
method MyCircularQueue (line 9) | MyCircularQueue(int k) {
method enQueue (line 18) | bool enQueue(int value) {
method deQueue (line 27) | bool deQueue() {
method Front (line 35) | int Front() {
method Rear (line 41) | int Rear() {
method isEmpty (line 47) | bool isEmpty() {
method isFull (line 52) | bool isFull() {
FILE: cpp/621-630/K Inverse Pairs Array.cpp
class Solution (line 1) | class Solution {
method kInversePairs (line 4) | int kInversePairs(int n, int k) {
method dfs (line 9) | long dfs(int n, int k, vector<vector<int>>& dp) {
FILE: cpp/621-630/Maximum Distance in Arrays.cpp
class Solution (line 1) | class Solution {
method maxDistance (line 3) | int maxDistance(vector<vector<int>>& arrays) {
FILE: cpp/621-630/Maximum Product of Three Numbers.cpp
class Solution (line 1) | class Solution {
method maximumProduct (line 3) | int maximumProduct(vector<int>& nums) {
FILE: cpp/621-630/Minimum Factorization.cpp
class Solution (line 1) | class Solution {
method smallestFactorization (line 3) | int smallestFactorization(int a) {
FILE: cpp/621-630/Task Scheduler.cpp
class Solution (line 1) | class Solution {
method leastInterval (line 3) | int leastInterval(vector<char>& tasks, int n) {
FILE: cpp/631-640/Average of Levels in Binary Tree.cpp
class Solution (line 10) | class Solution {
method averageOfLevels (line 12) | vector<double> averageOfLevels(TreeNode* root) {
FILE: cpp/631-640/Decode Ways II.cpp
class Solution (line 1) | class Solution {
method ways (line 4) | int ways(char ch) {
method ways (line 10) | int ways(char ch1, char ch2) {
method numDecodings (line 30) | int numDecodings(string s) {
FILE: cpp/631-640/Design Excel Sum Formula.cpp
class Excel (line 1) | class Excel {
method c2i (line 5) | int c2i(char ch) { return ch - 'A'; }
method parseNum (line 7) | pair<int, char> parseNum(const string& num) {
method Excel (line 12) | Excel(int H, char W) {
method set (line 16) | void set(int r, char c, int v) {
method get (line 25) | int get(int r, char c) {
method sum (line 57) | int sum(int r, char c, vector<string> strs) {
FILE: cpp/631-640/Design Log Storage System.cpp
class LogSystem (line 1) | class LogSystem {
method LogSystem (line 4) | LogSystem() {
method put (line 8) | void put(int id, string timestamp) {
method retrieve (line 12) | vector<int> retrieve(string s, string e, string gra) {
FILE: cpp/631-640/Exclusive Time of Functions.cpp
class Solution (line 1) | class Solution {
method split (line 2) | vector<string> split(const string &s, char delim) {
method exclusiveTime (line 13) | vector<int> exclusiveTime(int n, vector<string>& logs) {
FILE: cpp/631-640/Find the Derangement of An Array.cpp
class Solution (line 1) | class Solution {
method findDerangement (line 4) | int findDerangement(int n) {
FILE: cpp/631-640/Shopping Offers.cpp
class Solution (line 1) | class Solution {
method dfs (line 2) | void dfs(int currentPrice, int offerIndex, vector<int>& price, vector<...
method shoppingOffers (line 23) | int shoppingOffers(vector<int>& price, vector<vector<int>>& special, v...
FILE: cpp/631-640/Smallest Range.cpp
class Solution (line 1) | class Solution {
method smallestRange (line 3) | vector<int> smallestRange(vector<vector<int>>& nums) {
FILE: cpp/631-640/Solve the Equation.cpp
class Solution (line 1) | class Solution {
method parse (line 3) | pair<int, int> parse(string str) {
method string (line 36) | string solveEquation(string equation) {
FILE: cpp/631-640/Sum of Square Numbers.cpp
class Solution (line 1) | class Solution {
method judgeSquareSum (line 3) | bool judgeSquareSum(int c) {
FILE: cpp/641-650/2 Keys Keyboard.cpp
class Solution (line 1) | class Solution {
method minSteps (line 3) | int minSteps(int n) {
FILE: cpp/641-650/Design Search Autocomplete System.cpp
class AutocompleteSystem (line 1) | class AutocompleteSystem {
method AutocompleteSystem (line 6) | AutocompleteSystem(vector<string> sentences, vector<int> times) {
method input (line 11) | vector<string> input(char c) {
FILE: cpp/641-650/Dota2 Senate.cpp
class Solution (line 1) | class Solution {
method string (line 3) | string predictPartyVictory(string senate) {
FILE: cpp/641-650/Maximum Average Subarray I.cpp
class Solution (line 1) | class Solution {
method findMaxAverage (line 3) | double findMaxAverage(vector<int>& nums, int k) {
FILE: cpp/641-650/Maximum Average Subarray II.cpp
class Solution (line 1) | class Solution {
method validate (line 2) | bool validate(const vector<int>& nums, int k, double mid) {
method findMaxAverage (line 23) | double findMaxAverage(vector<int>& nums, int k) {
FILE: cpp/641-650/Maximum Length of Pair Chain.cpp
class Solution (line 1) | class Solution {
method findLongestChain (line 3) | int findLongestChain(vector<vector<int>>& pairs) {
FILE: cpp/641-650/Palindromic Substrings.cpp
class Solution (line 1) | class Solution {
method countSubstrings (line 3) | int countSubstrings(string s) {
FILE: cpp/641-650/Replace Words.cpp
function split (line 1) | vector<string> split(const string &s, char delim) {
type TrieNode (line 13) | struct TrieNode {
method TrieNode (line 17) | TrieNode(): word(false) {
class Trie (line 22) | class Trie {
method Trie (line 25) | Trie() {
method insert (line 30) | void insert(const string& s) {
method string (line 43) | string findShortestRoot(const string& word) {
class Solution (line 62) | class Solution {
method string (line 64) | string replaceWords(vector<string>& dict, string sentence) {
FILE: cpp/641-650/Set Mismatch.cpp
class Solution (line 1) | class Solution {
method findErrorNums (line 3) | vector<int> findErrorNums(vector<int>& nums) {
FILE: cpp/651-660/4 Keys Keyboard.cpp
class Solution (line 1) | class Solution {
method maxA (line 4) | int maxA(int N) {
FILE: cpp/651-660/Coin Path.cpp
class Solution (line 1) | class Solution {
method cheapestJump (line 3) | vector<int> cheapestJump(vector<int>& A, int B) {
FILE: cpp/651-660/Find Duplicate Subtrees.cpp
class Solution (line 10) | class Solution {
method findDuplicateSubtrees (line 12) | vector<TreeNode*> findDuplicateSubtrees(TreeNode* root) {
method string (line 24) | string merkle(TreeNode* root, map<size_t, vector<TreeNode*>>& mymap) {
FILE: cpp/651-660/Find K Closest Elements.cpp
class Solution (line 2) | class Solution {
method findClosestElements (line 4) | vector<int> findClosestElements(vector<int>& arr, int k, int x) {
method findClosestElements (line 40) | vector<int> findClosestElements(vector<int>& arr, int k, int x) {
class Solution (line 38) | class Solution {
method findClosestElements (line 4) | vector<int> findClosestElements(vector<int>& arr, int k, int x) {
method findClosestElements (line 40) | vector<int> findClosestElements(vector<int>& arr, int k, int x) {
FILE: cpp/651-660/Judge Route Circle.cpp
class Solution (line 1) | class Solution {
method judgeCircle (line 3) | bool judgeCircle(string moves) {
FILE: cpp/651-660/Maximum Binary Tree.cpp
class Solution (line 10) | class Solution {
method TreeNode (line 12) | TreeNode* dfs(std::vector<int>::iterator start, std::vector<int>::iter...
method TreeNode (line 29) | TreeNode* constructMaximumBinaryTree(vector<int>& nums) {
FILE: cpp/651-660/Print Binary Tree.cpp
class Solution (line 10) | class Solution {
method height (line 12) | int height(TreeNode* root, int h) {
method dfs (line 21) | void dfs(TreeNode* root, vector<vector<string>>& result, int height, i...
method printTree (line 29) | vector<vector<string>> printTree(TreeNode* root) {
FILE: cpp/651-660/Remove 9.cpp
class Solution (line 1) | class Solution {
method newInteger (line 3) | int newInteger(int n) {
FILE: cpp/651-660/Split Array into Consecutive Subsequences.cpp
class Solution (line 1) | class Solution {
method isPossible (line 3) | bool isPossible(vector<int>& nums) {
FILE: cpp/651-660/Two Sum IV - Input is a BST.cpp
class Solution (line 10) | class Solution {
method dfs (line 13) | void dfs(TreeNode* root, unordered_set<int>& myset, int k) {
method findTarget (line 27) | bool findTarget(TreeNode* root, int k) {
FILE: cpp/661-670/Beautiful Arrangement II.cpp
class Solution (line 1) | class Solution {
method constructArray (line 3) | vector<int> constructArray(int n, int k) {
FILE: cpp/661-670/Equal Tree Partition.cpp
class Solution (line 10) | class Solution {
method dfs (line 13) | int dfs(TreeNode* root) {
method checkEqualTree (line 20) | bool checkEqualTree(TreeNode* root) {
FILE: cpp/661-670/Image Smoother.cpp
class Solution (line 1) | class Solution {
method imageSmoother (line 3) | vector<vector<int>> imageSmoother(vector<vector<int>>& M) {
FILE: cpp/661-670/Kth largest Number in Multiplication Table.cpp
class Solution (line 1) | class Solution {
method validate (line 2) | bool validate(int p, int m, int n, int k){
method findKthNumber (line 12) | int findKthNumber(int m, int n, int k) {
FILE: cpp/661-670/Maximum Swap.cpp
class Solution (line 1) | class Solution {
method maximumSwap (line 3) | int maximumSwap(int num) {
FILE: cpp/661-670/Maximum Width of Binary Tree.cpp
class Solution (line 10) | class Solution {
method widthOfBinaryTree (line 12) | int widthOfBinaryTree(TreeNode* root) {
FILE: cpp/661-670/Non-decreasing Array.cpp
class Solution (line 1) | class Solution {
method checkPossibility (line 3) | bool checkPossibility(vector<int>& nums) {
FILE: cpp/661-670/Path Sum IV.cpp
class Solution (line 1) | class Solution {
method getLeftChild (line 2) | int getLeftChild(int key) {
method pathSum (line 8) | int pathSum(vector<int>& nums) {
FILE: cpp/661-670/Strange Printer.cpp
class Solution (line 1) | class Solution {
method strangePrinter (line 3) | int strangePrinter(string s) {
FILE: cpp/661-670/Trim a Binary Search Tree.cpp
class Solution (line 10) | class Solution {
method TreeNode (line 12) | TreeNode* trimBST(TreeNode* root, int L, int R) {
FILE: cpp/671-680/24 Game.cpp
class Solution (line 1) | class Solution {
method op (line 3) | vector<double> op(double d1, double d2) {
method almost (line 14) | bool almost(double num) {
method dfs (line 18) | bool dfs(vector<double> nums) {
method judgePoint24 (line 44) | bool judgePoint24(vector<int>& nums) {
FILE: cpp/671-680/Cut Off Trees for Golf Event.cpp
class Solution (line 1) | class Solution {
method cutOffTree (line 3) | int cutOffTree(vector<vector<int>>& forest) {
method next_step (line 29) | int next_step(vector<vector<int>>& forest, int sr, int sc, int er, int...
FILE: cpp/671-680/Implement Magic Dictionary.cpp
type TrieNode (line 1) | struct TrieNode {
method TrieNode (line 5) | TrieNode(): word(false) {
class Trie (line 10) | class Trie {
method Trie (line 13) | Trie() {
method insert (line 18) | void insert(const string& s) {
method search (line 31) | bool search(TrieNode* tmp, const string& key, int strIndex, int count) {
class MagicDictionary (line 49) | class MagicDictionary {
method MagicDictionary (line 53) | MagicDictionary() {
method buildDict (line 57) | void buildDict(vector<string> dict) {
method search (line 62) | bool search(string word) {
FILE: cpp/671-680/Longest Continuous Increasing Subsequence.cpp
class Solution (line 1) | class Solution {
method findLengthOfLCIS (line 3) | int findLengthOfLCIS(vector<int>& nums) {
FILE: cpp/671-680/Map Sum Pairs.cpp
type TrieNode (line 1) | struct TrieNode {
method TrieNode (line 6) | TrieNode(): word(false) {
class Trie (line 11) | class Trie {
method dfs (line 13) | int dfs(TrieNode *tmp) {
method Trie (line 22) | Trie() {
method insert (line 27) | void insert(const string& s, int val) {
method startsWith (line 40) | int startsWith(const string& prefix) {
class MapSum (line 56) | class MapSum {
method MapSum (line 60) | MapSum() {
method insert (line 63) | void insert(string key, int val) {
method sum (line 67) | int sum(string prefix) {
FILE: cpp/671-680/Number of Longest Increasing Subsequence.cpp
class Solution (line 1) | class Solution {
method findNumberOfLIS (line 3) | int findNumberOfLIS(vector<int>& nums) {
FILE: cpp/671-680/Second Minimum Node In a Binary Tree.cpp
class Solution (line 10) | class Solution {
method findSecondMinimumValue (line 12) | int findSecondMinimumValue(TreeNode* root) {
method minval (line 17) | int minval(TreeNode* p, int first) {
FILE: cpp/671-680/Valid Palindrome II.cpp
class Solution (line 1) | class Solution {
method validPalindrome (line 3) | bool validPalindrome(string s) {
FILE: cpp/671-680/Valid Parenthesis String.cpp
class Solution (line 1) | class Solution {
method checkValidString (line 3) | bool checkValidString(string s) {
FILE: cpp/681-690/Baseball Game.cpp
class Solution (line 1) | class Solution {
method calPoints (line 3) | int calPoints(vector<string>& ops) {
FILE: cpp/681-690/Employee Importance.cpp
class Solution (line 14) | class Solution {
method dfs (line 16) | int dfs(const map<int, Employee*>& mymap, int id) {
method getImportance (line 25) | int getImportance(vector<Employee*> employees, int id) {
FILE: cpp/681-690/K Empty Slots.cpp
class Solution (line 1) | class Solution {
method kEmptySlots (line 3) | int kEmptySlots(vector<int>& flowers, int k) {
FILE: cpp/681-690/Knight Probability in Chessboard.cpp
class Solution (line 1) | class Solution {
method knightProbability (line 3) | double knightProbability(int N, int K, int r, int c) {
method helper (line 8) | double helper(vector<vector<vector<double>>>& dp, int N, int k, int r,...
FILE: cpp/681-690/Longest Univalue Path.cpp
class Solution (line 10) | class Solution {
method dfs (line 13) | int dfs(TreeNode* root) {
method longestUnivaluePath (line 32) | int longestUnivaluePath(TreeNode* root) {
FILE: cpp/681-690/Maximum Sum of 3 Non-Overlapping Subarrays.cpp
class Solution (line 1) | class Solution {
method maxSumOfThreeSubarrays (line 3) | vector<int> maxSumOfThreeSubarrays(vector<int>& nums, int k) {
FILE: cpp/681-690/Next Closest Time.cpp
class Solution (line 1) | class Solution {
method string (line 3) | string nextClosestTime(string time) {
FILE: cpp/681-690/Redundant Connection II.cpp
class UF (line 1) | class UF {
method UF (line 11) | UF(int N) : parent(N), rank(N, 0), N(N), count(N) {
method find (line 17) | int find(int p) {
method connected (line 25) | bool connected(int p, int q) {
method Union (line 29) | void Union(int p, int q) {
class Solution (line 45) | class Solution {
method findRedundantDirectedConnection (line 47) | vector<int> findRedundantDirectedConnection(vector<vector<int>>& edges) {
FILE: cpp/681-690/Redundant Connection.cpp
class UF (line 1) | class UF {
method UF (line 11) | UF(int N) : parent(N), rank(N, 0), N(N), count(N) {
method find (line 17) | int find(int p) {
method connected (line 25) | bool connected(int p, int q) {
method Union (line 29) | void Union(int p, int q) {
class Solution (line 45) | class Solution {
method findRedundantConnection (line 47) | vector<int> findRedundantConnection(vector<vector<int>>& edges) {
FILE: cpp/681-690/Repeated String Match.cpp
class Solution (line 1) | class Solution {
method repeatedStringMatch (line 3) | int repeatedStringMatch(string A, string B) {
FILE: cpp/691-700/Binary Number with Alternating Bits.cpp
class Solution (line 1) | class Solution {
method hasAlternatingBits (line 3) | bool hasAlternatingBits(int n) {
FILE: cpp/691-700/Count Binary Substrings.cpp
class Solution (line 1) | class Solution {
method countBinarySubstrings (line 3) | int countBinarySubstrings(string s) {
FILE: cpp/691-700/Degree of an Array.cpp
class Solution (line 1) | class Solution {
method findShortestSubArray (line 3) | int findShortestSubArray(vector<int>& nums) {
FILE: cpp/691-700/Falling Squares.cpp
class Solution (line 1) | class Solution {
method fallingSquares (line 3) | vector<int> fallingSquares(vector<pair<int, int>>& positions) {
FILE: cpp/691-700/Max Area of Island.cpp
class Solution (line 1) | class Solution {
method maxAreaOfIsland (line 3) | int maxAreaOfIsland(vector<vector<int>>& grid) {
method AreaOfIsland (line 11) | int AreaOfIsland(vector<vector<int>>& grid, int i, int j){
FILE: cpp/691-700/Number of Distinct Islands.cpp
c
Condensed preview — 1143 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,150K chars).
[
{
"path": ".gitignore",
"chars": 10,
"preview": ".DS_Store\n"
},
{
"path": "LICENSE",
"chars": 1060,
"preview": "Copyright (C) <2015> <leetcode.com>\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of thi"
},
{
"path": "README.md",
"chars": 77779,
"preview": "# leetcode\nLeetCode solutions.\nLeetCode solutions in English.\nLeetCode中文解答。\n\nI uploaded some codes [here](https://zhench"
},
{
"path": "Solve the Equation.cpp",
"chars": 1028,
"preview": "// https://discuss.leetcode.com/topic/95378/concise-c-solution-with-regular-expression-12-lines\nclass Solution {\npublic:"
},
{
"path": "TODO",
"chars": 198,
"preview": "4 Median of Two Sorted Arrays\n5 Longest Palindromic Substring \n9 Palindrome Number\n10 Regular Expression Matching(花了挺多时间"
},
{
"path": "cpp/001-010/Add Two Numbers.cpp",
"chars": 629,
"preview": "class Solution {\npublic:\n ListNode *addTwoNumbers(ListNode *l1, ListNode *l2) {\n ListNode *head = new ListNode"
},
{
"path": "cpp/001-010/Longest Palindromic Substring.cpp",
"chars": 666,
"preview": "class Solution {\npublic:\n string longestPalindrome(string s) {\n int n = s.length();\n int longestBegin ="
},
{
"path": "cpp/001-010/Longest Substring Without Repeating Characters.cpp",
"chars": 510,
"preview": "class Solution {\npublic:\n int lengthOfLongestSubstring(string s) {\n unordered_map<char, int> mymap;\n in"
},
{
"path": "cpp/001-010/Median of Two Sorted Arrays.cpp",
"chars": 1171,
"preview": "class Solution {\npublic:\n double findMedianSortedArrays(vector<int>& nums1, vector<int>& nums2) {\n int m = num"
},
{
"path": "cpp/001-010/Palindrome Number.cpp",
"chars": 345,
"preview": "class Solution {\npublic:\n bool isPalindrome(int x) {\n if (x == 0) return true;\n if (x < 0) return false"
},
{
"path": "cpp/001-010/Regular Expression Matching.cpp",
"chars": 749,
"preview": "class Solution {\n \n bool isMatch(const string& s, int sidx, const string& p, int pidx) {\n if (pidx >= p.len"
},
{
"path": "cpp/001-010/Reverse Integer.cpp",
"chars": 571,
"preview": "class Solution {\npublic:\n int reverse(int x) {\n // INT_MAX: 2147483647\n // INT_MIN: -2147483648\n "
},
{
"path": "cpp/001-010/String to Integer (atoi).cpp",
"chars": 879,
"preview": "class Solution {\npublic:\n int myAtoi(string str) {\n while (str[0] == ' ') {\n str.erase(0, 1);\n "
},
{
"path": "cpp/001-010/Two Sum.cpp",
"chars": 481,
"preview": "class Solution {\npublic:\n vector<int> twoSum(vector<int> &numbers, int target) {\n unordered_map<int, int> m;\n "
},
{
"path": "cpp/001-010/ZigZag Conversion.cpp",
"chars": 616,
"preview": "class Solution {\npublic:\n string convert(string s, int numRows) {\n if (numRows == 1) {\n return s;\n "
},
{
"path": "cpp/011-020/3Sum Closest.cpp",
"chars": 904,
"preview": "class Solution {\npublic:\n int threeSumClosest(vector<int>& nums, int target) {\n int ans = 0;\n int diff "
},
{
"path": "cpp/011-020/3Sum.cpp",
"chars": 984,
"preview": "class Solution {\npublic:\n vector<vector<int>> threeSum(vector<int>& nums) {\n vector<vector<int>> result;\n "
},
{
"path": "cpp/011-020/4Sum.cpp",
"chars": 1225,
"preview": "class Solution {\n \npublic:\n vector<vector<int> > fourSum(vector<int> &num, int target) {\n vector<vector<int"
},
{
"path": "cpp/011-020/Container With Most Water.cpp",
"chars": 297,
"preview": "class Solution {\npublic:\n int maxArea(vector<int>& height) {\n int i(0), j(height.size()-1);\n int area(0"
},
{
"path": "cpp/011-020/Integer to Roman.cpp",
"chars": 646,
"preview": "class Solution {\npublic:\n string intToRoman(int num) {\n map<int, string> mymap{\n {1, \"I\"}, {5, \"V\"}"
},
{
"path": "cpp/011-020/Letter Combinations of a Phone Number.cpp",
"chars": 736,
"preview": "class Solution {\n \npublic:\n vector<string> letterCombinations(string digits) {\n string symbols[10] = {\"\", \""
},
{
"path": "cpp/011-020/Longest Common Prefix.cpp",
"chars": 598,
"preview": "class Solution {\npublic:\n string longestCommonPrefix(vector<string>& strs) {\n if (strs.empty()) {\n "
},
{
"path": "cpp/011-020/Remove Nth Node From End of List.cpp",
"chars": 691,
"preview": "class Solution {\npublic:\n ListNode* removeNthFromEnd(ListNode* head, int n) {\n int len = 0;\n ListNode* "
},
{
"path": "cpp/011-020/Roman to Integer.cpp",
"chars": 521,
"preview": "class Solution {\npublic:\n \n int romanToInt(string s) {\n map<char, int> table { \n {'I', 1}, {'V',"
},
{
"path": "cpp/011-020/Valid Parentheses.cpp",
"chars": 737,
"preview": "class Solution {\npublic:\n bool isValid(string s) {\n stack<char> container;\n for (int i = 0;i < s.length"
},
{
"path": "cpp/021-030/Divide Two Integers.cpp",
"chars": 2196,
"preview": "/*\n * Solution 1:\n * Use long type\n */\nclass Solution {\npublic:\n int divide(int dividend, int divisor) {\n if ("
},
{
"path": "cpp/021-030/Generate Parentheses.cpp",
"chars": 602,
"preview": "class Solution {\n \n void dfs(string s, int open, int close, vector<string>& parentheses) {\n if (close < ope"
},
{
"path": "cpp/021-030/Implement strStr().cpp",
"chars": 447,
"preview": "class Solution {\npublic:\n int strStr(string haystack, string needle) {\n int m = haystack.length(), n = needle."
},
{
"path": "cpp/021-030/Merge Two Sorted Lists.cpp",
"chars": 737,
"preview": "class Solution {\npublic:\n ListNode *mergeTwoLists(ListNode *l1, ListNode *l2) {\n ListNode *head = new ListNode"
},
{
"path": "cpp/021-030/Merge k Sorted Lists.cpp",
"chars": 846,
"preview": "class Solution {\npublic:\n ListNode *mergeKLists(vector<ListNode *> &lists) {\n auto cmp = [] (ListNode *n1, Lis"
},
{
"path": "cpp/021-030/Remove Duplicates from Sorted Array.cpp",
"chars": 275,
"preview": "class Solution {\npublic:\n int removeDuplicates(vector<int>& nums) {\n int pos = 0;\n for (int n : nums) {"
},
{
"path": "cpp/021-030/Remove Element.cpp",
"chars": 262,
"preview": "class Solution {\npublic:\n int removeElement(vector<int>& nums, int val) {\n int pos = 0;\n for (int n : n"
},
{
"path": "cpp/021-030/Reverse Nodes in k-Group.cpp",
"chars": 759,
"preview": "class Solution {\n \n int length(ListNode* head) {\n int len = 0;\n while (head != nullptr) {\n "
},
{
"path": "cpp/021-030/Substring with Concatenation of All Words.cpp",
"chars": 1120,
"preview": "class Solution {\npublic:\n vector<int> findSubstring(string s, vector<string>& words) {\n vector<int> res;\n "
},
{
"path": "cpp/021-030/Swap Nodes in Pairs.cpp",
"chars": 339,
"preview": "class Solution {\npublic:\n ListNode* swapPairs(ListNode* head) {\n if (head == nullptr || head->next == nullptr)"
},
{
"path": "cpp/031-040/Combination Sum II.cpp",
"chars": 1177,
"preview": "#include <iostream>\n#include <unordered_map>\n#include <vector>\n#include <stack>\n#include <queue>\n\nusing namespace std;\n\n"
},
{
"path": "cpp/031-040/Combination Sum.cpp",
"chars": 846,
"preview": "class Solution {\n \n void help(vector<int>& now, vector<int>&candidates, int index, int target, vector<vector<int>>"
},
{
"path": "cpp/031-040/Count and Say.cpp",
"chars": 767,
"preview": "#include <iostream>\n#include <unordered_map>\n#include <vector>\n#include <stack>\n#include <queue>\n\nusing namespace std;\n\n"
},
{
"path": "cpp/031-040/Longest Valid Parentheses.cpp",
"chars": 1231,
"preview": "// Solution 1: DP\nclass Solution {\npublic:\n int longestValidParentheses(string s) {\n int n = s.size();\n "
},
{
"path": "cpp/031-040/Next Permutation.cpp",
"chars": 661,
"preview": "class Solution {\npublic:\n void nextPermutation(vector<int> &num) {\n if (num.empty()) {\n return;\n "
},
{
"path": "cpp/031-040/Search Insert Position.cpp",
"chars": 373,
"preview": "class Solution {\npublic:\n int searchInsert(vector<int>& nums, int target) {\n int lo = 0;\n int hi = nums"
},
{
"path": "cpp/031-040/Search for a Range.cpp",
"chars": 1733,
"preview": "class Solution {\npublic:\n vector<int> searchRange(vector<int>& nums, int target) {\n std::vector<int>::iterator"
},
{
"path": "cpp/031-040/Search in Rotated Sorted Array.cpp",
"chars": 572,
"preview": "class Solution {\npublic:\n int search(vector<int>& nums, int target) {\n int i = 0;\n int j = nums.size() "
},
{
"path": "cpp/031-040/Sudoku Solver.cpp",
"chars": 1616,
"preview": "class Solution {\n\n bool rows[9][9];\n bool cols[9][9];\n bool rec[3][3][9];\n\n bool help(vector<vector<char> > "
},
{
"path": "cpp/031-040/Valid Sudoku.cpp",
"chars": 823,
"preview": "class Solution {\npublic:\n bool isValidSudoku(vector<vector<char> > &board) {\n bool r[9][9], c[9][9], s[3][3][9"
},
{
"path": "cpp/041-050/First Missing Positive.cpp",
"chars": 542,
"preview": "class Solution {\npublic:\n int firstMissingPositive(vector<int>& nums) {\n if (nums.empty()) return 1;\n i"
},
{
"path": "cpp/041-050/Group Anagrams.cpp",
"chars": 437,
"preview": "class Solution {\npublic:\n vector<vector<string>> groupAnagrams(vector<string>& strs) {\n map<string, vector<str"
},
{
"path": "cpp/041-050/Jump Game II.cpp",
"chars": 483,
"preview": "class Solution {\npublic:\n int jump(vector<int>& nums) {\n \n if (nums.size() < 2) return 0;\n \n "
},
{
"path": "cpp/041-050/Multiply Strings.cpp",
"chars": 918,
"preview": "class Solution {\n \npublic:\n string multiply(string num1, string num2) {\n \n string result(num1.length"
},
{
"path": "cpp/041-050/Permutations II.cpp",
"chars": 614,
"preview": "class Solution {\n \n void help(vector<vector<int>>& result, int begin, vector<int> num) {\n if (begin == num."
},
{
"path": "cpp/041-050/Permutations.cpp",
"chars": 579,
"preview": "class Solution {\n \n void help(vector<vector<int>>& result, int begin, vector<int> &num)\n {\n if (begin =="
},
{
"path": "cpp/041-050/Pow.cpp",
"chars": 372,
"preview": "class Solution {\npublic:\n double myPow(double x, int n) {\n double res = 1.0;\n double tmp = x;\n b"
},
{
"path": "cpp/041-050/Rotate Image.cpp",
"chars": 460,
"preview": "class Solution {\npublic:\n void rotate(vector<vector<int> > &matrix) {\n int n = matrix[0].size() -1;\n fo"
},
{
"path": "cpp/041-050/Trapping Rain Water.cpp",
"chars": 584,
"preview": "class Solution {\npublic:\n int trap(vector<int>& height) {\n int i = 0;\n int j = height.size() - 1;\n "
},
{
"path": "cpp/041-050/Wildcard Matching.cpp",
"chars": 515,
"preview": "class Solution {\npublic:\n bool isMatch(string s, string p) {\n \n int i(0),j(0),ss(0),pp(-1);\n \n "
},
{
"path": "cpp/051-060/Insert Interval.cpp",
"chars": 896,
"preview": "class Solution {\n \n vector<Interval> merge(vector<Interval> &intervals) {\n if(intervals.size() < 2)\n "
},
{
"path": "cpp/051-060/Jump Game.cpp",
"chars": 404,
"preview": "class Solution {\npublic:\n bool canJump(vector<int>& nums) {\n \n int maxpos(0);\n\n for (int i = 0; "
},
{
"path": "cpp/051-060/Length of Last Word.cpp",
"chars": 282,
"preview": "class Solution {\npublic:\n int lengthOfLastWord(string s) {\n int len = 0, tail = s.length() - 1;\n while "
},
{
"path": "cpp/051-060/Maximum_Subarray.cpp",
"chars": 970,
"preview": "/*************************************************************************\n\t> File Name: Maximum_Subarray.cpp\n\t> Author:"
},
{
"path": "cpp/051-060/Merge Intervals.cpp",
"chars": 704,
"preview": "class Solution {\npublic:\n vector<vector<int>> merge(vector<vector<int>> &intervals) {\n auto comp = [](const ve"
},
{
"path": "cpp/051-060/N-Queens II.cpp",
"chars": 883,
"preview": "class Solution {\n \n bool *cols;\n bool *add;\n bool *diff;\n int n;\n \n bool valid(int i, int j) {\n "
},
{
"path": "cpp/051-060/N-Queens.cpp",
"chars": 1272,
"preview": "class Solution {\n \n bool *cols;\n bool *add;\n bool *diff;\n int n;\n \n bool valid(int i, int j)\n {\n"
},
{
"path": "cpp/051-060/Permutation Sequence.cpp",
"chars": 570,
"preview": "class Solution {\npublic:\n string getPermutation(int n, int k) {\n int pTable[10] = {1};\n for (int i = 1;"
},
{
"path": "cpp/051-060/Spiral Matrix II.cpp",
"chars": 1066,
"preview": "#include <iostream>\n#include <unordered_map>\n#include <vector>\n#include <stack>\n#include <queue>\n\nusing namespace std;\n\n"
},
{
"path": "cpp/051-060/Spiral Matrix.cpp",
"chars": 1055,
"preview": "#include <iostream>\n#include <unordered_map>\n#include <vector>\n#include <stack>\n#include <queue>\n\nusing namespace std;\n\n"
},
{
"path": "cpp/061-070/Add Binary.cpp",
"chars": 580,
"preview": "class Solution {\npublic:\n string addBinary(string a, string b) {\n string result;\n int carry = 0;\n "
},
{
"path": "cpp/061-070/Climbing Stairs.cpp",
"chars": 263,
"preview": "class Solution {\npublic:\n int climbStairs(int n) {\n vector<int> dp(n, 0);\n dp[0] = 1;\n dp[1] = 2"
},
{
"path": "cpp/061-070/Minimum Path Sum .cpp",
"chars": 464,
"preview": "public:\nint minPathSum(vector<vector<int> > &grid) {\n \n int n = grid.size();\n int m = grid[0].size();\n int p"
},
{
"path": "cpp/061-070/Plus One.cpp",
"chars": 374,
"preview": "class Solution {\npublic:\n vector<int> plusOne(vector<int>& digits) {\n int carry(1);\n for (int i = digit"
},
{
"path": "cpp/061-070/Rotate List.cpp",
"chars": 768,
"preview": "/**\n * Definition for singly-linked list.\n * struct ListNode {\n * int val;\n * ListNode *next;\n * ListNode(in"
},
{
"path": "cpp/061-070/Sqrt.cpp",
"chars": 969,
"preview": "class Solution {\npublic:\n int mySqrt(int x) {\n if (x == 0) return 0;\n int left(1), right(x);\n wh"
},
{
"path": "cpp/061-070/Text Justification.cpp",
"chars": 1828,
"preview": "class Solution {\n \n vector<int> help(vector<string> &words, int start, int end, int L)\n {\n int wordCount"
},
{
"path": "cpp/061-070/Unique Paths II .cpp",
"chars": 700,
"preview": "class Solution {\npublic:\n int uniquePathsWithObstacles(vector<vector<int> > &obstacleGrid) {\n int m(obstacleGr"
},
{
"path": "cpp/061-070/Unique Paths.cpp",
"chars": 301,
"preview": "class Solution {\npublic:\n int uniquePaths(int m, int n) {\n vector<vector<int> > path(m, vector<int> (n, 1));\n "
},
{
"path": "cpp/061-070/Valid Number.cpp",
"chars": 1049,
"preview": "class Solution {\npublic:\n bool isNumber(string str) {\n int state=0, flag=0; // flag to judge the special case "
},
{
"path": "cpp/071-080/Combinations.cpp",
"chars": 563,
"preview": "class Solution {\n \n void help(int n, int k, int index, vector<int>&tmp, vector<vector<int>>&v)\n {\n if(k "
},
{
"path": "cpp/071-080/Edit Distance.cpp",
"chars": 725,
"preview": "class Solution {\npublic:\n int minDistance(string word1, string word2) {\n int m = word1.length();\n int n"
},
{
"path": "cpp/071-080/Minimum Window Substring.cpp",
"chars": 781,
"preview": "class Solution {\npublic:\n string minWindow(string s, string t) {\n unordered_map<char, int> dict;\n int c"
},
{
"path": "cpp/071-080/Remove Duplicates from Sorted Array II.cpp",
"chars": 316,
"preview": "class Solution {\npublic:\n int removeDuplicates(vector<int>& nums) {\n int rear(1), n(nums.size());\n if ("
},
{
"path": "cpp/071-080/Search a 2D Matrix.cpp",
"chars": 459,
"preview": "class Solution {\npublic:\n bool searchMatrix(vector<vector<int> > &matrix, int target) {\n int row(matrix.size()"
},
{
"path": "cpp/071-080/Set Matrix Zeroes.cpp",
"chars": 823,
"preview": "class Solution {\npublic:\n void setZeroes(vector<vector<int> > &matrix) {\n \n bool col0 = false;\n "
},
{
"path": "cpp/071-080/Simplify Path.cpp",
"chars": 455,
"preview": "class Solution {\npublic:\n string simplifyPath(string path) {\n string res, tmp;\n vector<string> stk;\n "
},
{
"path": "cpp/071-080/Sort Colors.cpp",
"chars": 427,
"preview": "class Solution {\npublic:\n void sortColors(vector<int>& nums) {\n int i = 0, j = 0;\n for (int r = 0; r < "
},
{
"path": "cpp/071-080/Subsets.cpp",
"chars": 527,
"preview": "class Solution {\npublic:\n vector<vector<int> > subsets(vector<int> &S) {\n \n sort(S.begin(),S.end());\n "
},
{
"path": "cpp/071-080/Word Search.cpp",
"chars": 1024,
"preview": "class Solution {\npublic:\n bool dfs(vector<vector<char>>& board, const string &word, int i, int j, int ind) {\n "
},
{
"path": "cpp/081-090/Gray Code.cpp",
"chars": 284,
"preview": "class Solution {\npublic:\n vector<int> grayCode(int n) {\n vector<int> v{0};\n for (int i = 0; i < n; i++)"
},
{
"path": "cpp/081-090/Largest Rectangle in Histogram.cpp",
"chars": 530,
"preview": "class Solution {\npublic:\n int largestRectangleArea(vector<int> &hist) {\n int res(0);\n stack<int> s;\n "
},
{
"path": "cpp/081-090/Maximal Rectangle.cpp",
"chars": 902,
"preview": "class Solution {\npublic:\n int maximalRectangle(vector<vector<char>>& matrix) {\n if (matrix.size() <= 0) return"
},
{
"path": "cpp/081-090/Merge Sorted Array.cpp",
"chars": 675,
"preview": "class Solution {\npublic:\n void merge(vector<int>& nums1, int m, vector<int>& nums2, int n) {\n int i = m - 1;\n "
},
{
"path": "cpp/081-090/Partition List.cpp",
"chars": 652,
"preview": "class Solution {\npublic:\n ListNode *partition(ListNode *head, int x) {\n \n ListNode *head1 = new ListNod"
},
{
"path": "cpp/081-090/Remove Duplicates from Sorted List II.cpp",
"chars": 1136,
"preview": "#include <iostream>\n#include <string>\n#include <vector>\n#include <cmath>\n#include <stack>\n#include <string>\n\nusing names"
},
{
"path": "cpp/081-090/Remove Duplicates from Sorted List.cpp",
"chars": 909,
"preview": "#include <iostream>\n#include <string>\n#include <vector>\n#include <cmath>\n#include <stack>\n#include <string>\n\nusing names"
},
{
"path": "cpp/081-090/Scramble String.cpp",
"chars": 772,
"preview": "class Solution {\n \npublic:\n bool isScramble(string s1, string s2) {\n // Note: The Solution object is instan"
},
{
"path": "cpp/081-090/Search in Rotated Sorted Array II.cpp",
"chars": 665,
"preview": "class Solution {\npublic:\n bool search(vector<int>& nums, int target) {\n int i = 0;\n int j = nums.size()"
},
{
"path": "cpp/081-090/Subsets II.cpp",
"chars": 1036,
"preview": "class Solution {\npublic:\n vector<vector<int>> subsetsWithDup(vector<int>& nums) {\n \n sort(nums.begin(),"
},
{
"path": "cpp/091-100/Binary Tree Inorder Traversal.cpp",
"chars": 663,
"preview": "class Solution {\npublic:\n vector<int> inorderTraversal(TreeNode* root) {\n vector<int> result;\n stack<Tr"
},
{
"path": "cpp/091-100/Decode Ways.cpp",
"chars": 988,
"preview": "class Solution {\n \n bool valid(char ch1, char ch2)\n {\n if(ch1 == '1')\n return true;\n e"
},
{
"path": "cpp/091-100/Interleaving String.cpp",
"chars": 1081,
"preview": "class Solution {\n \npublic:\n bool isInterleave(string s1, string s2, string s3) {\n if(s1.length() + s2.lengt"
},
{
"path": "cpp/091-100/Recover Binary Search Tree.cpp",
"chars": 793,
"preview": "class Solution {\npublic:\n void recoverTree(TreeNode* root) {\n stack<TreeNode*>s;\n TreeNode *p = root;\n "
},
{
"path": "cpp/091-100/Restore IP Addresses.cpp",
"chars": 821,
"preview": "class Solution {\npublic:\n vector<string> restoreIpAddresses(string s) {\n vector<string> ret;\n string an"
},
{
"path": "cpp/091-100/Reverse Linked List II.cpp",
"chars": 717,
"preview": "class Solution {\npublic:\n ListNode *reverseBetween(ListNode *head, int m, int n) {\n int d = n - m;\n if("
},
{
"path": "cpp/091-100/Same Tree.cpp",
"chars": 312,
"preview": "class Solution {\npublic:\n bool isSameTree(TreeNode* p, TreeNode* q) {\n if (p == nullptr && q == nullptr) retur"
},
{
"path": "cpp/091-100/Unique Binary Search Trees II.cpp",
"chars": 1111,
"preview": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * TreeNode *left;\n * TreeNode *r"
},
{
"path": "cpp/091-100/Unique Binary Search Trees.cpp",
"chars": 274,
"preview": "class Solution {\npublic:\n int numTrees(int n) {\n vector<int> dp(n+1, 0);\n dp[0] = dp[1] = 1;\n \n "
},
{
"path": "cpp/091-100/Validate Binary Search Tree.cpp",
"chars": 640,
"preview": "class Solution {\npublic:\n bool isValidBST(TreeNode* root) {\n stack<TreeNode*>s;\n TreeNode *p = root;\n "
},
{
"path": "cpp/1001-10000/1001-1010/Construct Binary Search Tree from Preorder Traversal.cpp",
"chars": 816,
"preview": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * TreeNode *left;\n * TreeNode *r"
},
{
"path": "cpp/1001-10000/1011-1020/Best Sightseeing Pair.cpp",
"chars": 373,
"preview": "class Solution {\npublic:\n int maxScoreSightseeingPair(vector<int>& A) {\n int best_i = 0;\n int ans = 0;\n"
},
{
"path": "cpp/1001-10000/1011-1020/Binary Prefix Divisible By 5.cpp",
"chars": 332,
"preview": "class Solution {\npublic:\n vector<bool> prefixesDivBy5(vector<int>& A) {\n vector<bool> answer(A.size());\n "
},
{
"path": "cpp/1001-10000/1011-1020/Binary String With Substrings Representing 1 To N.cpp",
"chars": 519,
"preview": "class Solution {\npublic:\n bool queryString(string S, int N) {\n for (int i = N; i >= 1; i--) {\n int "
},
{
"path": "cpp/1001-10000/1011-1020/Convert to Base -2.cpp",
"chars": 376,
"preview": "class Solution {\npublic:\n string baseNeg2(int N) {\n if (N == 0) return \"0\";\n string ans;\n \n "
},
{
"path": "cpp/1001-10000/1011-1020/Next Greater Node In Linked List.cpp",
"chars": 780,
"preview": "/**\n * Definition for singly-linked list.\n * struct ListNode {\n * int val;\n * ListNode *next;\n * ListNode(in"
},
{
"path": "cpp/1001-10000/1011-1020/Number of Enclaves.cpp",
"chars": 1056,
"preview": "class Solution {\n \n pair<int, int> tmp[4] = {{1,0}, {-1,0}, {0,1}, {0,-1}};\n \n int m;\n int n;\n \n vo"
},
{
"path": "cpp/1001-10000/1011-1020/Partition Array Into Three Parts With Equal Sum.cpp",
"chars": 392,
"preview": "class Solution {\npublic:\n bool canThreePartsEqualSum(vector<int>& A) {\n int target = std::accumulate(A.begin()"
},
{
"path": "cpp/1001-10000/1021-1030/Camelcase Matching.cpp",
"chars": 936,
"preview": "class Solution {\npublic:\n vector<bool> camelMatch(vector<string>& queries, string pattern) {\n vector<bool> ans"
},
{
"path": "cpp/1001-10000/1021-1030/Divisor Game.cpp",
"chars": 428,
"preview": "class Solution {\n map<int, bool> dp;\npublic:\n bool divisorGame(int N) {\n if (N == 0) return false;\n "
},
{
"path": "cpp/1001-10000/1021-1030/Longest Arithmetic Sequence.cpp",
"chars": 511,
"preview": "class Solution {\npublic:\n int longestArithSeqLength(vector<int>& A) {\n unordered_map<int, int> dp;\n int"
},
{
"path": "cpp/1001-10000/1021-1030/Matrix Cells in Distance Order.cpp",
"chars": 1273,
"preview": "class Solution {\npublic:\n vector<vector<int>> allCellsDistOrder(int R, int C, int r0, int c0) {\n vector<vector"
},
{
"path": "cpp/1001-10000/1021-1030/Maximum Difference Between Node and Ancestor.cpp",
"chars": 682,
"preview": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * TreeNode *left;\n * TreeNode *r"
},
{
"path": "cpp/1001-10000/1021-1030/Recover a Tree From Preorder Traversal.cpp",
"chars": 935,
"preview": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * TreeNode *left;\n * TreeNode *r"
},
{
"path": "cpp/1001-10000/1021-1030/Remove Outermost Parentheses.cpp",
"chars": 620,
"preview": "class Solution {\npublic:\n string removeOuterParentheses(string S) {\n string return_ans;\n stack<char> my"
},
{
"path": "cpp/1001-10000/1021-1030/Sum of Root To Leaf Binary Numbers.cpp",
"chars": 591,
"preview": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * TreeNode *left;\n * TreeNode *r"
},
{
"path": "cpp/1001-10000/1021-1030/Two City Scheduling.cpp",
"chars": 811,
"preview": "class Solution {\npublic:\n int twoCitySchedCost(vector<vector<int>>& costs) {\n sort(begin(costs), end(costs), ["
},
{
"path": "cpp/1001-10000/1021-1030/Video Stitching.cpp",
"chars": 714,
"preview": "class Solution {\npublic:\n int videoStitching(vector<vector<int>>& clips, int T) {\n auto cmp = [](const vector<"
},
{
"path": "cpp/1001-10000/1031-1040/Binary Search Tree to Greater Sum Tree.cpp",
"chars": 519,
"preview": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * TreeNode *left;\n * TreeNode *r"
},
{
"path": "cpp/1001-10000/1031-1040/Coloring A Border.cpp",
"chars": 1306,
"preview": "class Solution {\n \n int old_color;\n int new_color;\n int row;\n int col;\n pair<int, int> tmp[4] = {{-1, "
},
{
"path": "cpp/1001-10000/1031-1040/Escape a Large Maze.cpp",
"chars": 1613,
"preview": "class Solution {\n \n bool find = false;\n \n pair<int, int> tmp[4] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};\n \n "
},
{
"path": "cpp/1001-10000/1031-1040/Maximum Sum of Two Non-Overlapping Subarrays.cpp",
"chars": 615,
"preview": "class Solution {\npublic:\n int maxSumTwoNoOverlap(vector<int>& A, int L, int M) {\n vector<int> sum = {0};\n "
},
{
"path": "cpp/1001-10000/1031-1040/Minimum Score Triangulation of Polygon.cpp",
"chars": 985,
"preview": "class Solution {\n \n int dfs(vector<int>& A, map<pair<int, int>, int>& cache, int start_index, int end_index) {\n "
},
{
"path": "cpp/1001-10000/1031-1040/Moving Stones Until Consecutive.cpp",
"chars": 494,
"preview": "class Solution {\npublic:\n vector<int> numMovesStones(int a, int b, int c) {\n vector<int> v{a,b,c};\n sor"
},
{
"path": "cpp/1001-10000/1031-1040/Stream of Characters.cpp",
"chars": 1698,
"preview": "struct TrieNode {\n TrieNode *nodes[26];\n bool word;\n // Initialize your data structure here.\n TrieNode(): wo"
},
{
"path": "cpp/1001-10000/1031-1040/Uncrossed Lines.cpp",
"chars": 554,
"preview": "class Solution {\npublic:\n int maxUncrossedLines(vector<int>& A, vector<int>& B) {\n int m = A.size();\n i"
},
{
"path": "cpp/1001-10000/1031-1040/Valid Boomerang.cpp",
"chars": 552,
"preview": "class Solution {\npublic:\n bool isBoomerang(vector<vector<int>>& points) {\n sort(points.begin(), points.end());"
},
{
"path": "cpp/1001-10000/1041-1050/Flower Planting With No Adjacent.cpp",
"chars": 1219,
"preview": "class Solution {\n vector<int> colors;\n \n void dfs(int u, map<int, vector<int>>& edges) {\n vector<int> ne"
},
{
"path": "cpp/1001-10000/1041-1050/Last Stone Weight II.cpp",
"chars": 589,
"preview": "class Solution {\n\npublic:\n int lastStoneWeightII(vector<int>& stones) {\n int sum = 0;\n bool dp[1501] = "
},
{
"path": "cpp/1001-10000/1041-1050/Last Stone Weight.cpp",
"chars": 525,
"preview": "class Solution {\npublic:\n int lastStoneWeight(vector<int>& stones) {\n std::priority_queue<int, std::vector<int"
},
{
"path": "cpp/1001-10000/1041-1050/Longest String Chain.cpp",
"chars": 949,
"preview": "class Solution {\n \n int dfs(const string& word, const unordered_set<string>& dictionary, unordered_map<string, int"
},
{
"path": "cpp/1001-10000/1041-1050/Partition Array for Maximum Sum.cpp",
"chars": 635,
"preview": "class Solution {\npublic:\n int maxSumAfterPartitioning(vector<int>& A, int K) {\n vector<int> dp(A.size()+1, 0);"
},
{
"path": "cpp/1001-10000/1041-1050/Remove All Adjacent Duplicates In String.cpp",
"chars": 326,
"preview": "class Solution {\npublic:\n string removeDuplicates(string S) {\n int i = 0;\n \n for (char ch : S) {"
},
{
"path": "cpp/1001-10000/1041-1050/Robot Bounded In Circle.cpp",
"chars": 1593,
"preview": "class Solution {\n \n pair<int, int> getNextDirection(pair<int, int> d, char ch) {\n if (ch == 'L') {\n "
},
{
"path": "cpp/1001-10000/1051-1060/Distant Barcodes.cpp",
"chars": 1106,
"preview": "class Solution {\npublic:\n vector<int> rearrangeBarcodes(vector<int>& barcodes) {\n auto cmp = [](const pair<int"
},
{
"path": "cpp/1001-10000/1051-1060/Grumpy Bookstore Owner.cpp",
"chars": 574,
"preview": "class Solution {\npublic:\n int maxSatisfied(vector<int>& customers, vector<int>& grumpy, int X) {\n int gained ="
},
{
"path": "cpp/1001-10000/1051-1060/Height Checker.cpp",
"chars": 333,
"preview": "class Solution {\npublic:\n int heightChecker(vector<int>& heights) {\n int returned_ans = 0;\n vector<int>"
},
{
"path": "cpp/1001-10000/1051-1060/Previous Permutation With One Swap.cpp",
"chars": 811,
"preview": "class Solution {\npublic:\n vector<int> prevPermOpt1(vector<int>& A) {\n if (A.empty()) return A;\n \n "
},
{
"path": "cpp/1001-10000/1071-1080/Adding Two Negabinary Numbers.cpp",
"chars": 974,
"preview": "class Solution {\npublic:\n vector<int> addNegabinary(vector<int>& arr1, vector<int>& arr2) {\n vector<int> ans;\n"
},
{
"path": "cpp/1001-10000/1071-1080/Flip Columns For Maximum Number of Equal Rows.cpp",
"chars": 618,
"preview": "class Solution {\n \n void process(map<string, int>& mymap, const vector<int>& vec) {\n string str1, str2;\n "
},
{
"path": "cpp/1001-10000/1071-1080/Greatest Common Divisor of Strings.cpp",
"chars": 669,
"preview": "class Solution {\n \n bool IsValid(const string& str, const string& candidate) {\n for (int i = 0; i < str.len"
},
{
"path": "cpp/1001-10000/1071-1080/Insufficient Nodes in Root to Leaf Paths.cpp",
"chars": 655,
"preview": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * TreeNode *left;\n * TreeNode *r"
},
{
"path": "cpp/1001-10000/1071-1080/Letter Tile Possibilities.cpp",
"chars": 691,
"preview": "class Solution {\n int fact[8] = { 1, 1, 2, 6, 24, 120, 720, 5040 };\n set<string> st;\n \n int uniquePerms(cons"
},
{
"path": "cpp/1001-10000/1071-1080/Number of Submatrices That Sum to Target.cpp",
"chars": 765,
"preview": "class Solution {\npublic:\n int numSubmatrixSumTarget(vector<vector<int>>& matrix, int target) {\n int m = matrix"
},
{
"path": "cpp/1001-10000/1071-1080/Occurrences After Bigram.cpp",
"chars": 691,
"preview": "class Solution {\npublic:\n vector<string> findOcurrences(string text, string first, string second) {\n string ma"
},
{
"path": "cpp/1001-10000/1081-1090/Duplicate Zeros.cpp",
"chars": 569,
"preview": "class Solution {\npublic:\n void duplicateZeros(vector<int>& arr) {\n int zeros_now = 0;\n for (int e : arr"
},
{
"path": "cpp/1001-10000/1081-1090/Largest Values From Labels.cpp",
"chars": 763,
"preview": "class Solution {\npublic:\n int largestValsFromLabels(vector<int>& values, vector<int>& labels, int num_wanted, int use"
},
{
"path": "cpp/1001-10000/1081-1090/Smallest Subsequence of Distinct Characters.cpp",
"chars": 1043,
"preview": "class Solution {\npublic:\n string smallestSubsequence(string text) {\n \n bool visited[26] = {false};\n "
},
{
"path": "cpp/1001-10000/1091-1100/Brace Expansion II.cpp",
"chars": 2215,
"preview": "class Solution {\n \n set<string> merge(const set<string>& set1, const set<string>& set2) {\n set<string> ans;"
},
{
"path": "cpp/1001-10000/1091-1100/Car Pooling.cpp",
"chars": 548,
"preview": "class Solution {\npublic:\n bool carPooling(vector<vector<int>>& trips, int capacity) {\n vector<pair<int, int>> "
},
{
"path": "cpp/1001-10000/1091-1100/Find in Mountain Array.cpp",
"chars": 2569,
"preview": "/**\n * // This is the MountainArray's API interface.\n * // You should not implement it, or speculate about its implement"
},
{
"path": "cpp/1001-10000/1091-1100/Shortest Common Supersequence.cpp",
"chars": 1520,
"preview": "class Solution {\n \npublic:\n string shortestCommonSupersequence(string str1, string str2) {\n int m = str1.si"
},
{
"path": "cpp/1001-10000/1091-1100/Shortest Path in Binary Matrix.cpp",
"chars": 1304,
"preview": "class Solution {\npublic:\n int shortestPathBinaryMatrix(vector<vector<int>>& grid) {\n int m = grid.size();\n "
},
{
"path": "cpp/1001-10000/1091-1100/Statistics from a Large Sample.cpp",
"chars": 1179,
"preview": "class Solution {\npublic:\n vector<double> sampleStats(vector<int>& count) {\n vector<double> res{256, -1, 0, 0, "
},
{
"path": "cpp/1001-10000/1091-1100/Two Sum Less Than K.cpp",
"chars": 422,
"preview": "class Solution {\npublic:\n int twoSumLessThanK(vector<int>& A, int K) {\n sort(begin(A), end(A));\n int i "
},
{
"path": "cpp/1001-10000/1101-1110/Corporate Flight Bookings.cpp",
"chars": 523,
"preview": "class Solution {\npublic:\n vector<int> corpFlightBookings(vector<vector<int>>& bookings, int n) {\n unordered_ma"
},
{
"path": "cpp/1001-10000/1101-1110/Defanging an IP Address.cpp",
"chars": 319,
"preview": "class Solution {\npublic:\n string defangIPaddr(string address) {\n string ans;\n \n for (char ch : a"
},
{
"path": "cpp/1001-10000/1101-1110/Delete Nodes And Return Forest.cpp",
"chars": 1019,
"preview": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * TreeNode *left;\n * TreeNode *r"
},
{
"path": "cpp/1001-10000/1101-1110/Distribute Candies to People.cpp",
"chars": 412,
"preview": "class Solution {\npublic:\n vector<int> distributeCandies(int candies, int num_people) {\n vector<int> ans(num_pe"
},
{
"path": "cpp/1001-10000/1101-1110/Filling Bookcase Shelves.cpp",
"chars": 2182,
"preview": "class Solution {\npublic:\n int minHeightShelves(vector<vector<int>>& books, int shelf_width) {\n vector<int> dp("
},
{
"path": "cpp/1001-10000/1101-1110/Parsing A Boolean Expression.cpp",
"chars": 1367,
"preview": "class Solution {\npublic:\n bool parseBoolExpr(string expression) {\n stack<char> ops;\n stack<bool> nums;\n"
},
{
"path": "cpp/1001-10000/1101-1110/Path In Zigzag Labelled Binary Tree.cpp",
"chars": 790,
"preview": "class Solution {\npublic:\n vector<int> pathInZigZagTree(int label) {\n int row = 0;\n int tmp = label;\n "
},
{
"path": "cpp/1001-10000/1111-1120/Maximum Nesting Depth of Two Valid Parentheses Strings.cpp",
"chars": 474,
"preview": "class Solution {\npublic:\n vector<int> maxDepthAfterSplit(string seq) {\n int n = seq.size();\n vector<int"
},
{
"path": "cpp/1001-10000/1111-1120/Print FooBar Alternately.cpp",
"chars": 672,
"preview": "class FooBar {\n mutex m1,m2;\nprivate:\n int n;\n\npublic:\n FooBar(int n) {\n this->n = n;\n\t\tm1.lock();\n }"
},
{
"path": "cpp/1001-10000/1111-1120/Print in Order.cpp",
"chars": 684,
"preview": "class Foo {\n \n std::promise<void> p1;\n std::promise<void> p2;\n \npublic:\n Foo() {\n \n }\n\n void"
},
{
"path": "cpp/1001-10000/1121-1130/Lowest Common Ancestor of Deepest Leaves.cpp",
"chars": 825,
"preview": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * TreeNode *left;\n * TreeNode *r"
},
{
"path": "cpp/1001-10000/1121-1130/Minimum Cost Tree From Leaf Values.cpp",
"chars": 1087,
"preview": "class Solution {\npublic:\n int mctFromLeafValues(vector<int>& arr) {\n int n = arr.size();\n vector<vector"
},
{
"path": "cpp/1001-10000/1121-1130/Number of Equivalent Domino Pairs.cpp",
"chars": 458,
"preview": "class Solution {\npublic:\n int numEquivDominoPairs(vector<vector<int>>& dominoes) {\n map<pair<int, int>, int> m"
},
{
"path": "cpp/1001-10000/1121-1130/Relative Sort Array.cpp",
"chars": 715,
"preview": "class Solution {\npublic:\n vector<int> relativeSortArray(vector<int>& arr1, vector<int>& arr2) {\n map<int, int>"
},
{
"path": "cpp/1001-10000/1121-1130/Smallest Sufficient Team.cpp",
"chars": 2602,
"preview": "class Solution {\n \n vector<int> ans;\n \n map<string, vector<int>> skill_to_ppl;\n \n bool dfs(int need_sk"
},
{
"path": "cpp/1001-10000/1131-1140/N-th Tribonacci Number.cpp",
"chars": 298,
"preview": "class Solution {\npublic:\n int tribonacci(int n) {\n int dp[50] = {0};\n dp[1] = 1;\n dp[2] = 1;\n "
},
{
"path": "cpp/1001-10000/1141-1150/Binary Tree Coloring Game.cpp",
"chars": 797,
"preview": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * TreeNode *left;\n * TreeNode *r"
},
{
"path": "cpp/1001-10000/1141-1150/Decrease Elements To Make Array Zigzag.cpp",
"chars": 680,
"preview": "class Solution {\npublic:\n int movesToMakeZigzag(vector<int>& nums) {\n int temp1 = 0;\n for (int i = 1; i"
},
{
"path": "cpp/1001-10000/1141-1150/Longest Chunked Palindrome Decomposition.cpp",
"chars": 765,
"preview": "class Solution {\npublic:\n int longestDecomposition(string text) {\n if (text.length() <= 1) return text.length("
},
{
"path": "cpp/1001-10000/1141-1150/Longest Common Subsequence.cpp",
"chars": 575,
"preview": "class Solution {\npublic:\n int longestCommonSubsequence(string text1, string text2) {\n int m = text1.length();\n"
},
{
"path": "cpp/1001-10000/1141-1150/Snapshot Array.cpp",
"chars": 967,
"preview": "class SnapshotArray {\n map<pair<int, int>, int> mymap_;\n int snapshot_id_;\n map<int, vector<int>> index_to_snap"
},
{
"path": "cpp/1001-10000/1151-1160/Day of the Year.cpp",
"chars": 410,
"preview": "class Solution {\npublic:\n int dayOfYear(string date) {\n vector<int> daysOfMonth{31, 28, 31, 30, 31, 30, 31, 31"
},
{
"path": "cpp/1001-10000/1151-1160/Find Words That Can Be Formed by Characters.cpp",
"chars": 666,
"preview": "class Solution {\npublic:\n int countCharacters(vector<string>& words, string chars) {\n map<char, int> mymap;\n "
},
{
"path": "cpp/1001-10000/1151-1160/Number of Dice Rolls With Target Sum.cpp",
"chars": 557,
"preview": "class Solution {\n unordered_map<int, long> cache;\npublic:\n int numRollsToTarget(int d, int f, int target) {\n "
},
{
"path": "cpp/1001-10000/1161-1170/As Far from Land as Possible.cpp",
"chars": 1492,
"preview": "class Solution {\npublic:\n int maxDistance(vector<vector<int>>& grid) {\n queue<pair<int, int>> myqueue;\n "
},
{
"path": "cpp/1001-10000/1161-1170/Compare Strings by Frequency of the Smallest Character.cpp",
"chars": 764,
"preview": "class Solution {\n \n int getF(const string& word) {\n char ch = word[0];\n for (int i = 1; i < word.siz"
},
{
"path": "cpp/1001-10000/1161-1170/Design File System.cpp",
"chars": 736,
"preview": "class FileSystem {\n map<string, int> mymap;\npublic:\n FileSystem() {\n mymap[\"\"] = 0;\n }\n \n bool cre"
},
{
"path": "cpp/1001-10000/1161-1170/Invalid Transactions.cpp",
"chars": 1278,
"preview": "class Solution {\n \n vector<string> split(const string &s, char delim) {\n vector<string> elems;\n stri"
},
{
"path": "cpp/1001-10000/1161-1170/Maximum Level Sum of a Binary Tree.cpp",
"chars": 780,
"preview": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * TreeNode *left;\n * TreeNode *r"
},
{
"path": "cpp/1001-10000/1161-1170/Minimum Cost to Connect Sticks.cpp",
"chars": 476,
"preview": "class Solution {\npublic:\n int connectSticks(vector<int>& sticks) {\n priority_queue<int, vector<int>, std::grea"
},
{
"path": "cpp/1001-10000/1161-1170/Optimize Water Distribution in a Village.cpp",
"chars": 1571,
"preview": "class UF {\n \nprivate:\n vector<int> parent;\n vector<int> rank;\n int count;\n int N;\n \npublic:\n \n U"
},
{
"path": "cpp/1001-10000/1161-1170/Single-Row Keyboard.cpp",
"chars": 396,
"preview": "class Solution {\npublic:\n int calculateTime(string keyboard, string word) {\n map<char, int> kmap;\n for "
},
{
"path": "cpp/1001-10000/1171-1180/Can Make Palindrome from Substring.cpp",
"chars": 872,
"preview": "class Solution {\npublic:\n vector<bool> canMakePaliQueries(string s, vector<vector<int>>& queries) {\n vector<ve"
},
{
"path": "cpp/1001-10000/1171-1180/Count Substrings with Only One Distinct Letter.cpp",
"chars": 347,
"preview": "class Solution {\npublic:\n int countLetters(string S) {\n int i = 0;\n int j = 0;\n int ans = 0;\n "
},
{
"path": "cpp/1001-10000/1171-1180/Diet Plan Performance.cpp",
"chars": 532,
"preview": "class Solution {\npublic:\n int dietPlanPerformance(vector<int>& calories, int k, int lower, int upper) {\n int a"
},
{
"path": "cpp/1001-10000/1171-1180/Dinner Plate Stacks.cpp",
"chars": 1462,
"preview": "class DinnerPlates {\n \n vector<stack<int>> v;\n int capacity;\n int bestindex;\n \npublic:\n DinnerPlates(i"
},
{
"path": "cpp/1001-10000/1171-1180/Prime Arrangements.cpp",
"chars": 748,
"preview": "class Solution {\n \n bool isPrime(int k) {\n if (k == 1) return false;\n if (k <= 3) return true;\n "
},
{
"path": "cpp/1001-10000/1171-1180/Remove Zero Sum Consecutive Nodes from Linked List.cpp",
"chars": 1020,
"preview": "/**\n * Definition for singly-linked list.\n * struct ListNode {\n * int val;\n * ListNode *next;\n * ListNode(in"
},
{
"path": "cpp/1001-10000/1181-1190/Before and After Puzzle.cpp",
"chars": 1679,
"preview": "class Solution {\n \n string getfirst(string& s) {\n size_t pos = s.find(' ');\n if (pos == string::npos"
},
{
"path": "cpp/1001-10000/1181-1190/Day of the Week.cpp",
"chars": 527,
"preview": "class Solution {\npublic:\n string dayOfTheWeek(int day, int month, int year) {\n vector<int> t {0, 3, 2, 5, 0, 3"
}
]
// ... and 943 more files (download for full content)
About this extraction
This page contains the full source code of the gzc/leetcode GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 1143 files (1003.6 KB), approximately 313.4k tokens, and a symbol index with 3070 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.