brain

tamnd's digital brain — notes, problems, research

43815 notes

LeetCode 602 - Friend Requests II: Who Has the Most Friends

The problem gives us a database table named RequestAccepted, where each row represents a successfully accepted friend request between two users. Every record contains a requesterid, an accepterid, and the date the request was accepted.

leetcodemediumdatabase
LeetCode 1733 - Minimum Number of People to Teach

This problem models communication in a social network where each user knows one or more languages. Two users can communicate directly if they share at least one common language.

leetcodemediumarrayhash-tablegreedy
LeetCode 1440 - Evaluate Boolean Expression

This problem asks us to evaluate boolean expressions stored in a database table. We are given two tables: Variables, whi

leetcodemediumdatabase
LeetCode 1601 - Maximum Number of Achievable Transfer Requests

The problem asks us to maximize the number of employee transfer requests that can be fulfilled under the constraint that

leetcodehardarraybacktrackingbit-manipulationenumeration
LeetCode 1797 - Design Authentication Manager

The problem asks us to design an authentication system that manages tokens with expiration times. Each token is valid for a fixed timeToLive seconds starting from the moment it is generated or renewed.

leetcodemediumhash-tablelinked-listdesigndoubly-linked-list
LeetCode 2233 - Maximum Product After K Increments

The problem asks us to maximize the product of an array of non-negative integers after performing at most k increment op

leetcodemediumarraygreedyheap-(priority-queue)
LeetCode 909 - Snakes and Ladders

The problem is asking us to simulate a modified game of Snakes and Ladders on an n x n board. The board is labeled from 1 to n² in a boustrophedon pattern, which means the numbering starts from the bottom-left, alternates direction every row, and ends at the top-right.

leetcodemediumarraybreadth-first-searchmatrix
LeetCode 1298 - Maximum Candies You Can Get from Boxes

The problem asks us to determine the maximum number of candies we can collect from a set of boxes with varying accessibi

leetcodehardarraybreadth-first-searchgraph-theory
LeetCode 735 - Asteroid Collision

The problem gives us a list of integers representing asteroids moving through space in a straight line. Each integer contains two pieces of information: - The absolute value represents the asteroid's size. - The sign represents the direction: - Positive numbers move to the right.

leetcodemediumarraystacksimulation
CF 134A - Average Numbers

We are given an array of positive integers. For every position, we remove that element and compute the arithmetic mean of the remaining numbers. We must find all positions where the removed value itself is exactly equal to that mean. Suppose the array is [1, 2, 3, 4, 5].

codeforcescompetitive-programmingbrute-forceimplementation
LeetCode 1346 - Check If N and Its Double Exist

The problem gives an integer array arr and asks whether there exist two different indices i and j such that: In simpler

leetcodeeasyarrayhash-tabletwo-pointersbinary-searchsorting
CF 77D - Domino Carpet

We are tasked with counting the number of ways to cover an n × m grid using standard dominoes of size 1 × 2, where each domino can be placed either vertically or horizontally.

codeforcescompetitive-programmingdpimplementation
CF 123A - Prime Permutation

We are given a string s composed of lowercase letters, with length n. The task is to determine if we can rearrange the letters so that for every prime p less than or equal to n, all positions in the string that are multiples of p can contain the same character.

codeforcescompetitive-programmingimplementationnumber-theorystrings
LeetCode 1720 - Decode XORed Array

The problem gives us an encoded array where each element represents the XOR of two consecutive elements from an unknown original array. Specifically: We are also given the first element of the original array, first = arr[0].

leetcodeeasyarraybit-manipulation
LeetCode 880 - Decoded String at Index

The problem gives us an encoded string s that represents a potentially enormous decoded string. The decoding process works incrementally from left to right. When we encounter a letter, we append it directly to the decoded tape.

leetcodemediumstringstack
CF 56A - Bar

Vasya walks into a bar and sees several customers. For each customer, he only knows one piece of information: either the person’s age or the drink they ordered. He wants to determine how many people must still be checked to guarantee that nobody under 18 is drinking alcohol.

codeforcescompetitive-programmingimplementation
CF 96A - Football

We are given a string made only of '0' and '1'. Each character represents the team of a football player standing in a line. A dangerous situation happens if at least seven consecutive players belong to the same team.

codeforcescompetitive-programmingimplementationstrings
CF 100J - Interval Coloring

We are asked to color a collection of intervals on the number line such that no three intervals with the same color form a "triple overlap pattern.

codeforcescompetitive-programming*specialgreedymath
CF 59A - Word

The task is to normalize the case of a single word so that either all letters are lowercase or all are uppercase.

codeforcescompetitive-programmingimplementationstrings
LeetCode 935 - Knight Dialer

The problem asks us to count how many distinct phone numbers of length n can be generated by moving a chess knight across a numeric keypad. The keypad layout looks like this: A knight moves in an L-shape. From any current digit, it can jump only to specific other digits.

leetcodemediumdynamic-programming
LeetCode 1755 - Closest Subsequence Sum

The problem asks us to find a subsequence of a given integer array nums such that the sum of that subsequence is as close as possible to a given integer goal.

leetcodehardarraytwo-pointersdynamic-programmingbit-manipulationsortingbitmask
LeetCode 346 - Moving Average from Data Stream

The problem asks us to design a data structure that continuously receives integers from a stream and returns the average of the most recent values within a fixed-size sliding window. A sliding window means that we only care about the latest size elements.

leetcodeeasyarraydesignqueuedata-stream
LeetCode 42 - Trapping Rain Water

The problem gives an array called height, where each element represents the height of a vertical bar in an elevation map. Every bar has width 1. After rainfall, water may become trapped between taller bars. The task is to compute the total amount of water that can be trapped.

leetcodehardarraytwo-pointersdynamic-programmingstackmonotonic-stack
LeetCode 1503 - Last Moment Before All Ants Fall Out of a Plank

The problem describes a plank of length n on which ants are walking either to the left or to the right at a constant spe

leetcodemediumarraybrainteasersimulation
LeetCode 468 - Validate IP Address

The problem asks us to determine whether a given string represents a valid IPv4 address, a valid IPv6 address, or neither.

leetcodemediumstring
LeetCode 764 - Largest Plus Sign

This problem asks us to find the largest axis-aligned plus sign made entirely of 1s in an n x n binary grid. Initially, every cell in the grid contains 1. However, some positions are marked as mines, meaning those cells contain 0.

leetcodemediumarraydynamic-programming
LeetCode 558 - Logical OR of Two Binary Grids Represented as Quad-Trees

This problem gives us two Quad-Trees, where each tree represents a binary matrix containing only 0s and 1s. Our goal is to compute the logical bitwise OR of the two matrices and return the result as another Quad-Tree. A Quad-Tree is a recursive spatial data structure.

leetcodemediumdivide-and-conquertree
CF 48F - Snow sellers

We are asked to plan snow purchases over n days from m companies, ensuring we buy exactly W cubic meters each day. Each company produces a fixed daily amount w[i], but the cost of all snow from that company decreases linearly: c[i] on day 1, c[i] - a[i] on day 2, and so on.

codeforcescompetitive-programminggreedysortings
LeetCode 1301 - Number of Paths with Max Score

In this problem, we are given an n x n board where each cell contains one of four possible values: - 'E', the ending position located at the top-left corner - 'S', the starting position located at the bottom-right corner - A digit character '1' through '9', representing points…

leetcodehardarraydynamic-programmingmatrix
LeetCode 1538 - Guess the Majority in a Hidden Array

This problem is an interactive problem. We do not receive the actual binary array directly. Instead, we can only gather information through the ArrayReader API. The hidden array nums contains only 0 and 1.

leetcodemediumarraymathinteractive
LeetCode 539 - Minimum Time Difference

The problem gives a list of time points in 24-hour clock format, where every time is represented as a string in the form "HH:MM". Your task is to determine the smallest difference in minutes between any two time points in the list.

leetcodemediumarraymathstringsorting
LeetCode 1719 - Number Of Ways To Reconstruct A Tree

The problem provides an array of pairs, where each pair [xi, yi] indicates that xi is either an ancestor of yi or yi is an ancestor of xi in a rooted tree. The key challenge is to determine how many different rooted trees satisfy all given pairs.

leetcodehardarrayhash-tabletreegraph-theorysimulation
CF 72F - Oil

We have an n × m grid. Some entire rows are empty, some entire columns are empty, and every empty cell belongs to at least one of those empty rows or empty columns. All remaining cells contain oil.

codeforcescompetitive-programming*specialgreedymath
LeetCode 675 - Cut Off Trees for Golf Event

The problem gives us a two dimensional grid representing a forest. Every cell contains one of three possible values: - 0 means the cell is blocked and cannot be entered. - 1 means the cell is empty and can be walked through.

leetcodehardarraybreadth-first-searchheap-(priority-queue)matrix
CF 120C - Winnie-the-Pooh and honey

We have several jars of honey, and each jar starts with some amount of honey. Winnie repeatedly chooses the jar that currently contains the most honey. When Winnie picks a jar, two things may happen.

codeforcescompetitive-programmingimplementationmath
LeetCode 227 - Basic Calculator II

The problem gives us a string representing a mathematical expression containing non-negative integers, spaces, and the four operators +, -, , and /. Our task is to evaluate the expression and return the resulting integer value.

leetcodemediummathstringstack
LeetCode 114 - Flatten Binary Tree to Linked List

The problem asks us to transform a binary tree into a flattened structure that behaves like a singly linked list. The transformation must happen in-place, meaning we are not supposed to create an entirely new tree or list structure.

leetcodemediumlinked-liststacktreedepth-first-searchbinary-tree
LeetCode 1239 - Maximum Length of a Concatenated String with Unique Characters

This problem asks us to select a subsequence of strings from the input array arr and concatenate them together such that the resulting string contains only unique characters. Among all valid concatenations, we must return the maximum possible length.

leetcodemediumarraystringbacktrackingbit-manipulation
CF 55B - Smallest number

We start with four integers on the board. We also know the exact sequence of three operations that must be applied, where each operation is either addition or multiplication.

codeforcescompetitive-programmingbrute-force
LeetCode 156 - Binary Tree Upside Down

The problem asks us to transform a binary tree into its "upside-down" version. In more precise terms, we are given a binary tree where every right node either has a left sibling or is absent, and no right node has children.

leetcodemediumtreedepth-first-searchbinary-tree
CF 118A - String Task

We receive a single string containing uppercase and lowercase English letters. The task is to transform this string according to three rules. First, every vowel must be removed. The vowels in this problem are A, O, Y, E, U, I in both uppercase and lowercase forms.

codeforcescompetitive-programmingimplementationstrings
LeetCode 314 - Binary Tree Vertical Order Traversal

The problem asks us to group the nodes of a binary tree by their vertical columns and return those groups from left to right.

leetcodemediumhash-tabletreedepth-first-searchbreadth-first-searchsortingbinary-tree
CF 79D - Password

We start with a row of n panels, all turned OFF. The target password is another configuration where exactly k specific positions must be ON and every other position must remain OFF. One operation chooses a segment of consecutive panels whose length belongs to the array a.

codeforcescompetitive-programmingbitmasksdpshortest-paths
LeetCode 1043 - Partition Array for Maximum Sum

The problem gives us an integer array arr and an integer k. We are allowed to partition the array into contiguous subarrays where each subarray has length at most k.

leetcodemediumarraydynamic-programming
LeetCode 1202 - Smallest String With Swaps

The problem gives us a string s and a list of index pairs called pairs. Each pair [a, b] means we are allowed to swap the characters at positions a and b. The important detail is that swaps can be performed any number of times. This changes the nature of the problem completely.

leetcodemediumarrayhash-tablestringdepth-first-searchbreadth-first-searchunion-findsorting
LeetCode 936 - Stamping The Sequence

This problem asks us to reconstruct a target string by repeatedly applying a smaller string called stamp. We begin with a string s that has the same length as target, but every character is initially '?'.

leetcodehardstringstackgreedyqueue
LeetCode 2013 - Detect Squares

The problem presents a stream of points in a 2D plane and asks us to design a data structure that supports two operations efficiently: adding points and counting squares.

leetcodemediumarrayhash-tabledesigncountingdata-stream
LeetCode 810 - Chalkboard XOR Game

This problem describes a two player game played on an array of integers. The numbers are written on a chalkboard, and players take turns erasing exactly one number. Alice moves first, then Bob, and both players play optimally. The key rule is unusual.

leetcodehardarraymathbit-manipulationbrainteasergame-theory
LeetCode 78 - Subsets

This problem asks us to generate every possible subset of a given array of unique integers. A subset is any selection of elements from the array, including the empty subset and the subset containing every element.

leetcodemediumarraybacktrackingbit-manipulation
LeetCode 578 - Get Highest Answer Rate Question

This problem asks us to analyze user interaction data stored in the SurveyLog table and determine which question has the highest answer rate. The table records actions performed by users during survey sessions. Every row represents a single interaction with a question.

leetcodemediumdatabase
CF 53D - Physical Education

We have two arrays representing the order of students in a line. Array a is the desired arrangement, and array b is the current arrangement. In one operation we may swap two neighboring students. We must output any sequence of adjacent swaps that transforms b into a.

codeforcescompetitive-programmingsortings
LeetCode 1687 - Delivering Boxes from Storage to Ports

This problem asks us to minimize the total number of ship trips required to deliver boxes from storage to ports, while r

leetcodehardarraydynamic-programmingsegment-treequeueheap-(priority-queue)prefix-summonotonic-queue
CF 121E - Lucky Array

We have an array whose values are always at most 10000. Two operations must be processed online. The first operation adds a value d to every element inside a segment [l, r].

codeforcescompetitive-programmingdata-structures
LeetCode 1097 - Game Play Analysis V

This problem requires calculating the day one retention metric for a game based on user activity data. The input is an Activity table, where each row represents a login session of a player on a particular day, including the device used and the number of games played.

leetcodeharddatabase
LeetCode 112 - Path Sum

This problem asks us to determine whether a binary tree contains at least one valid root-to-leaf path whose node values add up to a given target sum. A binary tree consists of nodes where each node can have a left child and a right child. Each node also stores an integer value.

leetcodeeasytreedepth-first-searchbreadth-first-searchbinary-tree
LeetCode 467 - Unique Substrings in Wraparound String

The problem defines an infinite cyclic string built from the lowercase English alphabet: This means the sequence continues forever, and after 'z' comes 'a' again. Any substring that follows this cyclic ordering exists somewhere in the infinite wraparound string.

leetcodemediumstringdynamic-programming
LeetCode 1273 - Delete Tree Nodes

The problem provides a tree rooted at node 0, represented in two parallel arrays: parent and value. The parent[i] array

leetcodemediumarraytreedepth-first-searchbreadth-first-search
LeetCode 449 - Serialize and Deserialize BST

The problem asks us to design two operations for a Binary Search Tree, abbreviated as BST: - serialize(root) converts the BST into a string representation. - deserialize(data) reconstructs the exact same BST from that string.

leetcodemediumstringtreedepth-first-searchbreadth-first-searchdesignbinary-search-treebinary-tree
CF 120G - Boom

We are simulating a simplified version of the party game "Boom" with multiple teams and cards. There are n teams, each with two players. Each player has an ability to explain words (a) and an ability to understand words (b).

codeforcescompetitive-programmingimplementation
LeetCode 1232 - Check If It Is a Straight Line

The problem asks us to determine whether a given set of points in a 2D Cartesian plane all lie on a single straight line. The input is a list of integer coordinates, where each coordinate [x, y] represents a point.

leetcodeeasyarraymathgeometry
CF 57D - Journey

We are asked to compute the expected lifespan of a dynamic particle moving on a 2D grid with static obstacles. The grid has n rows and m columns. Static particles occupy certain cells, never sharing a row, column, or diagonally adjacent cell.

codeforcescompetitive-programmingdpmath
CF 38B - Chess

We are given the positions of two chess pieces on a standard 8 × 8 board, one rook and one knight. Their starting positions are guaranteed to be safe, meaning the rook does not attack the knight and the knight does not attack the rook.

codeforcescompetitive-programmingbrute-forceimplementationmath
LeetCode 535 - Encode and Decode TinyURL

The problem asks us to implement a URL shortening service, similar to TinyURL. Given a long URL, our system should generate a short, unique URL that maps back to the original URL. When the short URL is accessed, the system should return the original long URL.

leetcodemediumhash-tablestringdesignhash-function
LeetCode 1093 - Statistics from a Large Sample

This problem asks us to compute several descriptive statistics-minimum, maximum, mean, median, and mode-from a very large sample of integers ranging from 0 to 255.

leetcodemediumarraymathprobability-and-statistics
CF 101A - Homework

We start with a lowercase string and may delete at most k characters from it. The remaining characters must stay in their original order, since deleting characters creates a subsequence.

codeforcescompetitive-programminggreedy
LeetCode 1441 - Build an Array With Stack Operations

The problem gives us a strictly increasing array called target and an integer n. We are also given access to a stream of integers starting from 1 and ending at n. The numbers arrive in order, and once a number is skipped, we cannot go back to it.

leetcodemediumarraystacksimulation
LeetCode 899 - Orderly Queue

This problem gives us a string s and an integer k. We are allowed to repeatedly perform one operation: - Choose one of the first k characters of the string. - Remove that character from its current position. - Append it to the end of the string.

leetcodehardmathstringsorting
LeetCode 835 - Image Overlap

This problem asks us to determine the maximum overlap between two binary square matrices (img1 and img2) when one matrix is translated over the other. Each matrix contains only 0s and 1s, where 1 represents a filled pixel and 0 represents an empty pixel.

leetcodemediumarraymatrix
LeetCode 1470 - Shuffle the Array

The problem gives us an array nums with exactly 2n elements. The structure of the array is guaranteed to follow a very specific pattern: This means the first half of the array contains all the x values, and the second half contains all the y values.

leetcodeeasyarray
LeetCode 1137 - N-th Tribonacci Number

The problem asks us to compute the n-th number in the Tribonacci sequence. The Tribonacci sequence is very similar to the Fibonacci sequence, except that instead of summing the previous two numbers, each value is formed by summing the previous three numbers.

leetcodeeasymathdynamic-programmingmemoization
LeetCode 2308 - Arrange Table by Gender

The problem asks us to rearrange the rows of a Genders table in a specific repeating order while maintaining internal so

leetcodemediumdatabase
LeetCode 1625 - Lexicographically Smallest String After Applying Operations

The problem gives us a numeric string s of even length and two operations that can be performed any number of times in a

leetcodemediumstringdepth-first-searchbreadth-first-searchenumeration
CF 44I - Toys

We are asked to enumerate all ways to split n toys into piles, starting from a single pile containing all toys. The toys are numbered from 1 to n, and the order within a pile or between piles does not matter for uniqueness beyond the actual grouping.

codeforcescompetitive-programmingbrute-forcecombinatorics
LeetCode 1085 - Sum of Digits in the Minimum Number

This problem asks us to examine the smallest number in the input array and determine whether the sum of its digits is odd or even. We are given an integer array nums. The task consists of three clear steps: 1. Find the minimum integer in the array. 2.

leetcodeeasyarraymath
CF 44G - Shooting Gallery

The problem can be restated as simulating bullets flying along the positive _Z_ axis at given coordinates on a 2D shooting plane (_XOY_). Each bullet may hit one of multiple rectangular targets floating at distinct heights along the _Z_ axis.

codeforcescompetitive-programmingdata-structuresimplementation
CF 41E - 3-cycles

We need to build an undirected graph on n cities such that no triangle exists. A triangle means three distinct cities where every pair is directly connected.

codeforcescompetitive-programmingconstructive-algorithmsgraphsgreedy
LeetCode 807 - Max Increase to Keep City Skyline

This problem gives us an n x n grid where each cell represents the height of a building in a city. The city can be viewed from four directions: north, south, east, and west. From these viewpoints, the skyline is determined by the tallest building visible in each row or column.

leetcodemediumarraygreedymatrix
LeetCode 1308 - Running Total for Different Genders

The problem is asking us to compute cumulative scores for each gender across different days in a competition. The input

leetcodemediumdatabase
LeetCode 590 - N-ary Tree Postorder Traversal

This problem asks us to perform a postorder traversal on an n-ary tree. In a binary tree, each node has at most two children. In an n-ary tree, each node can have any number of children. Every node contains a value and a list of child nodes. A postorder traversal means: 1.

leetcodeeasystacktreedepth-first-search
LeetCode 1361 - Validate Binary Tree Nodes

The problem gives us n nodes labeled from 0 to n - 1. For every node i, we are told which node is its left child and which node is its right child through the arrays leftChild and rightChild. If leftChild[i] = x, then node x is the left child of node i.

leetcodemediumtreedepth-first-searchbreadth-first-searchunion-findgraph-theorybinary-tree
LeetCode 147 - Insertion Sort List

The problem asks us to sort a singly linked list using the insertion sort algorithm. Unlike array sorting problems where elements can be accessed directly by index, linked lists require sequential traversal, so insertion operations behave differently and require careful…

leetcodemediumlinked-listsorting
LeetCode 1283 - Find the Smallest Divisor Given a Threshold

The problem asks us to find the smallest positive integer divisor for a given array nums such that when each element of

leetcodemediumarraybinary-search
CF 27B - Tournament

We are asked to reconstruct the missing result of a round-robin tournament. There are _n_ participants, and every participant plays against every other participant exactly once.

codeforcescompetitive-programmingbitmasksbrute-forcedfs-and-similargreedy
CF 61D - Eternal Victory

We are asked to find the minimum distance Shapur must travel to visit all cities at least once. The cities are connected in a tree structure, meaning there are exactly $n-1$ bidirectional roads and a unique path between any two cities.

codeforcescompetitive-programmingdfs-and-similargraphsgreedyshortest-pathstrees
LeetCode 914 - X of a Kind in a Deck of Cards

The problem asks whether it is possible to partition a deck of cards, represented as an integer array deck, into groups such that each group contains exactly x cards, all of which have the same integer value, and x is greater than 1.

leetcodeeasyarrayhash-tablemathcountingnumber-theory
CF 71E - Nuclear Fusion

We are given a set of atoms with known atomic numbers and a target set of atoms we want to produce using fusion. Each fusion operation combines exactly two atoms into one, and the resulting atom’s atomic number is the sum of the two original numbers. We cannot split atoms.

codeforcescompetitive-programmingbitmasksdp
CF 31E - TV Game

We are given a string of 2n digits. The digits are processed strictly from left to right. At every step, either Homer or Marge takes the current leftmost digit and appends it to their own number. By the end, both players must have taken exactly n digits.

codeforcescompetitive-programmingdp
LeetCode 773 - Sliding Puzzle

The Sliding Puzzle problem presents a 2 x 3 board containing five numbered tiles from 1 to 5 and a blank space represented as 0.

leetcodehardarraydynamic-programmingbacktrackingbreadth-first-searchmemoizationmatrix
LeetCode 1805 - Number of Different Integers in a String

The problem requires us to process a string word that contains both lowercase English letters and digits. We are asked to extract all the sequences of digits as integers, ignoring any non-digit characters.

leetcodeeasyhash-tablestring
LeetCode 173 - Binary Search Tree Iterator

It looks like your prompt accidentally concatenated two problems. I will answer the second one, LeetCode 173 - Binary Search Tree Iterator, following your required format.

leetcodemediumstacktreedesignbinary-search-treebinary-treeiterator
LeetCode 1348 - Tweet Counts Per Frequency

The problem is asking us to design a system that tracks tweets by their timestamp and allows querying the number of tweets in specific time intervals, split according to a frequency (minute, hour, or day).

leetcodemediumhash-tablestringbinary-searchdesignsortingordered-set
LeetCode 1645 - Hopper Company Queries II

This problem asks us to calculate, for every month in the year 2020, the percentage of drivers who actually worked durin

leetcodeharddatabase
LeetCode 1429 - First Unique Number

The problem requires designing a data structure that can efficiently maintain and retrieve the first unique integer in a

leetcodemediumarrayhash-tabledesignqueuedata-stream
CF 115A - Party

We are asked to organize a company party such that no group contains both a manager and their subordinate, directly or indirectly. The input describes each employee's immediate manager: a number from 1 to n, or -1 if they have no manager.

codeforcescompetitive-programmingdfs-and-similargraphstrees
LeetCode 1462 - Course Schedule IV

This problem gives us a directed acyclic graph representing course dependencies. Each course is a node, and a prerequisi

leetcodemediumdepth-first-searchbreadth-first-searchgraph-theorytopological-sort
LeetCode 134 - Gas Station

The problem describes a circular route containing n gas stations. At each station i, you can collect gas[i] units of fuel. Traveling from station i to station (i + 1) % n consumes cost[i] units of fuel.

leetcodemediumarraygreedy
LeetCode 1684 - Count the Number of Consistent Strings

This problem asks us to determine how many strings in the words array are consistent with a given set of allowed charact

leetcodeeasyarrayhash-tablestringbit-manipulationcounting
LeetCode 1766 - Tree of Coprimes

This problem gives us a tree with n nodes numbered from 0 to n-1, rooted at node 0. Each node has an associated value from the array nums, and the tree structure is given as a list of edges.

leetcodehardarraymathtreedepth-first-searchnumber-theory
LeetCode 1773 - Count Items Matching a Rule

The problem asks us to determine how many items in a list satisfy a given rule. Each item is represented as a list of three strings: its type, color, and name. The rule is given as two strings: ruleKey and ruleValue.

leetcodeeasyarraystring
LeetCode 674 - Longest Continuous Increasing Subsequence

The problem asks us to find the length of the longest strictly increasing contiguous segment in an array. The key detail is that the subsequence must be continuous, which means the elements must appear next to each other in the original array.

leetcodeeasyarray