brain

tamnd's digital brain — notes, problems, research

43815 notes

CF 303E - Random Ranking

Each participant receives a real-valued score chosen uniformly from an interval $[li, ri]$. Scores are independent. After all scores are generated, participants are sorted by score. Smaller score means better rank, so the participant with the largest score finishes last.

codeforcescompetitive-programmingdpmathprobabilities
LeetCode 2347 - Best Poker Hand

The problem gives us exactly five playing cards. Each card is represented by two pieces of information: - ranks[i] represents the numerical rank of the card, from 1 to 13 - suits[i] represents the suit of the card, using characters from 'a' to 'd' We need to determine the…

leetcodeeasyarrayhash-tablecounting
CF 262A - Roma and Lucky Numbers

Roma has a collection of positive integers, and he is fascinated with numbers whose decimal digits consist only of 4 and 7. These are called lucky numbers. The task is to determine, from his collection, how many numbers have at most k lucky digits.

codeforcescompetitive-programmingimplementation
LeetCode 2587 - Rearrange Array to Maximize Prefix Score

The problem gives us a 0-indexed array of integers, nums, which can include negative numbers, zero, and positive numbers. We are allowed to reorder the elements in any way we choose.

leetcodemediumarraygreedysortingprefix-sum
CF 182E - Wooden Fence

We are asked to count the number of ways to build a fence of exact length l using boards of n types, where each type is a rectangle of dimensions ai by bi.

codeforcescompetitive-programmingdp
LeetCode 2577 - Minimum Time to Visit a Cell In a Grid

That is a long, multi-section technical guide. To make sure I target the correct problem and avoid producing the wrong reference document, can you confirm the exact LeetCode problem number/title? You mentioned LeetCode 2577 - Minimum Time to Visit a Cell In a Grid.

leetcodehardarraybreadth-first-searchgraph-theoryheap-(priority-queue)matrixshortest-path
LeetCode 2219 - Maximum Sum Score of Array

The problem gives us a 0-indexed integer array nums of length n and asks us to compute the maximum sum score among all indices of the array.

leetcodemediumarrayprefix-sum
CF 189A - Cut Ribbon

We have a ribbon of total length n. Every cut piece must have one of exactly three allowed lengths: a, b, or c. The goal is not just to split the ribbon successfully, but to maximize how many total pieces we obtain.

codeforcescompetitive-programmingbrute-forcedp
LeetCode 1856 - Maximum Subarray Min-Product

The problem asks us to find the maximum min-product of any contiguous subarray of a given integer array nums. The min-product of a subarray is defined as the minimum value in that subarray multiplied by the sum of all elements in that subarray.

leetcodemediumarraystackmonotonic-stackprefix-sum
LeetCode 3138 - Minimum Length of Anagram Concatenation

The problem gives us a string s that was formed by concatenating several strings together, where every piece is an anagram of the same unknown string t. Our task is to determine the minimum possible length of t.

leetcodemediumhash-tablestringcounting
LeetCode 3251 - Find the Count of Monotonic Pairs II

The problem asks us to count the number of ways we can split an array of positive integers, nums, into two arrays, arr1 and arr2, such that they satisfy a set of monotonic conditions.

leetcodehardarraymathdynamic-programmingcombinatoricsprefix-sum
LeetCode 2671 - Frequency Tracker

The problem asks us to design a data structure, FrequencyTracker, that can efficiently track the frequency of numbers and answer queries about whether any number exists with a specific frequency.

leetcodemediumhash-tabledesign
LeetCode 2175 - The Change in Global Rankings

This problem asks us to determine how the global rankings of national teams change after their points are updated. We are given two database tables: The TeamPoints table contains the current ranking information for each team.

leetcodemediumdatabase
CF 160E - Buses and People

Each bus is active at exactly one moment in time. A bus starting at stop s and ending at stop f can carry any passenger whose trip interval [l, r] is fully contained inside [s, f]. A person arrives at stop l at time b, so they can only use buses whose time t satisfies t = b.

codeforcescompetitive-programmingbinary-searchdata-structuressortings
LeetCode 2345 - Finding the Number of Visible Mountains

Each mountain is represented by a peak point (x, y). Because the mountain is a right-angled isosceles triangle with slopes +1 and -1, its shape is completely determined by its peak.

leetcodemediumarraystacksortingmonotonic-stack
LeetCode 3285 - Find Indices of Stable Mountains

The problem asks us to find indices of "stable" mountains from a given array of mountain heights. Each element in the array represents the height of a mountain in sequence.

leetcodeeasyarray
LeetCode 3103 - Find Trending Hashtags II

The problem gives us a database table named Tweets, where each row represents a tweet posted during February 2024. Every tweet contains plain text in the tweet column, and that text may contain one or more hashtags.

leetcodeharddatabase
LeetCode 3263 - Convert Doubly Linked List to Array I

The problem asks us to convert a doubly linked list into a standard integer array while preserving the order of elements. In a doubly linked list, each node contains a value (val) and two pointers: next (pointing to the next node) and prev (pointing to the previous node).

leetcodeeasyarraylinked-listdoubly-linked-list
LeetCode 2355 - Maximum Number of Books You Can Take

That is a long, multi-section technical reference document. I can provide the full guide, but it will be quite extensive.

leetcodehardarraydynamic-programmingstackmonotonic-stack
LeetCode 2132 - Stamping the Grid

In this problem, we are given a binary matrix called grid. Every cell contains either: - 0, meaning the cell is empty - 1, meaning the cell is blocked or occupied We are also given a rectangular stamp with dimensions: - stampHeight - stampWidth The goal is to determine whether…

leetcodehardarraygreedymatrixprefix-sum
LeetCode 2214 - Minimum Health to Beat Game

The problem presents a sequential game consisting of n levels, where each level inflicts a specific amount of damage to the player. You are given a list damage where damage[i] represents the damage from level i.

leetcodemediumarraygreedy
CF 203D - Hit Ball

We are asked to simulate a three-dimensional billiard-like scenario where a ball travels inside a rectangular corridor with perfectly reflecting walls, floor, and ceiling.

codeforcescompetitive-programminggeometryimplementationmath
CF 418D - Big Problems for Organizers

The task gives a tree of hotels, where every road connects two hotels and moving along a road costs one unit of time. For each query, two hotels are chosen as main event locations.

codeforcescompetitive-programmingdata-structuresgraphstrees
LeetCode 2436 - Minimum Split Into Subarrays With GCD Greater Than One

The problem requires splitting a given array of positive integers into contiguous subarrays such that the greatest common divisor (GCD) of each subarray is strictly greater than 1. The goal is to minimize the number of subarrays after splitting.

leetcodemediumarraymathdynamic-programminggreedynumber-theory
LeetCode 2705 - Compact Object

The problem asks us to compact a JSON-like object or array by removing all falsy values. Falsy values are those that evaluate to false in a Boolean context, such as null, 0, false, "", undefined (though JSON does not have undefined), and NaN.

leetcodemedium
LeetCode 2384 - Largest Palindromic Number

The problem asks us to form the largest palindromic integer using the digits from a given string num. A palindrome is a number that reads the same forwards and backwards, like 121 or 7449447. The input string num consists only of digits (0 to 9) and may include repeated digits.

leetcodemediumhash-tablestringgreedycounting
LeetCode 2770 - Maximum Number of Jumps to Reach the Last Index

The problem asks us to determine the maximum number of jumps one can make from the first element of an array nums to the last element, subject to a jumping constraint.

leetcodemediumarraydynamic-programming
LeetCode 3382 - Maximum Area Rectangle With Point Constraints II

The problem asks us to find the maximum area rectangle that can be formed from a given set of points on a 2D plane, under strict constraints.

leetcodehardarraymathbinary-indexed-treesegment-treegeometrysorting
LeetCode 1999 - Smallest Greater Multiple Made of Two Digits

The problem asks us to find the smallest integer that satisfies three specific conditions. Given an integer k and two digits digit1 and digit2, we need an integer that is strictly larger than k, is a multiple of k, and consists only of the two given digits.

leetcodemediummathenumeration
CF 215C - Crosses

Each cross is defined by two axis-aligned rectangles centered at the same cell (x0, y0). The first rectangle extends a cells vertically and b cells horizontally from the center, so its size is: $(2a+1)(2b+1)$ The second rectangle is defined similarly using c and d.

codeforcescompetitive-programmingbrute-forceimplementation
LeetCode 2148 - Count Elements With Strictly Smaller and Greater Elements

The problem gives us an integer array nums and asks us to count how many elements satisfy a very specific condition.

leetcodeeasyarraysortingcounting
LeetCode 2825 - Make String a Subsequence Using Cyclic Increments

The problem gives us two lowercase strings, str1 and str2. We are allowed to perform at most one global operation on str1. During this operation, we may choose any subset of indices in str1, and increment the character at each chosen index by one alphabetically.

leetcodemediumtwo-pointersstring
CF 263D - Cycle in Graph

We are given an undirected graph where every vertex has a very strong local condition: each node is connected to at least $k$ other distinct nodes. From this structure we are asked to extract a simple cycle whose length is not just positive, but at least $k+1$.

codeforcescompetitive-programmingdfs-and-similargraphs
LeetCode 2358 - Maximum Number of Groups Entering a Competition

The problem asks us to partition a list of student grades into multiple ordered groups under two strict conditions. First, the total sum of grades in the i-th group must be less than that of the (i+1)-th group.

leetcodemediumarraymathbinary-searchgreedy
LeetCode 2421 - Number of Good Paths

The problem is asking us to count the number of good paths in a tree. A tree is a connected acyclic graph with n nodes and n - 1 edges. Each node has an integer value assigned by the array vals.

leetcodehardarrayhash-tabletreeunion-findgraph-theorysorting
LeetCode 2971 - Find Polygon With the Largest Perimeter

The problem gives us an array nums containing positive integers. Each integer represents a potential side length that we may use when constructing a polygon. A polygon must have at least three sides.

leetcodemediumarraygreedysortingprefix-sum
LeetCode 2080 - Range Frequency Queries

The problem asks us to design a data structure that can efficiently answer frequency queries on subarrays. We are given an integer array arr, and we need to support repeated queries of the form: - Given left, right, and value - Return how many times value appears in the…

leetcodemediumarrayhash-tablebinary-searchdesignsegment-tree
LeetCode 2380 - Time Needed to Rearrange a Binary String

This problem asks us to repeatedly transform a binary string according to a very specific rule. During each second, every occurrence of the substring "01" is replaced simultaneously with "10". The important detail is that all replacements happen at the same time.

leetcodemediumstringdynamic-programmingsimulation
LeetCode 2966 - Divide Array Into Arrays With Max Difference

The problem asks us to divide an integer array nums of size n (where n is guaranteed to be a multiple of 3) into smaller arrays of exactly size 3, such that within each array, the difference between the largest and smallest element does not exceed a given integer k.

leetcodemediumarraygreedysorting
LeetCode 2623 - Memoize

This problem asks us to create a memoized version of a function. Memoization is a technique where you store the results of expensive function calls and return the cached result when the same inputs occur again.

leetcodemedium
LeetCode 2072 - The Winner University

The problem gives us two database tables, NewYork and California. Each table contains the exam scores of students from a university. Every row represents a single student, identified by a unique studentid, along with their score. The competition rule is straightforward.

leetcodeeasydatabase
LeetCode 3231 - Minimum Number of Increasing Subsequence to Be Removed

We are given an integer array nums. In one operation, we may choose any subsequence of the array that is strictly increasing and remove all of its elements simultaneously. A subsequence does not need to be contiguous. We only need to preserve the relative order of elements.

leetcodehardarraybinary-search
LeetCode 3006 - Find Beautiful Indices in the Given Array I

The problem gives us a string s and two smaller strings, a and b. We need to find every index i where substring a appears in s, but only if there exists at least one occurrence of substring b close enough to it. More formally, an index i is considered beautiful when: 1.

leetcodemediumtwo-pointersstringbinary-searchrolling-hashstring-matchinghash-function
CF 162G - Non-decimal sum

We are given several integers written in an arbitrary base between 2 and 36. Digits above 9 are represented with uppercase letters, so in base 16 the digit sequence continues as A, B, C, D, E, F, and in larger bases it may continue up to Z.

codeforcescompetitive-programming*special
LeetCode 3102 - Minimize Manhattan Distances

The problem asks us to minimize the maximum Manhattan distance between any two points on a 2D plane after removing exactly one point from the input list. The input points is an array of integer coordinates [[x1, y1], [x2, y2], ..., [xn, yn]].

leetcodehardarraymathgeometrysortingordered-set
LeetCode 2612 - Minimum Reverse Operations

This will be a very large, multi-thousand-word technical guide because of the required depth, full proofs, worked examples, Python and Go implementations, detailed walkthroughs, complexity reasoning, and exhaustive tests.

leetcodehardarrayhash-tablebreadth-first-searchunion-findordered-set
LeetCode 2271 - Maximum White Tiles Covered by a Carpet

That is a long-form reference guide request. To avoid truncation and keep the formatting exact, I will provide the complete solution guide for LeetCode 2271 in a single structured response.

leetcodemediumarraybinary-searchgreedysliding-windowsortingprefix-sum
CF 261A - Maxim and Discounts

We are given a list of item prices and a collection of discount types. Each discount type describes how many items must be placed in a “paid group”.

codeforcescompetitive-programminggreedysortings
CF 338D - GCD Table

We are asked to determine whether a given sequence of numbers appears as consecutive elements in some row of a hypothetical GCD table. The table has n rows and m columns, where each element at row i and column j is the greatest common divisor of i and j.

codeforcescompetitive-programmingchinese-remainder-theoremmathnumber-theory
LeetCode 2541 - Minimum Operations to Make Array Equal II

LeetCode 2541: Minimum Operations to Make Array Equal II (Medium)

leetcodemediumarraymathgreedy
LeetCode 2000 - Reverse Prefix of Word

The problem gives us a string word and a character ch. We must locate the first occurrence of ch inside the string. Once we find it, we reverse the substring starting at index 0 and ending at that occurrence, inclusive.

leetcodeeasytwo-pointersstringstack
LeetCode 3373 - Maximize the Number of Target Nodes After Connecting Trees II

The problem gives us two separate undirected trees. The first tree contains n nodes and the second tree contains m nodes. A tree is an acyclic connected graph, so every pair of nodes has exactly one simple path between them.

leetcodehardtreedepth-first-searchbreadth-first-search
CF 148D - Bag of mice

We have a bag containing white and black mice. The princess moves first, then the dragon, then the princess again, and so on. Whoever draws a white mouse immediately wins. If someone draws a black mouse, the game continues. There is one extra rule during the dragon’s turn.

codeforcescompetitive-programmingdpgamesmathprobabilities
LeetCode 1926 - Nearest Exit from Entrance in Maze

The problem gives us a rectangular maze represented by a 2D grid. Each cell contains either: - '.', meaning the cell is empty and can be walked on - '+', meaning the cell is a wall and cannot be crossed We are also given the coordinates of an entrance cell.

leetcodemediumarraybreadth-first-searchmatrix
LeetCode 2970 - Count the Number of Incremovable Subarrays I

The problem asks us to count all subarrays of a given array nums such that if we remove the subarray, the remaining array becomes strictly increasing. A strictly increasing array is one where each element is less than the next element.

leetcodeeasyarraytwo-pointersbinary-searchenumeration
LeetCode 3262 - Find Overlapping Shifts

The problem requires counting overlapping shifts for each employee from a database table called EmployeeShifts. Each row in this table represents a single shift worked by an employee, with a starttime and an endtime.

leetcodemediumdatabase
LeetCode 2306 - Naming a Company

The problem gives us a list of unique strings called ideas. We must repeatedly choose two different strings, swap their first characters, and determine whether the newly formed strings are both absent from the original list.

leetcodehardarrayhash-tablestringbit-manipulationenumeration
CF 242A - Heads or Tails

We know how many times each player flipped a coin. Vasya flipped x times and Petya flipped y times. Every head gives one point, every tail gives nothing. Valera does not remember the exact final scores, but he remembers three facts.

codeforcescompetitive-programmingbrute-forceimplementation
CF 199A - Hexadecimal's theorem

We are given a single integer n, and the statement guarantees that n itself is a Fibonacci number. The task is to represent n as the sum of three Fibonacci numbers.

codeforcescompetitive-programmingbrute-forceconstructive-algorithmsimplementationnumber-theory
LeetCode 2975 - Maximum Square Area by Removing Fences From a Field

The field is represented as a large rectangle whose outer boundaries are fixed fences. Inside the field, additional horizontal and vertical fences divide the area into smaller sections.

leetcodemediumarrayhash-tableenumeration
LeetCode 3249 - Count the Number of Good Nodes

We are given an undirected tree with n nodes labeled from 0 to n - 1. The tree is rooted at node 0, which means every node except the root has exactly one parent, and each node may have zero or more children. The task is to count how many nodes are considered "good".

leetcodemediumtreedepth-first-search
LeetCode 1980 - Find Unique Binary String

The problem is asking us to find a binary string of length n that does not exist in a given list nums of unique binary strings, where each string in nums also has length n.

leetcodemediumarrayhash-tablestringbacktracking
CF 218B - Airport

The airport has multiple planes, each with a certain number of empty seats. Every passenger in a queue can choose any plane to buy a ticket from, and the cost of the ticket equals the number of currently empty seats in that plane at the time of purchase.

codeforcescompetitive-programmingimplementation
LeetCode 1964 - Find the Longest Valid Obstacle Course at Each Position

The problem gives an array obstacles, where each value represents the height of an obstacle. For every position i, we must determine the length of the longest valid obstacle course that ends exactly at index i.

leetcodehardarraybinary-searchbinary-indexed-tree
LeetCode 2130 - Maximum Twin Sum of a Linked List

The problem gives us a singly linked list with an even number of nodes. For every node at index i, there is a corresponding twin node at index n - 1 - i, where n is the total number of nodes in the list. We define the twin sum as: - node[i].val + node[n - 1 - i].

leetcodemediumlinked-listtwo-pointersstack
LeetCode 3180 - Maximum Total Reward Using Operations I

The problem asks us to maximize a running total reward by selecting elements from an integer array rewardValues. Each element in the array represents a reward at that index. Initially, the total reward x is 0, and no indices are marked.

leetcodemediumarraydynamic-programming
LeetCode 1849 - Splitting a String Into Descending Consecutive Values

The problem gives us a numeric string s and asks whether it can be split into at least two non-empty substrings such that their integer values form a strictly descending sequence where every adjacent pair differs by exactly 1.

leetcodemediumstringbacktrackingenumeration
LeetCode 3275 - K-th Nearest Obstacle Queries

The problem requires tracking obstacles on an infinite 2D plane and answering, after each obstacle is placed, the distance to the k-th nearest obstacle from the origin (0, 0) based on Manhattan distance, defined as |x| + |y|.

leetcodemediumarrayheap-(priority-queue)
LeetCode 2656 - Maximum Sum With Exactly K Elements

The problem gives us an integer array nums and an integer k. We must perform exactly k operations. During each operation, we choose one element from the array, add its value to our score, remove it from the array, and then insert a new element equal to the chosen value plus one.

leetcodeeasyarraygreedy
LeetCode 2319 - Check if Matrix Is X-Matrix

The problem gives us a square matrix grid of size n x n. We must determine whether this matrix satisfies the definition of an X-Matrix. An X-Matrix has a very specific structure.

leetcodeeasyarraymatrix
LeetCode 1988 - Find Cutoff Score for Each School

This problem asks us to compute a minimum score requirement (cutoff score) for each school such that the number of students who meet or exceed that score does not exceed the school’s capacity, while also making that number as large as possible.

leetcodemediumdatabase
CF 442B - Andrey and Problem

We are given a set of friends, where each friend independently succeeds in producing a contest problem with a known probability. Andrey will invite some subset of these friends. Once invited, each friend either contributes a problem or does not, independently of the others.

codeforcescompetitive-programminggreedymathprobabilities
LeetCode 2128 - Remove All Ones With Row and Column Flips

The problem gives us an m x n binary matrix named grid, where every cell contains either 0 or 1. We are allowed to perform two kinds of operations: 1. Flip an entire row 2. Flip an entire column Flipping means changing every 0 into 1 and every 1 into 0.

leetcodemediumarraymathbit-manipulationmatrix
LeetCode 2098 - Subsequence of Size K With the Largest Even Sum

The problem asks us to find the largest possible even sum of a subsequence of length k from a given integer array nums. A subsequence is a sequence that can be obtained by deleting some elements from the array without changing the relative order of the remaining elements.

leetcodemediumarraygreedysorting
LeetCode 2442 - Count Number of Distinct Integers After Reverse Operations

The problem asks us to compute the number of distinct integers in an array after performing a specific operation on each element: reversing its digits and adding it to the array. In other words, for every integer in nums, we generate its reverse and append it.

leetcodemediumarrayhash-tablemathcounting
LeetCode 2548 - Maximum Price to Fill a Bag

The problem is asking us to maximize the total price of items placed in a bag with a fixed capacity. Each item is defined by a price and a weight, but unlike traditional knapsack problems, items can be divided proportionally, meaning we can take fractions of an item.

leetcodemediumarraygreedysorting
LeetCode 2170 - Minimum Operations to Make the Array Alternating

The problem requires transforming a given integer array nums into an alternating array with the minimum number of operations.

leetcodemediumarrayhash-tablegreedycounting
CF 172E - BHTML+BCSS

We are given a simplified HTML-like document. Every tag is either an opening tag like <a, a closing tag like </a, or a self-closing tag like <a/. The document is guaranteed to be properly nested, so every opening tag has exactly one matching closing tag.

codeforcescompetitive-programming*specialdfs-and-similarexpression-parsing
CF 403D - Beautiful Pairs of Numbers

Codeforces 403D: Beautiful Pairs of Numbers

codeforcescompetitive-programmingcombinatoricsdp
LeetCode 2720 - Popularity Percentage

The Friends table stores friendship relationships between users on a social platform. Each row contains two user IDs, user1 and user2, indicating that those two users are friends with each other.

leetcodeharddatabase
LeetCode 3069 - Distribute Elements Into Two Arrays I

The problem is asking us to simulate a process where we distribute elements from a 1-indexed array of distinct integers nums into two separate arrays, arr1 and arr2, following a set of deterministic rules.

leetcodeeasyarraysimulation
LeetCode 2298 - Tasks Count in the Weekend

This problem provides a database table named Tasks, where each row represents a submitted task. Every task contains three fields: - taskid, the unique identifier for the task - assigneeid, the user assigned to the task - submitdate, the date the task was submitted The goal is…

leetcodemediumdatabase
LeetCode 3362 - Zero Array Transformation III

We are given an integer array nums and a list of interval queries. Each query [l, r] allows us to reduce every element inside that range by at most 1. The important detail is that the decrement is optional and independent for every index in the range.

leetcodemediumarraytwo-pointersgreedysortingheap-(priority-queue)prefix-sum
LeetCode 2932 - Maximum Strong Pair XOR I

The problem gives us an integer array nums, and we must choose two numbers x and y from the array such that they form a strong pair.

leetcodeeasyarrayhash-tablebit-manipulationtriesliding-window
LeetCode 2103 - Rings and Rods

The problem is asking us to determine how many rods, labeled from 0 to 9, have all three colors of rings placed on them.

leetcodeeasyhash-tablestring
LeetCode 2273 - Find Resultant Array After Removing Anagrams

This problem asks us to repeatedly remove words from an array when two adjacent words are anagrams of each other. We are given a 0-indexed string array words, where every string contains only lowercase English letters.

leetcodeeasyarrayhash-tablestringsorting
CF 255D - Mr. Bender and Square

We are asked to simulate the spread of a signal across an n × n grid. Initially, a single cell at row x and column y is turned on, and in each second, any cell that is side-adjacent to a turned-on cell also turns on.

codeforcescompetitive-programmingbinary-searchimplementationmath
LeetCode 2247 - Maximum Cost of Trip With K Highways

The problem gives us an undirected weighted graph with n cities and a list of highways. Each highway connects two cities and has an associated toll cost. We must find the maximum possible total toll for a trip that uses exactly k highways. There are two important restrictions: 1.

leetcodeharddynamic-programmingbit-manipulationgraph-theorybitmask
LeetCode 2717 - Semi-Ordered Permutation

The problem gives us a permutation nums of length n. A permutation means the array contains every integer from 1 to n exactly once. A permutation is considered semi-ordered when: - The first element is 1 - The last element is n We are allowed to repeatedly swap adjacent elements.

leetcodeeasyarraysimulation
LeetCode 2792 - Count Nodes That Are Great Enough

The problem gives us the root of a binary tree and an integer k. We must determine how many nodes in the tree are considered "great enough". A node is great enough if two conditions are satisfied: 1. Its subtree contains at least k nodes. 2.

leetcodeharddivide-and-conquertreedepth-first-searchbinary-tree
LeetCode 2752 - Customers with Maximum Number of Transactions on Consecutive Days

The problem gives us a database table named Transactions. Each row represents a transaction made by a customer on a specific date.

leetcodeharddatabase
LeetCode 3007 - Maximum Number That Sum of the Prices Is Less Than or Equal to K

The problem asks us to find the largest integer num such that the accumulated price of all numbers from 1 to num does not exceed a given threshold k.

leetcodemediummathbinary-searchdynamic-programmingbit-manipulation
LeetCode 2149 - Rearrange Array Elements by Sign

The problem asks us to rearrange a given integer array nums such that positive and negative numbers alternate, starting with a positive number. The array has an even length and contains an equal number of positive and negative integers.

leetcodemediumarraytwo-pointerssimulation
LeetCode 2210 - Count Hills and Valleys in an Array

The problem asks us to identify hills and valleys in an integer array nums. A hill is a position where the closest non-equal neighbors on both sides are smaller than the current value, and a valley is where those neighbors are larger.

leetcodeeasyarray
LeetCode 2399 - Check Distances Between Same Letters

This problem asks us to verify whether a string follows a very specific spacing rule between repeated characters. We are given a string s that contains only lowercase English letters. Every character that appears in the string appears exactly twice.

leetcodeeasyarrayhash-tablestring
LeetCode 2567 - Minimum Score by Changing Two Elements

The problem asks us to manipulate an array of integers, nums, in a very specific way to minimize a metric called the "score.

leetcodemediumarraygreedysorting
LeetCode 3030 - Find the Grid of Region Average

The problem gives us a grayscale image represented as an m x n matrix called image. Every value in the matrix is an integer between 0 and 255, representing the intensity of a pixel. We must examine every possible 3 x 3 subgrid inside the image.

leetcodemediumarraymatrix
LeetCode 2809 - Minimum Time to Make Array Sum At Most x

The problem provides two integer arrays nums1 and nums2 of equal length, along with a target integer x. Each second, every element in nums1 increases by the corresponding element in nums2. After the increment, you can choose one index and set its value in nums1 to zero.

leetcodehardarraydynamic-programmingsorting
CF 267A - Subtractions

We repeatedly apply the same operation to two positive integers. At every step, we subtract the smaller value from the larger one. The process stops as soon as one number becomes zero. The task is to count how many subtraction operations are performed for each pair.

codeforcescompetitive-programmingmathnumber-theory
LeetCode 3109 - Find the Index of Permutation

The problem gives us a permutation perm of the integers [1, 2, ..., n]. A permutation is simply an arrangement of all numbers from 1 to n where each number appears exactly once.

leetcodemediumarraybinary-searchdivide-and-conquerbinary-indexed-treesegment-treemerge-sortordered-set