brain

tamnd's digital brain — notes, problems, research

42715 notes

LeetCode 1540 - Can Convert String in K Moves

The problem is asking whether it is possible to convert one string s into another string t using at most k moves, follow

leetcodemediumhash-tablestring
LeetCode 214 - Shortest Palindrome

The problem gives a string s and asks us to create the shortest possible palindrome by adding characters only at the beginning of the string. A palindrome is a string that reads the same forward and backward.

leetcodehardstringrolling-hashstring-matchinghash-function
CF 34C - Page Numbers

We are asked to process a user-entered sequence of page numbers for printing. The input is a single string of positive integers separated by commas, such as 1,2,3,1,1,2,6,6,2. Some numbers may repeat, possibly non-consecutively.

codeforcescompetitive-programmingexpression-parsingimplementationsortingsstrings
LeetCode 758 - Bold Words in String

The problem gives us two inputs: an array of strings called words, and a target string s. Every occurrence of every word from words inside s must become bold by surrounding that substring with <b and </b tags.

leetcodemediumarrayhash-tablestringtriestring-matching
LeetCode 1833 - Maximum Ice Cream Bars

This problem asks us to determine the maximum number of ice cream bars a boy can buy with a limited number of coins. The input consists of an array costs, where costs[i] represents the price of the i-th ice cream bar, and an integer coins representing the total coins available.

leetcodemediumarraygreedysortingcounting-sort
LeetCode 1654 - Minimum Jumps to Reach Home

This problem asks us to find the minimum number of jumps required for a bug to move from position 0 to position x on a one dimensional number line. The bug follows several movement rules: - It may jump forward by exactly a units. - It may jump backward by exactly b units.

leetcodemediumarrayhash-tablebreadth-first-search
LeetCode 1474 - Delete N Nodes After M Nodes of a Linked List

This problem gives us the head of a singly linked list and two integers, m and n. We must traverse the linked list while

leetcodeeasylinked-list
LeetCode 422 - Valid Word Square

The problem asks us to determine whether a given list of strings forms a valid word square. A word square is a special arrangement of words such that the kth row and the kth column contain the same sequence of letters for every valid index k.

leetcodeeasyarraymatrix
LeetCode 272 - Closest Binary Search Tree Value II

This problem asks us to find the k values in a Binary Search Tree, or BST, whose values are numerically closest to a given floating point target. A BST has a very important property: - Every value in the left subtree is smaller than the current node.

leetcodehardtwo-pointersstacktreedepth-first-searchbinary-search-treeheap-(priority-queue)binary-tree
LeetCode 28 - Find the Index of the First Occurrence in a String

This problem asks us to locate the first occurrence of one string inside another string. The string we are searching for is called needle, and the larger string we search inside is called haystack.

leetcodeeasytwo-pointersstringstring-matching
CF 60E - Mushroom Gnomes

We are given a line of mushrooms, each with a weight, initially sorted in non-decreasing order. Every minute, new mushrooms grow between every pair of neighboring mushrooms, and the weight of each new mushroom equals the sum of the two neighboring mushrooms.

codeforcescompetitive-programmingmathmatrices
LeetCode 387 - First Unique Character in a String

The problem gives us a string s consisting only of lowercase English letters. We must find the index of the first character that appears exactly once in the entire string. If every character appears more than once, we return -1.

leetcodeeasyhash-tablestringqueuecounting
LeetCode 68 - Text Justification

This problem asks us to simulate how text is formatted in a text editor when using full justification. We are given an array of words and a target line width called maxWidth.

leetcodehardarraystringsimulation
LeetCode 463 - Island Perimeter

The problem asks us to calculate the perimeter of an island represented in a 2D grid. Each cell in the grid is either land (1) or water (0). The island consists of one or more connected land cells, where connectivity is strictly horizontal or vertical.

leetcodeeasyarraydepth-first-searchbreadth-first-searchmatrix
CF 99B - Help Chef Gerasim

We are given a set of cups, each containing some amount of juice, and we want to determine whether the volumes could result from the pages pouring juice from one cup to another exactly once, or not at all.

codeforcescompetitive-programmingimplementationsortings
LeetCode 562 - Longest Line of Consecutive One in Matrix

The problem gives us a binary matrix mat of size m x n, where every cell contains either 0 or 1. We need to find the length of the longest consecutive sequence of 1s that appears in any of four directions: 1. Horizontal, from left to right 2. Vertical, from top to bottom 3.

leetcodemediumarraydynamic-programmingmatrix
LeetCode 1571 - Warehouse Manager

This problem asks us to calculate the total storage volume occupied by products inside each warehouse. We are given two database tables: The Warehouse table tells us which products are stored in each warehouse and how many units of each product exist there.

leetcodeeasydatabase
LeetCode 228 - Summary Ranges

The problem gives us a sorted array of unique integers and asks us to summarize consecutive values into compact range strings. A range represents a continuous sequence of integers.

leetcodeeasyarray
LeetCode 1549 - The Most Recent Orders for Each Product

This problem asks us to find the most recent order for every product that has been ordered at least once. We are given t

leetcodemediumdatabase
CF 94A - Restoring Password

We are given an encrypted password represented as a binary string of length 80. The original password had exactly 8 decimal digits, and each digit was encoded into a block of 10 binary characters.

codeforcescompetitive-programmingimplementationstrings
LeetCode 277 - Find the Celebrity

This problem asks us to identify whether there is a "celebrity" among n people at a party. A celebrity has a very specific property: - Every other person knows the celebrity. - The celebrity knows nobody else. We are not given the entire relationship graph directly.

leetcodemediumtwo-pointersgraph-theoryinteractive
LeetCode 255 - Verify Preorder Sequence in Binary Search Tree

The problem gives an array of unique integers called preorder. This array is supposed to represent the preorder traversal of a binary search tree, and we must determine whether such a BST could actually exist. In a preorder traversal, nodes are visited in this order: 1.

leetcodemediumarraystacktreebinary-search-treerecursionmonotonic-stackbinary-tree
CF 105C - Item World

We have a collection of items, and every item belongs to exactly one of three equipment classes: weapon, armor, or orb. Each item has three base stats, attack, defense, and resistance, plus a capacity telling us how many residents it can hold. Residents also come in three types.

codeforcescompetitive-programmingbrute-forceimplementationsortings
LeetCode 153 - Find Minimum in Rotated Sorted Array

This problem asks us to find the smallest element in a sorted array that has been rotated some number of times. A sorted array in ascending order might originally look like this: After rotation, it could become: or remain unchanged: The important observation is that the array…

leetcodemediumarraybinary-search
CF 119A - Epic Game

We are asked to simulate a turn-based game between two players, Simon and Antisimon, who each have a fixed integer, a and b respectively. There is a heap of n stones.

codeforcescompetitive-programmingimplementation
LeetCode 900 - RLE Iterator

This problem asks us to design an iterator over a run-length encoded sequence instead of storing the full sequence explicitly.

leetcodemediumarraydesigncountingiterator
CF 62B - Tyndex.Brome

The task is to compute a kind of "distance" between a user-entered address and a list of potential addresses, according to a specific error function. The user enters a string s of length k. Then there are n potential addresses, each a string of arbitrary length.

codeforcescompetitive-programmingbinary-searchimplementation
LeetCode 1707 - Maximum XOR With an Element From Array

The problem gives us two inputs: - An integer array nums - A list of queries, where each query is [xi, mi] For every query, we must find the maximum possible value of: subject to the condition: If no number in nums satisfies the condition nums[j] <= mi, then the answer for…

leetcodehardarraybit-manipulationtrie
LeetCode 1736 - Latest Time by Replacing Hidden Digits

The problem presents a string time formatted as hh:mm, where h and m are digits representing hours and minutes, respectively. Some digits may be hidden and are represented by a question mark ?. The goal is to replace the ?

leetcodeeasystringgreedy
CF 75D - Big Maximum Sum

We are given a set of small arrays and a sequence of indexes indicating how to concatenate them into one larger array. Once the large array is built in this way, the goal is to find the maximum sum of a contiguous subarray.

codeforcescompetitive-programmingdata-structuresdpgreedyimplementationmathtrees
LeetCode 1312 - Minimum Insertion Steps to Make a String Palindrome

Edit The problem gives us a string s and asks for the minimum number of insertion operations required to transform the s

leetcodehardstringdynamic-programming
CF 20A - BerOS file system

We are given a filesystem path as a string. In this operating system, multiple consecutive '/' characters are treated exactly the same as a single '/'. That means paths like ///home//user///docs and /home/user/docs refer to the same location.

codeforcescompetitive-programmingimplementation
LeetCode 1248 - Count Number of Nice Subarrays

The problem asks us to count how many contiguous subarrays contain exactly k odd numbers. We are given an integer array

leetcodemediumarrayhash-tablemathsliding-windowprefix-sum
LeetCode 1759 - Count Number of Homogenous Substrings

The problem asks us to count all substrings in a string where every character inside the substring is identical. These are called homogenous substrings. A substring must be contiguous, meaning the characters must appear next to each other in the original string.

leetcodemediummathstring
LeetCode 2027 - Minimum Moves to Convert String

The problem asks us to transform a string s containing only characters 'X' and 'O' so that all characters become 'O'. A move consists of selecting three consecutive characters and converting them to 'O'. If a character is already 'O', it remains unchanged.

leetcodeeasystringgreedy
LeetCode 252 - Meeting Rooms

The problem provides a list of meeting intervals, where each interval is represented as [start, end]. Each pair describes the start time and end time of a meeting. The task is to determine whether a single person can attend every meeting without any scheduling conflicts.

leetcodeeasyarraysorting
LeetCode 132 - Palindrome Partitioning II

The problem asks us to split a string into substrings such that every substring is a palindrome. Among all valid palindrome partitions, we must return the minimum number of cuts required. A cut divides the string into two parts.

leetcodehardstringdynamic-programming
LeetCode 1357 - Apply Discount Every n Orders

The problem describes a supermarket that sells products identified by unique integer IDs. Each product has a corresponding price. Customers purchase products in certain amounts, generating a bill that is the sum of the prices multiplied by the amounts purchased.

leetcodemediumarrayhash-tabledesign
LeetCode 620 - Not Boring Movies

The problem is asking us to query a database table called Cinema and return a filtered set of movies based on two conditions: the movie ID must be odd, and its description must not be "boring". The result must then be sorted in descending order by the movie's rating.

leetcodeeasydatabase
LeetCode 625 - Minimum Factorization

The problem asks us to find the smallest positive integer x such that the product of all of its digits equals the given integer num.

leetcodemediummathgreedy
LeetCode 1397 - Find All Good Strings

The problem asks us to count how many strings of length n satisfy three conditions simultaneously: 1. The string must be lexicographically greater than or equal to s1 2. The string must be lexicographically less than or equal to s2 3.

leetcodehardstringdynamic-programmingstring-matching
LeetCode 923 - 3Sum With Multiplicity

The problem asks us to count how many index triplets (i, j, k) satisfy two conditions: - The indices must follow the order i < j < k - The values at those indices must sum to the given target Formally, we want: The important detail is that we are counting tuples of indices…

leetcodemediumarrayhash-tabletwo-pointerssortingcounting
LeetCode 131 - Palindrome Partitioning

The problem gives us a string s and asks us to divide it into substrings such that every substring is a palindrome. A palindrome is a string that reads the same forward and backward. We must return all possible valid ways to partition the string.

leetcodemediumstringdynamic-programmingbacktracking
LeetCode 1579 - Remove Max Number of Edges to Keep Graph Fully Traversable

The problem presents an undirected graph with n nodes and three types of edges: Type 1 for Alice, Type 2 for Bob, and Ty

leetcodehardunion-findgraph-theory
LeetCode 394 - Decode String

The problem gives us a string that contains encoded patterns of the form k[encodedstring]. The integer k tells us how many times the substring inside the brackets should be repeated. Our task is to fully decode the string and return the expanded result.

leetcodemediumstringstackrecursion
LeetCode 1472 - Design Browser History

The problem is asking us to simulate a single-tab browser with a history mechanism. You start on a homepage, and from there, you can visit new URLs, backtrack a certain number of steps, or forward a certain number of steps.

leetcodemediumarraylinked-liststackdesigndoubly-linked-listdata-stream
CF 50E - Square Equation Roots

We are asked to count all distinct real roots of quadratic equations of the form , where ranges from 1 to and ranges from 1 to . Each pair defines one quadratic. The output is the total number of distinct real roots across all these quadratics.

codeforcescompetitive-programmingmath
LeetCode 777 - Swap Adjacent in LR String

The problem gives us two strings, start and result, both consisting only of the characters 'L', 'R', and 'X'. We are allowed to transform the start string using only two kinds of moves: - Replace "XL" with "LX" - Replace "RX" with "XR" The goal is to determine whether it is…

leetcodemediumtwo-pointersstring
LeetCode 654 - Maximum Binary Tree

The problem asks us to construct a maximum binary tree from a given integer array nums with unique elements. A maximum binary tree is a binary tree where each node is the maximum element of the subarray it represents.

leetcodemediumarraydivide-and-conquerstacktreemonotonic-stackbinary-tree
CF 7D - Palindrome Degree

We are given a string consisting of letters and digits, and we are asked to compute a special measure for every prefix called the _palindrome degree_.

codeforcescompetitive-programminghashingstrings
LeetCode 1775 - Equal Sum Arrays With Minimum Number of Operations

The problem gives us two integer arrays, nums1 and nums2, where every element is between 1 and 6. In one operation, we may choose any element from either array and change it to any value from 1 to 6.

leetcodemediumarrayhash-tablegreedycounting
LeetCode 330 - Patching Array

The problem gives us a sorted array of positive integers, nums, and a target integer n. We are allowed to insert additional numbers into the array, called patches.

leetcodehardarraygreedy
LeetCode 411 - Minimum Unique Word Abbreviation

This problem asks us to generate the shortest possible abbreviation for a given target word such that the abbreviation cannot also represent any word in the dictionary. An abbreviation replaces one or more non-adjacent substrings with their lengths.

leetcodehardarraystringbacktrackingbit-manipulation
LeetCode 1094 - Car Pooling

This problem asks us to determine whether a car can successfully complete a series of passenger trips without ever exceeding its seating capacity.

leetcodemediumarraysortingheap-(priority-queue)simulationprefix-sum
CF 130F - Prime factorization

The task is to decompose a given integer n into its prime factors and print them in non-decreasing order, with each prime repeated according to its multiplicity. Essentially, if a number is a product of primes like $n = 2^2 cdot 3^1 cdot 5^2$, the output should be 2 2 3 5 5.

codeforcescompetitive-programming*special
LeetCode 853 - Car Fleet

The problem describes a set of cars driving toward the same destination, represented by the integer target. Each car starts at a unique position and moves at a constant speed. Cars cannot overtake each other.

leetcodemediumarraystacksortingmonotonic-stack
LeetCode 41 - First Missing Positive

The problem asks us to find the smallest positive integer that does not appear in an unsorted integer array. The key detail is that we only care about positive integers starting from 1.

leetcodehardarrayhash-table
LeetCode 1224 - Maximum Equal Frequency

The problem gives an array nums consisting of positive integers. We must find the longest prefix of the array such that, after removing exactly one element from that prefix, every remaining number appears the same number of times.

leetcodehardarrayhash-table
CF 124A - The number of positions

Petr is standing somewhere in a line containing n people. Positions are numbered from 1 at the front to n at the back. He knows two things about his position. At least a people are standing in front of him, and at most b people are standing behind him.

codeforcescompetitive-programmingmath
CF 43A - Football

We are given the sequence of goals scored during a football match. Every line after the first contains the name of the team that scored one goal. The task is to determine which team scored more goals overall.

codeforcescompetitive-programmingstrings
LeetCode 861 - Score After Flipping Matrix

The problem provides an m x n binary matrix, grid, where each element is either 0 or 1. You are allowed to perform a move, which consists of selecting any row or column and flipping all its values - turning every 0 into a 1 and every 1 into a 0.

leetcodemediumarraygreedybit-manipulationmatrix
LeetCode 813 - Largest Sum of Averages

The problem gives us an integer array nums and an integer k. We are allowed to split the array into at most k contiguous, non-empty subarrays. For each subarray, we compute its average, then sum all of those averages together. Our goal is to maximize that total score.

leetcodemediumarraydynamic-programmingprefix-sum
CF 90B - African Crossword

We are given a small grid of lowercase letters. A cell survives only if its letter is unique both inside its row and inside its column. If the same character appears somewhere else in the same row, that cell is removed.

codeforcescompetitive-programmingimplementationstrings
CF 66D - Petya and His Friends

We need to construct n distinct positive integers with two simultaneous properties. First, every pair of numbers must share a common divisor larger than 1. In other words, for every pair (ai, aj), their gcd cannot equal 1. Second, the gcd of the entire set must equal 1.

codeforcescompetitive-programmingconstructive-algorithmsmathnumber-theory
CF 31B - Sysadmin Bob

We are given a single string that represents multiple email addresses concatenated together with no separators. Each email address has the form A@B, where A and B are non-empty strings consisting of lowercase Latin letters.

codeforcescompetitive-programminggreedyimplementationstrings
LeetCode 583 - Delete Operation for Two Strings

The problem asks us to determine the minimum number of deletion steps required to make two strings identical. We are given two input strings, word1 and word2, and in each step, we can delete exactly one character from either string.

leetcodemediumstringdynamic-programming
LeetCode 907 - Sum of Subarray Minimums

The problem asks us to compute the sum of the minimum value of every possible contiguous subarray of a given array. For an array arr, every contiguous slice of the array is considered a subarray. For each subarray, we determine its minimum element.

leetcodemediumarraydynamic-programmingstackmonotonic-stack
LeetCode 1059 - All Paths from Source Lead to Destination

This problem gives us a directed graph with n nodes labeled from 0 to n - 1. Each directed edge [a, b] means there is a one way path from node a to node b.

leetcodemediumgraph-theorytopological-sort
LeetCode 1382 - Balance a Binary Search Tree

Here is a complete, detailed technical solution guide for LeetCode 1382 - Balance a Binary Search Tree, following all yo

leetcodemediumdivide-and-conquergreedytreedepth-first-searchbinary-search-treebinary-tree
LeetCode 1040 - Moving Stones Until Consecutive II

The problem gives an array stones representing positions of stones on the X-axis, where each position is unique. The goal is to move the endpoint stones-the stones at the smallest and largest positions-so that eventually all stones occupy consecutive positions on the X-axis.

leetcodemediumarraymathsliding-windowsorting
LeetCode 1012 - Numbers With Repeated Digits

The problem asks us to count how many integers in the range [1, n] contain at least one repeated digit. A repeated digit means that some digit appears more than once in the number. For example, 11 has a repeated 1, 100 has repeated 0, and 121 has repeated 1.

leetcodehardmathdynamic-programming
LeetCode 711 - Number of Distinct Islands II

In this problem, we are given a binary matrix where each cell contains either 0 or 1. A value of 1 represents land, while 0 represents water. An island is formed by connecting adjacent land cells in the four cardinal directions: up, down, left, and right.

leetcodehardarrayhash-tabledepth-first-searchbreadth-first-searchunion-findsortingmatrixhash-function
LeetCode 1758 - Minimum Changes To Make Alternating Binary String

The problem gives us a binary string s, which means the string contains only the characters '0' and '1'. In one operation, we are allowed to flip a character, meaning we can change '0' into '1' or '1' into '0'.

leetcodeeasystring
LeetCode 405 - Convert a Number to Hexadecimal

The problem asks us to convert a given 32-bit integer num into its hexadecimal representation as a string. Hexadecimal, or base-16, uses digits 0-9 and letters a-f to represent values 0-15.

leetcodeeasymathstringbit-manipulation
CF 59B - Fortune Telling

Marina can pick any subset of flowers from the field. Each flower has a certain number of petals, and she will pluck all petals from all chosen flowers one by one. The phrases alternate between "Loves" and "Doesn't love", starting from "Loves" on the first petal.

codeforcescompetitive-programmingimplementationnumber-theory
CF 12B - Correct Solution?

Alice gives Bob a decimal number and asks him to rearrange its digits so that the resulting number is as small as possible, while still being a valid decimal number without leading zeroes.

codeforcescompetitive-programmingimplementationsortings
LeetCode 1655 - Distribute Repeating Integers

This problem asks whether we can satisfy a set of customer requests using repeated integers from the array nums. Each customer wants a certain quantity of numbers, given by quantity[i]. The important restriction is that every number given to a single customer must be identical.

leetcodehardarrayhash-tabledynamic-programmingbacktrackingbit-manipulationcountingbitmask
CF 136A - Presents

We are given a party scenario where Petya invited n friends, each of whom gave exactly one gift to another friend. The input lists, for each friend in order, the friend they gave a gift to.

codeforcescompetitive-programmingimplementation
LeetCode 1291 - Sequential Digits

The problem asks us to find all integers within a given range [low, high] whose digits are sequential, meaning that each

leetcodemediumenumeration
LeetCode 457 - Circular Array Loop

This problem asks us to determine whether a circular array contains a valid cycle under a specific movement rule. Each element in the array represents how far we move from the current index.

leetcodemediumarrayhash-tabletwo-pointers
LeetCode 2004 - The Number of Seniors and Juniors to Join the Company

This problem requires determining how many candidates a company can hire as seniors and juniors under a fixed budget of $70000, following a strict priority: hire as many seniors as possible first, then use the remaining budget to hire juniors.

leetcodeharddatabase
LeetCode 1457 - Pseudo-Palindromic Paths in a Binary Tree

This problem asks us to count how many root to leaf paths in a binary tree are "pseudo-palindromic". A palindrome is a s

leetcodemediumbit-manipulationtreedepth-first-searchbreadth-first-searchbinary-tree
LeetCode 499 - The Maze III

This problem extends the mechanics introduced in earlier Maze problems, but adds two important complications. First, we are no longer looking for a simple reachable or unreachable answer. Instead, we must find the shortest path by travel distance.

leetcodehardarraystringdepth-first-searchbreadth-first-searchgraph-theoryheap-(priority-queue)matrixshortest-path
LeetCode 998 - Maximum Binary Tree II

A maximum tree is a special binary tree where every node contains a value greater than all values inside its subtree.

leetcodemediumtreebinary-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 792 - Number of Matching Subsequences

The problem asks us to count how many words in a given list are subsequences of a string s. A subsequence is formed by deleting zero or more characters from the string without changing the order of the remaining characters.

leetcodemediumarrayhash-tablestringbinary-searchdynamic-programmingtriesorting
LeetCode 512 - Game Play Analysis II

The problem provides a database table named Activity. Each row represents one login session for a player on a specific date.

leetcodeeasydatabase
LeetCode 1398 - Customers Who Bought Products A and B but Not C

The problem asks us to identify customers who meet a very specific purchasing pattern. We are given two tables: Customer

leetcodemediumdatabase
CF 52C - Circular RMQ

We have an array arranged in a circle. Every operation works on a segment between two indices, but the segment may wrap around the end of the array.

codeforcescompetitive-programmingdata-structures
CF 51F - Caterpillar

We start with an undirected graph that may be disconnected and may contain cycles. We are allowed to repeatedly merge two vertices into one. Merging decreases the number of vertices by one, while the number of edges stays unchanged.

codeforcescompetitive-programmingdfs-and-similardpgraphstrees
CF 101C - Vectors

We start with a vector A = (x1, y1) and want to transform it into another vector B = (x2, y2). Two operations are allowed. We may rotate the current vector by 90 degrees clockwise, and we may add vector C = (x3, y3) any number of times. The operations may be mixed in any order.

codeforcescompetitive-programmingimplementationmath
LeetCode 1711 - Count Good Meals

The problem asks us to count the number of good meals that can be formed from a given list of food items. A good meal is defined as a pair of two different items whose combined deliciousness is a power of two.

leetcodemediumarrayhash-table
LeetCode 1789 - Primary Department for Each Employee

The problem provides a database table named Employee that stores information about which departments employees belong to.

leetcodeeasydatabase
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
CF 130G - CAPS LOCK ON

We are given a single string containing printable ASCII characters. Some characters may be lowercase English letters, some may already be uppercase letters, and others may be symbols or digits.

codeforcescompetitive-programming*special
LeetCode 303 - Range Sum Query - Immutable

The problem asks us to design a data structure that supports efficient range sum queries on a fixed array. We are given an integer array nums, and after initialization, the array never changes.

leetcodeeasyarraydesignprefix-sum
LeetCode 327 - Count of Range Sum

This problem asks us to count how many subarrays have sums that fall within a given inclusive range [lower, upper]. A range sum S(i, j) represents the sum of all elements from index i through index j in the array.

leetcodehardarraybinary-searchdivide-and-conquerbinary-indexed-treesegment-treemerge-sortordered-set
LeetCode 566 - Reshape the Matrix

The problem is asking us to take an existing m x n matrix and "reshape" it into a new matrix with r rows and c columns. Reshaping means rearranging the elements in the matrix in row-major order (left-to-right, top-to-bottom) without changing the order of the elements themselves.

leetcodeeasyarraymatrixsimulation
LeetCode 1841 - League Statistics

This problem asks us to compute a complete league table from two database tables, Teams and Matches. The Teams table contains the identity of each team in the league. Each row represents one team and includes a unique teamid and the corresponding teamname.

leetcodemediumdatabase
LeetCode 1631 - Path With Minimum Effort

The problem gives us a grid called heights, where each cell contains an integer representing elevation. We start at the top-left corner (0, 0) and want to reach the bottom-right corner (rows - 1, columns - 1).

leetcodemediumarraybinary-searchdepth-first-searchbreadth-first-searchunion-findheap-(priority-queue)matrix