0300 - 0399
Solutions categorised by Problem IDs
300 - Longest Increasing SubsequenceFind the longest increasing subsequence with dynamic programming or binary search over candidate subsequence tails.307 - Range Sum Query - MutableAnswer range-sum queries after point updates by storing partial sums in a segment tree.309 - Best Time to Buy and Sell Stock with CooldownMaximize stock profit by tracking buy and sell decisions across days with a required cooldown after selling.312 - Burst BalloonsMaximize coins from bursting balloons by choosing the last balloon to burst in each interval and caching subproblem results.322 - Coin ChangeFind the fewest coins needed for an amount by combining optimal solutions for smaller amounts.323 - Number of Connected Components in an Undirected GraphCount connected components in an undirected graph by merging the endpoints of each edge with disjoint sets.327 - Count of Range SumCount subarray sums within a given interval by querying earlier prefix sums in an ordered collection.329 - Longest Increasing Path in a MatrixFind the longest increasing path through a matrix with memoized search or topological sorting.332 - Reconstruct ItineraryReconstruct an itinerary using each ticket once by finding an Eulerian path and respecting lexical order.334 - Increasing Triplet SubsequenceDetect an increasing triplet by tracking the smallest viable first and second values during a single scan.338 - Counting BitsCount set bits for every integer from zero through n, reusing counts from previously processed integers.342 - Power of FourDetermine whether a positive integer is a power of four using binary search or properties of its set bits.344 - Reverse StringReverse a character array in place by swapping corresponding entries from opposite ends.345 - Reverse Vowels of a StringReverse only the vowels in a string by moving two pointers inward to find the next pair to swap.346 - Moving Average from Data StreamCompute a moving average over a fixed-size window by queuing recent values and tracking their sum.347 - Top K Frequent ElementsFind the k most frequent array elements by counting occurrences and selecting candidates with a priority queue.349 - Intersection of Two ArraysFind the distinct values shared by two arrays using a lookup table to detect matches.350 - Intersection of Two Arrays IIFind the intersection of two arrays while retaining each shared value up to its smaller occurrence count.355 - Design TwitterDesign a news feed that merges recent posts from followed users with a priority queue.365 - Water and Jug ProblemDetermine which amounts two water jugs can measure using their capacities and greatest common divisor.367 - Valid Perfect SquareTest whether a positive integer is a perfect square by binary searching for an integer root.374 - Guess Number Higher or LowerIdentify a hidden number by using higher-or-lower feedback to halve the remaining search range.377 - Combination Sum IVCount ordered combinations that reach a target by combining the counts for smaller remaining sums.383 - Ransom NoteCheck whether the available magazine letters can spell a ransom note by counting how many copies of each letter are needed.387 - First Unique Character in a StringLocate the first character that occurs once by counting character frequencies and checking the original order.389 - Find the DifferenceIdentify the extra character in a shuffled string using XOR, character counts, or sorting.392 - Is SubsequenceCheck whether one string is a subsequence of another by advancing two pointers through the characters in order.393 - UTF-8 ValidationValidate a UTF-8 byte sequence by checking leading-bit patterns and the required number of continuation bytes.