Skip to Content
LeetCode The Hard Way

0100 - 0199

Solutions categorised by Problem IDs

100 - Same TreeCheck whether two binary trees have identical structure and values by visiting corresponding nodes together.101 - Symmetric TreeTest whether a binary tree is symmetric by comparing mirrored pairs of nodes recursively or iteratively.102 - Binary Tree Level Order TraversalTraverse a binary tree one level at a time with a queue and collect the values from each level.103 - Binary Tree Zigzag Level Order TraversalTraverse a binary tree by level while alternating the order in which each level's values are returned.104 - Maximum Depth of Binary TreeMeasure the maximum depth of a binary tree using recursive or iterative search from the root to its deepest leaf.105 - Construct Binary Tree from Preorder and Inorder TraversalRebuild a binary tree by taking roots from preorder traversal and splitting their subtrees with inorder traversal.110 - Balanced Binary TreeCheck whether a binary tree is height-balanced by comparing the heights of the two subtrees at each node.112 - Path SumSearch root-to-leaf paths for a target sum, carrying the remaining amount down the tree.113 - Path Sum IIFind all root-to-leaf paths with a given sum by recording the current path and backtracking between branches.115 - Distinct SubsequencesCount the subsequences that form a target string by combining the choices to use or skip each source character.118 - Pascal's TriangleBuild Pascal's triangle row by row, adding neighboring entries from the previous row to obtain each interior value.121 - Best Time to Buy and Sell StockFind the best profit from one stock trade by tracking the lowest price seen before each possible sale.124 - Binary Tree Maximum Path SumFind the maximum path sum in a binary tree by combining the gains from the left and right branches at each node.125 - Valid PalindromeCheck a string for a palindrome with two pointers that skip non-alphanumeric characters and ignore letter case.127 - Word LadderFind the shortest word transformation sequence with breadth-first search over valid one-letter changes.129 - Sum Root to Leaf NumbersSum the numbers represented by root-to-leaf paths by appending each node's digit as the traversal descends.130 - Surrounded RegionsIdentify open cells connected to the board's edge with graph search, then capture the enclosed regions.131 - Palindrome PartitioningPartition a string into palindromes by trying palindromic prefixes and backtracking through the remaining suffix.133 - Clone GraphClone a graph by mapping each visited node to its copy and recreating neighbor links during traversal.134 - Gas StationFind a starting gas station for a complete circuit by tracking fuel gained and spent along the circular route.136 - Single NumberFind the only unpaired number by XORing the array values so that equal pairs cancel out.138 - Copy List with Random PointerCopy a linked list with random pointers while preserving the correspondence between original nodes and their copies.139 - Word BreakDecide whether a string can be split into dictionary words by tracking which prefixes admit a valid segmentation.141 - Linked List CycleDetect a linked-list cycle with two pointers that move at different speeds and meet if a cycle exists.143 - Reorder ListReorder a linked list by finding its middle, reversing the second half, and alternating nodes from the two halves.144 - Binary Tree Preorder TraversalVisit a binary tree in root-left-right order using recursive preorder traversal or an explicit stack.145 - Binary Tree Postorder TraversalVisit the children before their parent in a binary tree using recursive or iterative postorder traversal.146 - LRU CacheImplement an LRU cache with a doubly linked list to update access order and evict the least recently used entry.148 - Sort ListSort a linked list by splitting it into halves, recursively sorting them, and merging the sorted lists.150 - Evaluate Reverse Polish NotationEvaluate a reverse Polish expression by stacking operands and applying each operator to the two most recent values.152 - Maximum Product SubarrayFind the maximum product subarray by tracking both extrema, since multiplying by a negative number can reverse their roles.154 - Find Minimum in Rotated Sorted Array IIFind the minimum in a rotated sorted array with binary search that handles ambiguous comparisons caused by duplicates.155 - Min StackDesign a stack that supports minimum queries by retaining the current minimum alongside ordinary stack operations.162 - Find Peak ElementLocate a peak by binary searching in the direction of a rising neighbor.165 - Compare Version NumbersCompare version numbers one numeric revision at a time, treating missing revisions as zero.169 - Majority ElementFind the majority element by canceling competing values with the Boyer-Moore voting algorithm.182 - Duplicate EmailsFind repeated email addresses by grouping records by email and filtering groups with more than one entry.188 - Best Time to Buy and Sell Stock IVMaximize stock-trading profit with at most k transactions by tracking the best outcomes across days and transaction counts.191 - Number of 1 BitsCount the set bits of an integer by repeatedly clearing its lowest set bit.198 - House RobberMaximize the amount robbed from nonadjacent houses by comparing the gains from robbing or skipping each house.199 - Binary Tree Right Side ViewFind the visible node on each level from the right side of a binary tree using depth-first or breadth-first traversal.