Decode a given encoded string
Explain tries and their applications
Merge K sorted arrays into a single sorted array
Find all roots of a tree that give minimum height
Generate all valid IP addresses from a given string
Solve Data Structures and Algorithms problems (3 questions)
Answer multiple submatrix sum queries on a 2D matrix efficiently.
Find the sum of minimum elements of all subarrays of a given array.
Generate all valid combinations of parentheses for a given number of pairs.
Generate all combinations of balanced parentheses for a given number of pairs.
Find the minimum speed required to arrive on time given distances and time constraints
Solve advanced Data Structures and Algorithms problems with detailed approach explanation
Given an array, find the frequency of the most frequent element after at most k increments
Given numCourses and a list of prerequisite pairs, determine if it is possible to finish all courses.
Given a binary tree, find the k-th ancestor of a given node. If the ancestor does not exist, return -1.
Given a set of points on a 2D plane, find the maximum slope between any two points and connect those points.
Given a binary tree and a target node, find the time required to burn the entire tree starting from the target node.
Given an array, find indices i < j < k such that A[i] ≤ A[j] ≤ A[k] and the product A[i] * A[j] * A[k] is maximized.
Given an array of integers, determine whether there exists any triplet that can form a triangle (i.e., for some a, b, c: a + b > c).
Given height relations like "A > B" and "B < C" among people, determine whether the relations are sufficient to sort all persons by height
Given an array of integers and a number X, count the number of ordered pairs (i, j) such that concatenating arr[i] and arr[j] results in X.
Given two sequences representing north and south bank cities with positions, find the maximum number of non-crossing bridges that can be built.
Design a data structure to support adding an element, removing an element, finding the minimum frequency element, and finding the maximum frequency element.
Given an array, perform either +k or -k exactly once on each element such that the difference between the maximum and minimum elements after the operations is minimized.
Given costs of m breads and n sauces and a budget B, choose exactly one bread and any number of sauces (each at most once) such that the total cost is as close as possible to B.
There are seats numbered from 1 to N with some occupied and some empty. For each of M queries, allocate a seat to a new person such that the distance to the closest occupied seat is maximized.
Given ratings of N children, distribute candies such that each child gets at least one candy and children with a higher rating than their neighbors get more candies. Find the minimum candies required.