brain

tamnd's digital brain — notes, problems, research

43815 notes

LeetCode 2211 - Count Collisions on a Road

The problem describes a one dimensional road containing cars positioned from left to right. Every car has one of three possible states: - 'L', meaning the car moves left - 'R', meaning the car moves right - 'S', meaning the car stays stationary All moving cars travel at the…

leetcodemediumstringstacksimulation
LeetCode 3347 - Maximum Frequency of an Element After Performing Operations II

The problem gives us an integer array nums, along with two integers, k and numOperations. We are allowed to perform exactly numOperations operations. In each operation: - We must choose an index that has not been used before.

leetcodehardarraybinary-searchsliding-windowsortingprefix-sum
LeetCode 2916 - Subarrays Distinct Element Sum of Squares II

The problem asks us to consider every possible non-empty subarray of the input array nums. For each subarray, we compute how many distinct values appear inside it. We then square that distinct count, and finally sum the squared values across all subarrays.

leetcodehardarraydynamic-programmingbinary-indexed-treesegment-tree
CF 174A - Problem About Equation

We have several mugs that already contain different amounts of Ber-Cola. There is also some drink left in the bottle. We must pour the entire remaining amount into the mugs so that every mug ends up with exactly the same volume. If the initial amounts are a1, a2, ...

codeforcescompetitive-programmingmath
CF 141A - Amusing Joke

We are given three uppercase strings. The first two strings are the names written on the door, and the third string is the pile of letters found the next morning after somebody mixed everything together.

codeforcescompetitive-programmingimplementationsortingsstrings
LeetCode 3326 - Minimum Division Operations to Make Array Non Decreasing

The problem asks us to make a given integer array nums non-decreasing by performing a specific type of operation any number of times. Each operation consists of selecting an element and dividing it by its greatest proper divisor.

leetcodemediumarraymathgreedynumber-theory
CF 143B - Help Kingdom of Far Far Away 2

We are given a number as a string and must print it in a banking-style money format. The formatting rules combine several independent transformations. The integer part must contain commas every three digits, counting from the right.

codeforcescompetitive-programmingimplementationstrings
CF 194A - Exams

The author has to take n exams. Every exam receives an integer grade between 2 and 5 inclusive. A grade of 2 means the exam is failed and must be retaken. The total sum of all grades must equal exactly k.

codeforcescompetitive-programmingimplementationmath
LeetCode 2701 - Consecutive Transactions with Increasing Amounts

Before I generate it, there is one important issue to resolve: LeetCode 2701 is a SQL-only Database problem, so there is no valid Python or Go LeetCode-submittable solution signature for this problem.

leetcodeharddatabase
LeetCode 2700 - Differences Between Two Objects

That is a long-form reference document with multiple substantial sections, complete Python and Go implementations, detailed walkthroughs, and worked examples. To keep formatting quality high and avoid truncation, I will provide it in a structured document format.

leetcodemedium
LeetCode 2868 - The Wording Game

The problem describes a turn-based game between Alice and Bob, where both players have a lexicographically sorted list of words. Alice always starts by playing her lexicographically smallest word, and the players then alternate turns.

leetcodehardarraymathtwo-pointersstringgreedygame-theory
CF 160D - Edges in MST

We are given a connected weighted undirected graph with no loops or multiple edges. Each edge has a positive weight.

codeforcescompetitive-programmingdfs-and-similardsugraphssortings
LeetCode 3128 - Right Triangles

The problem gives us a binary matrix grid, where each cell contains either 0 or 1. We need to count how many valid right triangles can be formed using cells whose value is 1.

leetcodemediumarrayhash-tablemathcombinatoricscounting
LeetCode 2760 - Longest Even Odd Subarray With Threshold

The problem asks us to find the length of the longest contiguous subarray in a given integer array nums that satisfies three specific conditions. First, the subarray must start with an even number.

leetcodeeasyarraysliding-window
LeetCode 2241 - Design an ATM Machine

The problem asks us to design a simulation of an ATM machine that can handle deposits and withdrawals with strict rules about how money is dispensed. The ATM stores five types of banknotes: 50, 200, and $500.

leetcodemediumarraygreedydesign
LeetCode 2181 - Merge Nodes in Between Zeros

The problem gives us a singly linked list where the values are grouped between 0 nodes. The list always starts with 0 and ends with 0, and there are no two consecutive zeros. Every sequence of non-zero nodes between two zeros represents one group.

leetcodemediumlinked-listsimulation
LeetCode 2260 - Minimum Consecutive Cards to Pick Up

The problem gives an integer array cards, where each number represents the value written on a card. Two cards are considered matching if they contain the same value.

leetcodemediumarrayhash-tablesliding-window
LeetCode 2468 - Split Message Based on Limit

This problem asks us to divide a message into multiple parts while respecting a strict maximum length constraint for every part.

leetcodehardstringenumeration
LeetCode 2727 - Is Object Empty

This problem asks us to determine if a given object or array is empty. In JavaScript terms, an object is empty if it has no key-value pairs, while an array is empty if it has no elements.

leetcodeeasy
LeetCode 2346 - Compute the Rank as a Percentage

The problem provides a database table named Students, where each row represents a student and contains three fields: - studentid, the unique identifier for the student - departmentid, the department the student belongs to - mark, the student's exam score The goal is to compute…

leetcodemediumdatabase
CF 448D - Multiplication Table

We are working with a conceptual multiplication grid where the cell in row i and column j contains the value i × j. Instead of explicitly building this table, we imagine listing all n × m values and sorting them in non-decreasing order.

codeforcescompetitive-programmingbinary-searchbrute-force
LeetCode 2586 - Count the Number of Vowel Strings in Range

The problem gives us an array of lowercase strings called words and two integer indices, left and right. We need to count how many strings within the inclusive range [left, right] are considered vowel strings.

leetcodeeasyarraystringcounting
CF 248B - Chilly Willy

We are looking for the smallest positive integer that has exactly n digits and is divisible by every one of the numbers 2, 3, 5, and 7 at the same time. In other words, we want the minimal n-digit number that is a multiple of the least common multiple of those four integers.

codeforcescompetitive-programmingmathnumber-theory
LeetCode 2081 - Sum of k-Mirror Numbers

The problem asks us to find the sum of the n smallest k-mirror numbers, where a k-mirror number is a positive integer that reads the same forwards and backwards both in base-10 and in base-k.

leetcodehardmathenumeration
LeetCode 2420 - Find All Good Indices

The problem asks us to identify all good indices in an array nums based on a window size k. A good index i satisfies two conditions: the k elements immediately before it form a non-increasing sequence, and the k elements immediately after it form a non-decreasing sequence.

leetcodemediumarraydynamic-programmingprefix-sum
CF 145E - Lucky Queries

We have a string consisting only of digits 4 and 7. Two kinds of operations are performed on it. The first operation flips every digit in a segment. Every 4 becomes 7, and every 7 becomes 4.

codeforcescompetitive-programmingdata-structures
LeetCode 2873 - Maximum Value of an Ordered Triplet I

You are given an integer array nums and must choose three indices (i, j, k) such that: - i < j < k - The triplet value is (nums[i] - nums[j]) nums[k] Among all valid ordered triplets, we want the maximum possible value.

leetcodeeasyarray
LeetCode 2543 - Check if Point Is Reachable

The problem gives us an infinite two dimensional grid and asks whether we can travel from the starting point (1, 1) to a target point (targetX, targetY) using a specific set of operations.

leetcodehardmathnumber-theory
LeetCode 2362 - Generate the Invoice

This is a SQL database problem involving two tables: | productid | price | | --- | --- | | Unique product identifier | Unit price of the product | | invoiceid | productid | quantity | | --- | --- | --- | | Invoice identifier | Product purchased | Number of units purchased |…

leetcodeharddatabase
CF 204E - Little Elephant and Strings

We are given a list of strings, and for each string, we need to count the number of its substrings that appear in at least k strings from the list. A substring is any contiguous segment of a string.

codeforcescompetitive-programmingdata-structuresimplementationstring-suffix-structurestwo-pointers
LeetCode 2151 - Maximum Good People Based on Statements

The problem asks us to determine the maximum number of good people in a group given a set of statements about each other. Each person can either be good (always tells the truth) or bad (may lie or tell the truth).

leetcodehardarraybacktrackingbit-manipulationenumeration
CF 425D - Sereja and Squares

We are given a set of $n$ points on a 2D plane, each with integer coordinates, and all points are distinct. The task is to count how many axis-aligned squares exist whose four corners are all points from this set.

codeforcescompetitive-programmingbinary-searchdata-structureshashing
LeetCode 2613 - Beautiful Pairs

The problem asks us to find a beautiful pair of indices (i, j) in two integer arrays nums1 and nums2 of equal length. A pair (i, j) is beautiful if it minimizes the sum of the absolute differences between the corresponding elements: among all possible pairs where i < j.

leetcodehardarraymathdivide-and-conquergeometrysortingordered-set
CF 167A - Wizards and Trolleybuses

Each trolleybus starts from the depot at a fixed departure time. It begins with speed 0, can accelerate at most a, and can never exceed its own speed limit v[i]. The destination is d meters away.

codeforcescompetitive-programmingimplementationmath
LeetCode 2978 - Symmetric Coordinates

This problem asks us to identify symmetric coordinate pairs from a database table called Coordinates. Each row in the table represents a coordinate (X, Y), and duplicate rows are allowed.

leetcodemediumdatabase
LeetCode 3112 - Minimum Time to Visit Disappearing Nodes

The problem describes an undirected weighted graph with n vertices, represented by an array of edges. Each edge connects two vertices and has a weight.

leetcodemediumarraygraph-theoryheap-(priority-queue)shortest-path
LeetCode 2519 - Count the Number of K-Big Indices

This problem asks us to determine how many indices in an array satisfy a very specific condition related to smaller values on both sides. For an index i to be considered k-big, two separate requirements must both hold: 1.

leetcodehardarraybinary-searchdivide-and-conquerbinary-indexed-treesegment-treemerge-sortordered-set
LeetCode 3156 - Employee Task Duration and Concurrent Tasks

The problem gives us a table named Tasks, where each row represents a task assigned to an employee. Every task has a start timestamp and an end timestamp. Multiple tasks may overlap in time for the same employee. We need to compute two values for every employee: 1.

leetcodeharddatabase
LeetCode 2592 - Maximize Greatness of an Array

Here is the complete, detailed technical solution guide for LeetCode 2592 - Maximize Greatness of an Array following your formatting requirements.

leetcodemediumarraytwo-pointersgreedysorting
LeetCode 2852 - Sum of Remoteness of All Cells

We are given an n × n grid where each cell is either: - A positive integer, representing a valid cell with that value. - -1, representing a blocked cell. Movement is allowed only between non-blocked cells that share an edge, meaning up, down, left, or right.

leetcodemediumarrayhash-tabledepth-first-searchbreadth-first-searchunion-findmatrix
LeetCode 3034 - Number of Subarrays That Match a Pattern I

The problem asks us to count how many contiguous subarrays of nums match a given relationship pattern. Instead of comparing exact values, the pattern describes how adjacent numbers should relate to each other.

leetcodemediumarrayrolling-hashstring-matchinghash-function
LeetCode 2552 - Count Increasing Quadruplets

The problem asks us to count the number of increasing quadruplets (i, j, k, l) in a 0-indexed array nums of size n, where nums is a permutation of the integers from 1 to n.

leetcodehardarraydynamic-programmingbinary-indexed-treeenumerationprefix-sum
LeetCode 2595 - Number of Even and Odd Bits

The problem asks us to analyze the binary representation of a positive integer n and count how many 1 bits appear at even indices and how many appear at odd indices. Bit positions are counted from right to left, starting at index 0.

leetcodeeasybit-manipulation
LeetCode 2147 - Number of Ways to Divide a Long Corridor

The problem presents a long corridor represented as a string, where 'S' denotes a seat and 'P' denotes a plant. The goal is to partition this corridor into sections, such that each section contains exactly two seats and any number of plants.

leetcodehardmathstringdynamic-programming
LeetCode 3175 - Find The First Player to win K Games in a Row

The problem describes a competition where players stand in a queue and repeatedly compete against each other. Every player has a unique skill value, and whenever two players play, the one with the larger skill always wins. At each step: 1.

leetcodemediumarraysimulation
CF 402D - Upgrading Array

We are given an array of positive integers and a set of "bad" prime numbers. Every other prime not in the bad set is implicitly "good." Each number in the array contributes to a total "beauty" score determined by its prime factorization.

codeforcescompetitive-programmingdpgreedymathnumber-theory
LeetCode 3384 - Team Dominance by Pass Success

This problem asks us to compute a dominance score for each football team across two halves of a match, based on passing outcomes. The input is represented using two database tables, Teams and Passes. The Teams table maps every player to exactly one team.

leetcodeharddatabase
LeetCode 3146 - Permutation Difference between Two Strings

The problem asks us to compute the permutation difference between two strings, s and t. Both strings contain unique characters, and t is a permutation of s.

leetcodeeasyhash-tablestring
CF 140E - New Year Garland

The input array differences describes how consecutive values in an unknown array change from one position to the next.

codeforcescompetitive-programmingcombinatoricsdp
LeetCode 3132 - Find the Integer Added to Array II

We are given two integer arrays, nums1 and nums2. The array nums2 was created from nums1 using two operations: 1. Remove exactly two elements from nums1. 2. Add the same integer x to every remaining element.

leetcodemediumarraytwo-pointerssortingenumeration
LeetCode 3145 - Find Products of Elements of Big Array

The problem asks us to work with a conceptual infinite array called bignums, which is generated by taking every positive integer i, converting it to its powerful array (the sorted array of powers of two that sum to i), and concatenating all these arrays sequentially.

leetcodehardarraybinary-searchbit-manipulation
LeetCode 2197 - Replace Non-Coprime Numbers in Array

The problem asks us to repeatedly replace adjacent non-coprime numbers in an array with their Least Common Multiple (LCM) until no more adjacent non-coprime pairs exist. Two numbers are non-coprime if their greatest common divisor (GCD) is greater than 1.

leetcodehardarraymathstacknumber-theory
LeetCode 2665 - Counter II

The problem asks us to implement a counter object that maintains a mutable integer value, initialized to a given number init. This counter object must provide three operations: increment, decrement, and reset.

leetcodeeasy
LeetCode 1978 - Employees Whose Manager Left the Company

The problem is asking us to find employees in a company who meet two specific conditions. First, their salary must be strictly less than $30,000.

leetcodeeasydatabase
LeetCode 2162 - Minimum Cost to Set Cooking Time

This problem asks us to simulate the process of entering a cooking time into a microwave while minimizing the total finger movement and button pressing cost. The microwave accepts at most four digits.

leetcodemediummathenumeration
LeetCode 2680 - Maximum OR

In this problem, we are given an integer array nums and an integer k. We may perform at most k operations, where each operation selects one element and multiplies it by 2. Multiplying by 2 in binary is equivalent to shifting all bits one position to the left.

leetcodemediumarraygreedybit-manipulationprefix-sum
CF 159C - String Manipulation 1.0

We are given a string s and an integer k. The user initially registers a username t which is simply the string s repeated k times consecutively. After that, a sequence of edits occurs, each removing the p-th occurrence of a specified character from the current string.

codeforcescompetitive-programming*specialbinary-searchbrute-forcedata-structuresstrings
LeetCode 2948 - Make Lexicographically Smallest Array by Swapping Elements

The problem asks us to transform a given array of positive integers nums into its lexicographically smallest form by performing a specific swap operation any number of times.

leetcodemediumarrayunion-findsorting
CF 162E - HQ9+

The problem asks whether a program written in the joke language HQ9+ will produce any output. The program is a string containing between 1 and 100 printable ASCII characters. Only four instructions matter: "H", "Q", "9", and "+".

codeforcescompetitive-programming*special
LeetCode 3255 - Find the Power of K-Size Subarrays II

The problem asks us to evaluate every contiguous subarray of length k in the given array nums. For each subarray, we must determine whether it satisfies two conditions simultaneously: 1. The elements are sorted in strictly ascending order. 2.

leetcodemediumarraysliding-window
LeetCode 2464 - Minimum Subarrays in a Valid Split

The problem asks us to split an array of integers nums into contiguous subarrays such that each subarray satisfies a validity condition: the greatest common divisor (GCD) of the first and last elements of the subarray must be strictly greater than 1.

leetcodemediumarraymathdynamic-programmingnumber-theory
LeetCode 2073 - Time Needed to Buy Tickets

This problem describes a queue of n people, each wanting to buy a certain number of tickets. The input is an array tickets where tickets[i] represents how many tickets the i-th person wants.

leetcodeeasyarrayqueuesimulation
LeetCode 2047 - Number of Valid Words in a Sentence

This problem asks us to count the number of valid words in a sentence. The sentence consists of lowercase letters, digits, hyphens, punctuation (!, ., ,), and spaces. A word is defined as a token separated by spaces, and it is considered valid if it satisfies three conditions: 1.

leetcodeeasystring
LeetCode 3367 - Maximize Sum of Weights after Edge Removals

We are given an undirected weighted tree with n nodes and n - 1 edges. Since the graph is a tree, there is exactly one simple path between any pair of nodes, and there are no cycles. Each edge has a weight, and we may remove any number of edges.

leetcodeharddynamic-programmingtreedepth-first-searchsorting
LeetCode 1977 - Number of Ways to Separate Numbers

The problem asks us to determine the number of ways a string of digits, num, can be split into a sequence of positive integers that are non-decreasing and have no leading zeros.

leetcodehardstringdynamic-programmingsuffix-array
LeetCode 3212 - Count Submatrices With Equal Frequency of X and Y

The problem asks us to count submatrices within a given 2D character matrix grid that satisfy three conditions. A submatrix is defined by a contiguous rectangle within the grid, and the submatrix must include the top-left cell grid[0][0].

leetcodemediumarraymatrixprefix-sum
CF 183A - Headquarters

The car started somewhere on the infinite 2D grid and eventually reached the ice-cream stall at (0, 0). We know the number of moves and the order of the GPS records, but each record only tells us a set of possible directions for that step.

codeforcescompetitive-programmingconstructive-algorithmsmath
LeetCode 3071 - Minimum Operations to Write the Letter Y on a Grid

The problem asks us to determine the minimum number of operations to convert a given n x n grid into a representation of the letter Y, under specific conditions. The grid contains integers 0, 1, or 2.

leetcodemediumarrayhash-tablematrixcounting
LeetCode 2812 - Find the Safest Path in a Grid

This problem asks us to find a path from the top-left corner (0,0) to the bottom-right corner (n-1,n-1) that maximizes its safeness factor. The grid contains thieves, represented by cells with value 1, and empty cells, represented by 0.

leetcodemediumarraybinary-searchbreadth-first-searchunion-findheap-(priority-queue)matrix
LeetCode 2847 - Smallest Number With Given Digit Product

The problem gives us a positive integer n and asks us to construct the smallest positive integer whose digits multiply together to exactly n. For example, if n = 105, we need to find some integer whose digits have product 105.

leetcodemediummathgreedy
CF 140D - New Year Contest

Gennady spends the first 10 minutes of the contest only reading the statements. After that, he has exactly 710 minutes left for writing solutions. Each problem requires a fixed amount of writing time, and he may pause and resume problems whenever he wants.

codeforcescompetitive-programminggreedysortings
LeetCode 2336 - Smallest Number in Infinite Set

The problem asks us to implement a data structure representing an infinite set of positive integers, initially containing all integers starting from 1.

leetcodemediumhash-tabledesignheap-(priority-queue)ordered-set
CF 212E - IT Restaurants

We are asked to place two types of restaurants on a tree-shaped city map in such a way that no two adjacent junctions host different types, each junction hosts at most one restaurant, and each network has at least one restaurant.

codeforcescompetitive-programmingdfs-and-similardptrees
LeetCode 2194 - Cells in a Range on an Excel Sheet

This problem is asking us to generate all the Excel-style cell references within a rectangular range given in string format. Each cell is identified by a column letter and a row number, for example "A1" or "K2".

leetcodeeasystring
LeetCode 3321 - Find X-Sum of All K-Long Subarrays II

The problem asks us to compute a specialized sum, called the x-sum, over all subarrays of length k in a given integer array nums.

leetcodehardarrayhash-tablesliding-windowheap-(priority-queue)
LeetCode 2294 - Partition Array Such That Maximum Difference Is K

The problem gives us an integer array nums and an integer k. We must divide the array into one or more subsequences such that every number belongs to exactly one subsequence, and for every subsequence, the difference between its maximum value and minimum value is at most k.

leetcodemediumarraygreedysorting
LeetCode 2554 - Maximum Number of Integers to Choose From a Range I

The problem gives us three inputs: - banned, an array of integers that are not allowed to be selected - n, which defines the valid integer range [1, n] - maxSum, the maximum total sum allowed for all chosen integers We must choose as many distinct integers as possible while…

leetcodemediumarrayhash-tablebinary-searchgreedysorting
LeetCode 2661 - First Completely Painted Row or Column

The problem is asking us to simulate a painting process on a 2D matrix. We are given a 1D array arr of integers and an m x n matrix mat, both containing all integers from 1 to m n exactly once.

leetcodemediumarrayhash-tablematrix
LeetCode 2726 - Calculator with Method Chaining

This problem asks us to design a class named Calculator that supports basic arithmetic operations while enabling method chaining. Method chaining means that after calling one method, we can immediately call another method on the same object.

leetcodeeasy
CF 431A - Black Square

In "Black Square," Jury must press on one of four vertical strips whenever a black square appears. Each strip has a fixed energy cost, measured in calories, for pressing it.

codeforcescompetitive-programmingimplementation
LeetCode 1882 - Process Tasks Using Servers

This problem asks us to simulate a task scheduling system with two priority rules. We are given a list of servers and a list of tasks. Each server has a weight, and each task has a processing duration. At second j, task j becomes available and enters a queue.

leetcodemediumarrayheap-(priority-queue)
CF 420B - Online Meeting

We have a meeting log for a team of developers where each log entry records either a user logging in or logging out. The log may start or end in the middle of the meeting, so we do not know who was online before the first recorded message.

codeforcescompetitive-programmingimplementation
CF 416D - Population Size

We are given a sequence of length $n$, where each position is either a fixed positive integer or unknown (marked as $-1$). The task is to interpret this sequence as being formed by concatenating several arithmetic progressions, one after another.

codeforcescompetitive-programminggreedyimplementationmath
LeetCode 3365 - Rearrange K Substrings to Form Target String

This problem asks whether it is possible to rearrange k contiguous equal-length substrings of a string s to form another string t, given that s and t are anagrams.

leetcodemediumhash-tablestringsorting
LeetCode 2133 - Check if Every Row and Column Contains All Numbers

In this problem, we are given an n x n matrix where every value is guaranteed to be between 1 and n. A matrix is considered valid if every row contains all integers from 1 through n exactly once, and every column also contains all integers from 1 through n exactly once.

leetcodeeasyarrayhash-tablematrix
CF 152E - Garden

We have a rectangular grid where every cell has a cost, the number of flowers destroyed if we pave that cell with concrete. Among all cells, there are up to seven special cells containing important buildings.

codeforcescompetitive-programmingbitmasksdpgraphstrees
LeetCode 2781 - Length of the Longest Valid Substring

The problem gives us a string word and a list of forbidden strings forbidden. A substring is considered valid if none of its internal substrings appear in the forbidden list.

leetcodehardarrayhash-tablestringsliding-window
LeetCode 2254 - Design Video Sharing Platform

Certainly. Here is a complete, detailed technical solution guide for LeetCode 2254 - Design Video Sharing Platform, following your requested formatting and style. The problem asks us to design a class to simulate a video sharing platform.

leetcodehardhash-tabledesignheap-(priority-queue)
LeetCode 2185 - Counting Words With a Given Prefix

The problem gives us two inputs: - An array of strings called words - A string called pref We must count how many strings inside words start with the string pref. A prefix means the beginning portion of a string.

leetcodeeasyarraystringstring-matching
LeetCode 2695 - Array Wrapper

This problem asks us to implement a class ArrayWrapper that encapsulates an array of integers and supports two operations in a custom way.

leetcodeeasy
CF 167D - Wizards and Roads

We are given a set of cities on the plane. Every city has a unique x coordinate and a unique y coordinate. The first k cities are given explicitly, and the remaining cities are generated by two linear recurrences.

codeforcescompetitive-programmingdata-structuresdivide-and-conquergraph-matchingsgraphsgreedy
LeetCode 2511 - Maximum Enemy Forts That Can Be Captured

In this problem, we are given an array called forts, where each position represents one of three possible states: - 1 means the fort belongs to us. - 0 means there is an enemy fort. - -1 means the position is empty.

leetcodeeasyarraytwo-pointers
LeetCode 1951 - All the Pairs With the Maximum Number of Common Followers

The problem provides a relational table named Relations, where each row indicates a directed following relationship: a user identified by followerid follows another user identified by userid.

leetcodemediumdatabase
LeetCode 2202 - Maximize the Topmost Element After K Moves

In this problem, we are given a pile of integers represented as an array nums, where nums[0] is the current top element of the pile. We must perform exactly k moves, and in each move we are allowed to do one of two operations: 1. Remove the current top element from the pile. 2.

leetcodemediumarraygreedy
CF 227A - Where do I Turn?

The hero starts at point A, rides to point B, and then must continue toward point C. At point B, he is facing in the direction from A to B. We need to determine whether reaching C requires turning left, turning right, or continuing straight.

codeforcescompetitive-programminggeometry
LeetCode 1931 - Painting a Grid With Three Different Colors

The problem is asking us to count the number of ways to paint an m x n grid using three colors: red, green, and blue, with the constraint that no two adjacent cells can have the same color. Adjacent cells include both vertically and horizontally neighboring cells.

leetcodeharddynamic-programming
CF 142C - Help Caretaker

We are tasked with filling a warehouse grid of size n by m with the maximum number of T-shaped turboplows. Each turboplow occupies five cells in a specific T pattern, but it can be rotated in any of four orientations.

codeforcescompetitive-programmingbrute-forcedp
LeetCode 2253 - Dynamic Unpivoting of a Table

This problem asks us to transform a wide table into a normalized row-based format. The database table Products contains one row per product, and each store has its own dedicated column. The value inside a store column represents the product's price in that store.

leetcodeharddatabase
LeetCode 1941 - Check if All Characters Have Equal Number of Occurrences

The problem asks us to determine whether a given string s is good, meaning that all characters that appear in the string occur the same number of times.

leetcodeeasyhash-tablestringcounting
LeetCode 1909 - Remove One Element to Make the Array Strictly Increasing

The problem gives us a 0-indexed integer array nums and asks whether it is possible to make the array strictly increasing after removing exactly one element. A strictly increasing array means that every element must be greater than the previous one.

leetcodeeasyarray