0200 - 0299
Solutions categorised by Problem IDs
200 - Number of IslandsCount islands by flood-filling each connected group of land cells when it is first encountered.202 - Happy NumberDetect whether repeated sums of squared digits reach one or enter a cycle using fast and slow iteration.204 - Count PrimesCount primes below a limit with the Sieve of Eratosthenes by crossing out multiples of each prime.205 - Isomorphic StringsTest whether one string can map to another with a consistent one-to-one correspondence between their characters.206 - Reverse Linked ListReverse a linked list by changing the direction of its links iteratively or recursively.207 - Course ScheduleUse topological sorting on course prerequisites to decide whether all courses can be completed.208 - Implement Trie (Prefix Tree)Implement a prefix tree that supports inserting words, searching for whole words, and checking prefixes.210 - Course Schedule IIConstruct a valid course order by topologically sorting the prerequisite graph.211 - Design Add and Search Words Data StructureSupport word insertion and wildcard searches by branching through a trie whenever a dot can match multiple letters.212 - Word Search IIFind dictionary words in a grid by searching neighboring cells and pruning paths with a prefix tree.213 - House Robber IIMaximize robbery proceeds on a circular street by handling the cases that exclude the first or last house.214 - Shortest PalindromeFind the shortest palindrome obtainable by prepending characters using the Z algorithm to locate a palindromic prefix.215 - Kth Largest Element in an ArrayFind the kth largest array element using a priority queue or quickselect partitioning.217 - Contains DuplicateDetect a repeated array value by tracking previously seen values or checking neighbors after sorting.219 - Contains Duplicate IIFind equal values whose indices differ by at most k by maintaining a sliding window of recent elements.225 - Implement Stack using QueuesImplement last-in-first-out stack operations with queues by arranging elements so the newest value can be removed first.226 - Invert Binary TreeInvert a binary tree by swapping every node's left and right subtrees with depth-first or breadth-first traversal.228 - Summary RangesSummarize a sorted array as ranges by scanning each maximal run of consecutive integers.230 - Kth Smallest Element in a BSTFind the kth smallest key in a binary search tree by visiting nodes in sorted order with inorder traversal.231 - Power of TwoTest whether an integer is a power of two by checking that it is positive and contains exactly one set bit.234 - Palindrome Linked ListCheck a linked list for palindrome symmetry using a stack or by finding the midpoint and comparing its halves.235 - Lowest Common Ancestor of a Binary Search TreeFind the lowest common ancestor in a binary search tree by following key comparisons until the search paths split.237 - Delete Node in a Linked ListDelete a linked-list node given only that node by copying its successor's value and bypassing the successor.238 - Product of Array Except SelfCompute the product of all other elements at each index by combining products to its left and right.239 - Sliding Window MaximumTrack the largest value in every sliding window with a monotonic queue of candidate indices.242 - Valid AnagramDetermine whether two strings are anagrams by comparing character counts or sorting their letters.246 - Strobogrammatic NumberCheck whether a number still reads the same after a half-turn by matching rotatable digit pairs from opposite ends.258 - Add DigitsReduce an integer to one digit by summing its digits repeatedly or applying the digital root formula.261 - Graph Valid TreeCheck whether an undirected graph forms a tree by tracking connected components with disjoint sets.263 - Ugly NumberTest whether a number is ugly by dividing out factors of two, three, and five and checking what remains.268 - Missing NumberFind the missing value from zero through n using sorting, XOR cancellation, or the expected arithmetic sum.278 - First Bad VersionLocate the earliest bad version with binary search over the transition from good to bad releases.283 - Move ZeroesMove zeroes to the end in place while keeping the relative order of nonzero elements with two pointers.286 - Walls and GatesFill each empty room with its distance to the nearest gate by starting breadth-first search from every gate at once.287 - Find the Duplicate NumberFind the repeated number by treating array values as links and detecting a cycle with slow and fast pointers.290 - Word PatternCheck whether words follow a pattern by enforcing a one-to-one mapping between words and pattern characters.295 - Find Median from Data StreamMaintain a running median with two heaps that balance the lower and upper halves of a data stream.297 - Serialize and Deserialize Binary TreeSerialize and reconstruct a binary tree in breadth-first order while retaining the positions of missing children.298 - Binary Tree Longest Consecutive SequenceFind the longest downward run of consecutive node values by carrying its length through a depth-first traversal.299 - Bulls and CowsCount bulls from exact digit matches and cows from the frequencies of the remaining unmatched digits.