brain

tamnd's digital brain — notes, problems, research

42659 notes

LeetCode 1668 - Maximum Repeating Substring

This problem asks us to determine how many times a given string word can be repeated consecutively while still appearing

leetcodeeasystringdynamic-programmingstring-matching
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 1396 - Design Underground System

This problem asks us to design a small tracking system for an underground railway network. The system must support three

leetcodemediumhash-tablestringdesign
LeetCode 952 - Largest Component Size by Common Factor

The problem asks us to find the largest connected component in a graph derived from an array of unique positive integers nums.

leetcodehardarrayhash-tablemathunion-findnumber-theory
LeetCode 149 - Max Points on a Line

The problem gives us a list of points on a 2D coordinate plane. Each point is represented as [x, y], where x and y are integer coordinates. Our task is to determine the maximum number of points that lie on the same straight line.

leetcodehardarrayhash-tablemathgeometry
CF 38E - Let's Go Rolling!

We are given n marbles on a one-dimensional axis, each with a position x[i] and a pin cost c[i]. You can stick a pin in some marbles, paying the associated cost, and unpinned marbles will roll left until they hit the nearest pinned marble.

codeforcescompetitive-programmingdpsortings
CF 63B - Settlers' Training

We have a group of soldiers, each with a rank between 1 and k. During one training session, soldiers are grouped by equal rank. From every group whose rank is still below k, exactly one soldier is promoted by one level.

codeforcescompetitive-programmingimplementation
CF 81E - Pairs

Each student points to exactly one other student, the person they consider their best friend. We may create a pair (a, b) only if either a chose b or b chose a. Every student can belong to at most one pair.

codeforcescompetitive-programmingdfs-and-similardpdsugraphsimplementationtrees
CF 55E - Very simple problem

We are given a convex polygon defined by a list of points in clockwise order. For each query point in the plane, we need to count how many triangles formed by the polygon’s vertices contain that point strictly inside.

codeforcescompetitive-programminggeometrytwo-pointers
CF 25C - Roads in Berland

We are given a map of _n_ cities in Berland, where the shortest distances between all pairs are already known. Conceptually, this means the country is fully connected via some unknown set of roads, and the distance matrix is already the all-pairs shortest path result.

codeforcescompetitive-programminggraphsshortest-paths
CF 27C - Unordered Subsequence

We are given a sequence of integers, and we are asked to extract the shortest subsequence that is _not ordered_. A sequence is considered ordered if it is either entirely non-decreasing or entirely non-increasing.

codeforcescompetitive-programmingconstructive-algorithmsgreedy
LeetCode 174 - Dungeon Game

This problem asks us to determine the minimum initial health a knight needs in order to safely travel through a dungeon and rescue a princess.

leetcodehardarraydynamic-programmingmatrix
LeetCode 2011 - Final Value of Variable After Performing Operations

This problem asks us to simulate a simple programming language with a single integer variable X that starts at 0. We are given a list of string operations, each of which either increments (++X or X++) or decrements (--X or X--) the value of X by 1.

leetcodeeasyarraystringsimulation
CF 29B - Traffic Lights

A car starts at point A and moves along a straight road toward point B. The total distance is l meters, and the car always moves at a fixed speed v. Somewhere along the road, exactly d meters from the start, there is a traffic light.

codeforcescompetitive-programmingimplementation
LeetCode 348 - Design Tic-Tac-Toe

The problem asks us to design a data structure that simulates an n x n Tic-Tac-Toe game between two players. We need to implement a class that supports two operations: - Initializing a game board of size n - Processing moves one at a time and immediately determining whether…

leetcodemediumarrayhash-tabledesignmatrixsimulation
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
LeetCode 378 - Kth Smallest Element in a Sorted Matrix

The problem gives us an n x n matrix where both rows and columns are sorted in ascending order. This means two ordering guarantees exist simultaneously: - Every row is sorted from left to right. - Every column is sorted from top to bottom.

leetcodemediumarraybinary-searchsortingheap-(priority-queue)matrix
CF 65A - Harry Potter and Three Spells

We have three transformation spells that convert one material into another. The first spell turns a grams of sand into b grams of lead. The second spell turns c grams of lead into d grams of gold. The third spell turns e grams of gold into f grams of sand.

codeforcescompetitive-programmingimplementationmath
LeetCode 1536 - Minimum Swaps to Arrange a Binary Grid

The problem gives us an n x n binary matrix called grid. Each cell contains either 0 or 1. We are allowed to perform operations where we swap two adjacent rows. The goal is to transform the matrix into a valid configuration using the minimum number of adjacent row swaps.

leetcodemediumarraygreedymatrix
LeetCode 885 - Spiral Matrix III

The problem is asking us to generate the coordinates of cells in a 2D grid that we would visit if we started at a given cell (rStart, cStart) and walked in a clockwise spiral pattern.

leetcodemediumarraymatrixsimulation
LeetCode 1022 - Sum of Root To Leaf Binary Numbers

This problem gives us the root of a binary tree where every node contains either 0 or 1. Each path from the root node to a leaf node represents a binary number, where the root contributes the most significant bit and each child adds another bit to the right.

leetcodeeasytreedepth-first-searchbinary-tree
LeetCode 1057 - Campus Bikes

This problem models a matching process between workers and bikes on a two dimensional grid. Each worker and each bike has a unique coordinate, and every worker must eventually receive exactly one bike.

leetcodemediumarraysortingheap-(priority-queue)
CF 54E - Vacuum Сleaner

We are given the top view of a robotic vacuum cleaner as a convex polygon. The room corner is the usual 90 degree corner formed by two perpendicular walls. We may rotate the vacuum cleaner by any angle and then push it as far as possible into the corner.

codeforcescompetitive-programminggeometry
LeetCode 1201 - Ugly Number III

The problem defines an "ugly number" as any positive integer that is divisible by at least one of the three given integers a, b, or c.

leetcodemediummathbinary-searchcombinatoricsnumber-theory
LeetCode 1259 - Handshakes That Don't Cross

In this problem, we are given an even number of people standing around a circle. Every person must participate in exactl

leetcodehardmathdynamic-programming
LeetCode 1619 - Mean of Array After Removing Some Elements

The problem gives us an integer array arr and asks us to compute the average value after removing the smallest 5% and th

leetcodeeasyarraysorting
LeetCode 1570 - Dot Product of Two Sparse Vectors

This problem asks us to efficiently compute the dot product between two sparse vectors. A normal vector is simply an array of numbers. The dot product of two vectors is computed by multiplying corresponding elements and summing the results.

leetcodemediumarrayhash-tabletwo-pointersdesign
LeetCode 814 - Binary Tree Pruning

This problem asks us to modify a binary tree by removing every subtree that does not contain at least one node with value 1. A subtree consists of a node and all of its descendants. If an entire subtree contains only 0 values, then that subtree should be deleted from the tree.

leetcodemediumtreedepth-first-searchbinary-tree
LeetCode 684 - Redundant Connection

The problem is asking us to identify a redundant edge in a graph that started as a tree. A tree is a connected graph with n nodes and exactly n-1 edges, meaning it has no cycles. The input graph has n nodes and n edges, so by definition, it contains exactly one cycle.

leetcodemediumdepth-first-searchbreadth-first-searchunion-findgraph-theory
LeetCode 1047 - Remove All Adjacent Duplicates In String

The problem gives us a string s containing only lowercase English letters. We repeatedly look for two adjacent characters that are equal, remove both of them, and continue this process until no such adjacent duplicate pair exists.

leetcodeeasystringstack
CF 7C - Line

We are asked to find an integer point on a straight line described by the equation Ax + By + C = 0. The inputs are three integers, A, B, and C, which define the slope and position of the line.

codeforcescompetitive-programmingmathnumber-theory
LeetCode 787 - Cheapest Flights Within K Stops

Here’s a complete, detailed technical solution guide for LeetCode 787, following your formatting instructions exactly. The problem asks us to find the cheapest flight cost from a source city src to a destination city dst while taking at most k stops along the way.

leetcodemediumdynamic-programmingdepth-first-searchbreadth-first-searchgraph-theoryheap-(priority-queue)shortest-path
LeetCode 1665 - Minimum Initial Energy to Finish Tasks

The problem gives us a list of tasks, where each task is represented as [actual, minimum]. For every task: - minimum is the amount of energy we must currently have before we are allowed to start the task.

leetcodehardarraygreedysorting
LeetCode 2016 - Maximum Difference Between Increasing Elements

The problem is asking us to find the maximum difference between two elements in an array, with the condition that the smaller element appears before the larger element.

leetcodeeasyarray
LeetCode 440 - K-th Smallest in Lexicographical Order

The problem asks us to find the k-th smallest number in lexicographical order among all integers from 1 to n. Lexicographical order means dictionary order, not numerical order.

leetcodehardtrie
LeetCode 371 - Sum of Two Integers

The problem asks us to compute the sum of two integers without using the arithmetic operators + and -. Instead of relying on normal arithmetic, we must use bit manipulation to simulate how addition works at the binary level. The input consists of two integers, a and b.

leetcodemediummathbit-manipulation
LeetCode 573 - Squirrel Simulation

This problem models a squirrel collecting nuts in a 2D garden grid. The garden has a fixed tree position, a starting squirrel position, and multiple nuts scattered around the grid.

leetcodemediumarraymath
LeetCode 1491 - Average Salary Excluding the Minimum and Maximum Salary

The problem gives us an array called salary, where each element represents the salary of an employee. Every salary value

leetcodeeasyarraysorting
LeetCode 604 - Design Compressed String Iterator

This problem asks us to implement a compressed string iterator. We are given a string where each character is immediately followed by a number representing how many times that character appears consecutively in the uncompressed version. For example, "a3b2" represents "aaabb".

leetcodeeasyarraystringdesigniterator
CF 6C - Alice, Bob and Chocolate

We have a row of chocolate bars, and each bar takes a certain amount of time to eat. Alice starts from the left end and keeps moving right. Bob starts from the right end and keeps moving left.

codeforcescompetitive-programminggreedytwo-pointers
LeetCode 1029 - Two City Scheduling

In this problem, we are given an array called costs, where each element represents the travel cost for one person to two different cities.

leetcodemediumarraygreedysorting
CF 48B - Land Lot

The garden is represented as an n × m grid. Each cell contains either 0 or 1. A 1 means there is a tree in that square, while 0 means the square is empty.

codeforcescompetitive-programmingbrute-forceimplementation
LeetCode 98 - Validate Binary Search Tree

This problem asks us to determine whether a given binary tree satisfies the rules of a Binary Search Tree, commonly abbreviated as BST. A binary tree consists of nodes where each node contains a value and pointers to a left child and a right child.

leetcodemediumtreedepth-first-searchbinary-search-treebinary-tree
LeetCode 1507 - Reformat Date

The problem gives a date string in a human readable format such as "20th Oct 2052" and asks us to convert it into the st

leetcodeeasystring
CF 93D - Flags

We need to count stripe sequences built from four colors: black, red, white, and yellow. A sequence is valid if it satisfies several local restrictions. Equal adjacent colors are forbidden. White cannot touch yellow. Red cannot touch black.

codeforcescompetitive-programmingdpmathmatrices
LeetCode 55 - Jump Game

The problem gives us an integer array nums, where each value represents the maximum distance we are allowed to jump forward from that position. You always start at index 0.

leetcodemediumarraydynamic-programminggreedy
LeetCode 793 - Preimage Size of Factorial Zeroes Function

This problem asks us to determine how many non-negative integers x exist such that the factorial of x ends with exactly k trailing zeroes. The function f(x) counts trailing zeroes in x!. For example, f(3) = 0 because 3! = 6 has no trailing zeroes, and f(11) = 2 because 11!

leetcodehardmathbinary-search
LeetCode 897 - Increasing Order Search Tree

This problem gives us the root of a Binary Search Tree, abbreviated as BST, and asks us to rearrange the tree into a very specific form.

leetcodeeasystacktreedepth-first-searchbinary-search-treebinary-tree
LeetCode 744 - Find Smallest Letter Greater Than Target

The problem gives us a sorted array of lowercase English letters and a target character. Our task is to find the smallest character in the array that is strictly greater than the target character in lexicographical order.

leetcodeeasyarraybinary-search
LeetCode 886 - Possible Bipartition

This problem asks whether it is possible to divide n people into exactly two groups such that no pair of people who dislike each other end up in the same group.

leetcodemediumdepth-first-searchbreadth-first-searchunion-findgraph-theory
CF 74C - Chessboard Billiard

We have an n × m chessboard. A billiard ball moves diagonally like a bishop, but unlike a bishop it reflects off the borders of the board. When it hits a vertical wall, the horizontal component of the direction flips. When it hits a horizontal wall, the vertical component flips.

codeforcescompetitive-programmingdfs-and-similardsugraphsnumber-theory
CF 66B - Petya and Countryside

We have a garden represented as a one-dimensional array of sections, each with a fixed height. Petya can create artificial rain above exactly one section, and water will flow to neighboring sections as long as their height is less than or equal to the section the water comes…

codeforcescompetitive-programmingbrute-forceimplementation
LeetCode 742 - Closest Leaf in a Binary Tree

The problem asks us to find the closest leaf node to a given target node k in a binary tree. The input is the root of a binary tree where each node has a unique integer value. A leaf node is defined as any node without children.

leetcodemediumtreedepth-first-searchbreadth-first-searchbinary-tree
LeetCode 1809 - Ad-Free Sessions

The problem is asking us to identify all playback sessions during which no advertisements were shown. We are given two tables: Playback and Ads. The Playback table lists sessions for each customer, with the start and end times of each session.

leetcodeeasydatabase
LeetCode 179 - Largest Number

This problem asks us to rearrange a list of non-negative integers so that, when concatenated together, they form the largest possible number. At first glance, this may look like a straightforward sorting problem where we simply sort the numbers in descending order.

leetcodemediumarraystringgreedysorting
CF 52A - 123-sequence

We are given a list of integers where every number is either 1, 2, or 3. The goal is to transform the sequence so that all numbers are the same, and we want to do this using the smallest number of replacements possible.

codeforcescompetitive-programmingimplementation
LeetCode 1235 - Maximum Profit in Job Scheduling

The problem gives us three arrays of equal length: - startTime[i] represents when the i-th job starts - endTime[i] represents when the i-th job finishes - profit[i] represents the money earned if we complete that job Our goal is to select a subset of jobs that do not overlap…

leetcodehardarraybinary-searchdynamic-programmingsorting
CF 9B - Running Student

The student is already riding a bus that moves along the x-axis from left to right. The bus stops at fixed positions (xi, 0) in increasing order. At any stop except the first one, the student may get off and run directly to the university located at (xu, yu).

codeforcescompetitive-programmingbrute-forcegeometryimplementation
LeetCode 1343 - Number of Sub-arrays of Size K and Average Greater than or Equal to Threshold

This problem asks us to count how many contiguous subarrays of length k have an average value greater than or equal to a

leetcodemediumarraysliding-window
CF 7A - Kalevitch and Chess

The problem asks us to simulate a painter working on an 8×8 chessboard. Every square starts white, and the painter can perform only two operations: paint an entire row black or paint an entire column black. Painting the same square multiple times has no effect beyond the first.

codeforcescompetitive-programmingbrute-forceconstructive-algorithms
LeetCode 1374 - Generate a String With Characters That Have Odd Counts

The problem asks us to generate a string of length n such that each character in the string occurs an odd number of time

leetcodeeasystring
LeetCode 747 - Largest Number At Least Twice of Others

The problem gives us an integer array nums in which the largest value is guaranteed to be unique. Our task is to determine whether this largest number is at least twice as large as every other number in the array.

leetcodeeasyarraysorting
LeetCode 1360 - Number of Days Between Two Dates

The problem gives two dates in the format YYYY-MM-DD and asks us to compute the absolute number of days between them. Each input string represents a valid calendar date. The year, month, and day are separated by hyphens.

leetcodeeasymathstring
LeetCode 585 - Investments in 2016

Here’s a full, detailed technical solution guide for LeetCode 585 following your exact formatting rules: The problem presents an Insurance table containing policyholder information, including a unique policy ID (pid), investment values for 2015 (tiv2015) and 2016 (tiv2016)…

leetcodemediumdatabase
LeetCode 1395 - Count Number of Teams

The problem asks us to count the number of valid teams of three soldiers from a line of n soldiers, where each soldier h

leetcodemediumarraydynamic-programmingbinary-indexed-treesegment-tree
LeetCode 143 - Reorder List

The problem gives us the head of a singly linked list and asks us to reorder the nodes in a very specific alternating pattern. A normal linked list looks like this: We must transform it into: The important detail is that we are not allowed to change node values.

leetcodemediumlinked-listtwo-pointersstackrecursion
LeetCode 184 - Department Highest Salary

The problem asks us to find employees with the highest salary in each department from a company database. The input consists of two relational tables: Employee and Department. The Employee table contains employee details, including id, name, salary, and departmentId.

leetcodemediumdatabase
LeetCode 247 - Strobogrammatic Number II

The problem asks us to generate every strobogrammatic number of a given length n. A strobogrammatic number is a number that still appears valid after being rotated 180 degrees. Not every digit works under rotation.

leetcodemediumarraystringrecursion
LeetCode 756 - Pyramid Transition Matrix

Here’s a full, detailed technical solution guide for LeetCode 756 - Pyramid Transition Matrix, following your formatting rules precisely.

leetcodemediumhash-tablestringbacktrackingbit-manipulation
LeetCode 1238 - Circular Permutation in Binary Representation

This problem asks us to construct a special ordering of all integers from 0 to 2^n - 1. The ordering must satisfy the properties of a circular Gray code sequence.

leetcodemediummathbacktrackingbit-manipulation
CF 42A - Guilty --- to the kitchen!

We want to cook soup using several ingredients that must appear in a fixed ratio. If the recipe says the proportions are a1, a2, ..., an, then the final soup must contain:

codeforcescompetitive-programminggreedyimplementation
LeetCode 2007 - Find Original Array From Doubled Array

The problem gives us an array called changed, which was supposedly created from another array called original. The transformation process works like this: 1. Take every number in original. 2. Append its doubled value, meaning 2 x. 3. Shuffle all the numbers together.

leetcodemediumarrayhash-tablegreedysorting
LeetCode 1791 - Find Center of Star Graph

The problem is asking us to identify the center node of a star graph. A star graph is a very specific type of graph with n nodes: there is one node called the center, and it is connected to all other n-1 nodes.

leetcodeeasygraph-theory
LeetCode 1732 - Find the Highest Altitude

In this problem, a biker starts at altitude 0 and travels through a sequence of roads. The input array gain describes how the biker's altitude changes between consecutive points on the trip. If gain[i] is positive, the biker climbs upward between point i and point i + 1.

leetcodeeasyarrayprefix-sum
LeetCode 1626 - Best Team With No Conflicts

The problem asks us to build a basketball team with the maximum possible total score, while ensuring that the team does not contain any conflicts.

leetcodemediumarraydynamic-programmingsorting
CF 87C - Interesting Game

We are asked to analyze a two-player game with a single pile of n stones. The players alternate turns, starting with Serozha.

codeforcescompetitive-programmingdpgamesmath
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
CF 22C - System Administrator

We are asked to design a network of servers where each server is a node, and each connection between two servers is an undirected edge. There are n servers and we are allowed exactly m connections.

codeforcescompetitive-programminggraphs
CF 129A - Cookies

We are given several bags of cookies, where each bag contains some number of cookies. Olga wants to steal exactly one bag. After removing that bag, the total number of cookies left behind must be even so the two sisters can split them equally.

codeforcescompetitive-programmingimplementation
LeetCode 290 - Word Pattern

The problem gives two inputs: a pattern string and a space-separated string of words. We need to determine whether the sequence of words follows the same structure as the sequence of characters in the pattern.

leetcodeeasyhash-tablestring
LeetCode 437 - Path Sum III

The problem gives us the root of a binary tree and an integer targetSum. We need to count how many downward paths in the tree have values that add up exactly to targetSum. A path can begin at any node and end at any node, as long as it always moves downward from parent to child.

leetcodemediumtreedepth-first-searchbinary-tree
LeetCode 157 - Read N Characters Given Read4

This problem asks us to implement a read function using a restricted API called read4. The file itself is hidden from us, and the only way to access its contents is by repeatedly calling read4.

leetcodeeasyarraysimulationinteractive
LeetCode 866 - Prime Palindrome

This problem asks us to find the smallest number greater than or equal to n that satisfies two properties simultaneously: 1. The number must be a palindrome. 2. The number must be prime. A palindrome is a number that reads the same forward and backward.

leetcodemediummathnumber-theory
LeetCode 1621 - Number of Sets of K Non-Overlapping Line Segments

This guide is quite large and highly detailed under your required structure, especially with full worked examples, both

leetcodemediummathdynamic-programmingcombinatoricsprefix-sum
CF 79A - Bus Game

We are asked to simulate a turn-based game involving two players, Ciel and Hanako, who alternate taking coins from a common pile. The pile initially contains x 100-yen coins and y 10-yen coins. On each turn, the active player must remove exactly 220 yen.

codeforcescompetitive-programminggreedy
CF 75A - Life Without Zeros

We are given two positive integers, a and b. First we compute their normal sum c = a + b. Then we apply the same transformation to all three numbers: remove every digit 0 from their decimal representation. The question is whether the transformed equation still holds.

codeforcescompetitive-programmingimplementation
CF 72A - Goshtasp, Vishtasp and Eidi

The problem asks us to decide whether a positive integer $n$ can be represented as a sum of distinct integers, where each integer is either 1 or a prime number. If such a representation exists, we need to produce one that is lexicographically largest.

codeforcescompetitive-programming*specialgreedymath
CF 45B - School

Each student points to exactly one other student, the person they call whenever they hear news. This creates a directed functional graph, every node has out-degree exactly one.

codeforcescompetitive-programmingdpdsu
LeetCode 1316 - Distinct Echo Substrings

The problem asks us to find the number of distinct non-empty substrings of a given string text that can be expressed as

leetcodehardstringtrierolling-hashhash-function
CF 134B - Pairs of Numbers

We are asked to start with the number pair (1,1) and reach a pair where at least one of the numbers equals a given target n. At each step, we can add one number to the other to form a new pair. Concretely, if our current pair is (a, b), the next pair can be (a+b, b) or (a, a+b).

codeforcescompetitive-programmingbrute-forcedfs-and-similarmathnumber-theory
LeetCode 1750 - Minimum Length of String After Deleting Similar Ends

The problem gives us a string s containing only the characters 'a', 'b', and 'c'. We may repeatedly perform a deletion operation on the string.

leetcodemediumtwo-pointersstring
CF 15D - Map

We are given a rectangular map of size n × m, where each cell has a non-negative height. Peter wants to build cities of size a × b. To place a city, he must level the ground inside its rectangle by reducing all cells to the minimum height within that rectangle.

codeforcescompetitive-programmingdata-structuresimplementationsortings
CF 64H - Table Bowling

We are given the final standings of a table bowling tournament. Every participant has a unique name and an integer score. The task is not just to sort the players, but also to assign ranking labels in the style used in real tournaments.

codeforcescompetitive-programming*specialsortings
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 790 - Domino and Tromino Tiling

The problem asks us to compute the number of ways to completely tile a 2 x n board using two types of tiles: a domino (2 x 1) and a tromino shape.

leetcodemediumdynamic-programming
LeetCode 712 - Minimum ASCII Delete Sum for Two Strings

The problem gives us two strings, s1 and s2, and asks us to make them equal by deleting characters from either string. Every deleted character contributes its ASCII value to the total cost. Our goal is to minimize this total deletion cost.

leetcodemediumstringdynamic-programming
CF 108A - Palindromic Times

The task is to find the next time on a 24-hour digital clock that reads as a palindrome. The input is a string formatted as "HH:MM", representing hours and minutes in 24-hour notation.

codeforcescompetitive-programmingimplementationstrings
LeetCode 1241 - Number of Comments per Post

This problem asks us to analyze a database table named Submissions and determine how many unique comments belong to each post.

leetcodeeasydatabase
CF 8C - Looking for Order

We have a fixed starting point, the handbag, and up to 24 scattered objects on a 2D plane. Lena always starts at the handbag, walks around collecting at most two objects, returns to the handbag, then repeats until every object is stored back.

codeforcescompetitive-programmingbitmasksdp
CF 111C - Petya and Spiders

We are given a board of size n by m, with a spider on every cell. Each spider can move to any adjacent cell or stay in place, as long as it stays inside the board. All spiders move simultaneously, and multiple spiders can occupy the same cell after moving.

codeforcescompetitive-programmingbitmasksdpdsu