brain

tamnd's digital brain — notes, problems, research

42641 notes

LeetCode 110 - Balanced Binary Tree

This problem asks us to determine whether a given binary tree is height-balanced. A binary tree is considered height-balanced if, for every node in the tree, the height difference between its left and right subtrees is at most 1.

leetcodeeasytreedepth-first-searchbinary-tree
LeetCode 1419 - Minimum Number of Frogs Croaking

The problem asks us to determine the minimum number of frogs needed to produce a given sequence of croaks represented by

leetcodemediumstringcounting
LeetCode 681 - Next Closest Time

The problem gives us a valid time string in the format "HH:MM" and asks us to construct the next chronological time using only the digits already present in the original time. The important detail is that digits may be reused any number of times.

leetcodemediumhash-tablestringbacktrackingenumeration
LeetCode 237 - Delete Node in a Linked List

This problem asks us to delete a node from a singly linked list, but with an unusual restriction: we are not given access to the head of the list. Instead, we are only given a reference to the node that should be deleted.

leetcodemediumlinked-list
CF 115D - Unambiguous Arithmetic Expression

We are asked to count the number of ways an arithmetic expression can be made unambiguous with parentheses so that, if all parentheses are removed, the expression is exactly the string given in the input.

codeforcescompetitive-programmingdpexpression-parsing
LeetCode 632 - Smallest Range Covering Elements from K Lists

The problem gives us k sorted integer lists, and we must find the smallest inclusive range [a, b] such that the range contains at least one element from every list. Each list is already sorted in non-decreasing order, which is a very important property.

leetcodehardarrayhash-tablegreedysliding-windowsortingheap-(priority-queue)
LeetCode 1479 - Sales by Day of the Week

The problem asks us to generate a sales report that summarizes the total quantity of items sold for each category on eac

leetcodeharddatabase
LeetCode 1100 - Find K-Length Substrings With No Repeated Characters

The problem asks us to count how many substrings of length k contain only unique characters. A substring is a contiguous portion of the string. For every possible substring of length k, we must determine whether all characters inside it are distinct.

leetcodemediumhash-tablestringsliding-window
CF 97C - Winning Strategy

Each year the university sends a team of exactly n students to the finals. Some of those students may already have participated once before, and the rest are newcomers.

codeforcescompetitive-programmingbinary-searchgraphsmathshortest-paths
LeetCode 898 - Bitwise ORs of Subarrays

The problem asks us to compute every possible bitwise OR value that can be formed from all non-empty contiguous subarrays of the given array arr, then return how many distinct values exist. A subarray is any contiguous slice of the array.

leetcodemediumarraydynamic-programmingbit-manipulation
LeetCode 1166 - Design File System

This problem asks us to design a simplified file system that supports two operations: 1. Creating a new path with an associated integer value. 2. Retrieving the value stored at a path. A path behaves similarly to a directory structure in a real operating system.

leetcodemediumhash-tablestringdesigntrie
LeetCode 763 - Partition Labels

The problem is asking us to partition a string s into as many contiguous parts as possible such that no letter appears in more than one part. In other words, each character in the string should be confined to a single segment.

leetcodemediumhash-tabletwo-pointersstringgreedy
LeetCode 1174 - Immediate Food Delivery II

The problem provides a Delivery table that records food delivery orders. Each row represents a single order placed by a customer. Along with the order date, each customer also specifies a preferred delivery date.

leetcodemediumdatabase
LeetCode 1711 - Count Good Meals

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

leetcodemediumarrayhash-table
LeetCode 277 - Find the Celebrity

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

leetcodemediumtwo-pointersgraph-theoryinteractive
LeetCode 106 - Construct Binary Tree from Inorder and Postorder Traversal

The problem provides two traversal orders of the same binary tree: - inorder, which follows the order: left subtree, root, right subtree - postorder, which follows the order: left subtree, right subtree, root We must reconstruct the original binary tree and return its root node.

leetcodemediumarrayhash-tabledivide-and-conquertreebinary-tree
LeetCode 932 - Beautiful Array

The problem asks us to construct a permutation of the integers from 1 to n such that the array satisfies a special condition.

leetcodemediumarraymathdivide-and-conquer
LeetCode 965 - Univalued Binary Tree

The problem gives us the root node of a binary tree and asks whether the tree is "uni-valued". A binary tree is considered uni-valued if every node in the tree contains exactly the same integer value.

leetcodeeasytreedepth-first-searchbreadth-first-searchbinary-tree
CF 61B - Hard Work

We are given three original strings. A student's answer is considered correct if it can be formed by concatenating these three strings in any order, after ignoring two kinds of differences. The first difference is letter casing.

codeforcescompetitive-programmingstrings
CF 28C - Bath Queue

Every student independently chooses one of the bathroom rooms uniformly at random. A room may contain several wash basins, so students entering that room are split into several queues.

codeforcescompetitive-programmingcombinatoricsdpprobabilities
LeetCode 733 - Flood Fill

The problem is asking us to simulate a flood fill operation on a 2D grid that represents an image. Each cell in the grid contains an integer representing a pixel color. You are given a starting pixel (sr, sc) and a target color color.

leetcodeeasyarraydepth-first-searchbreadth-first-searchmatrix
CF 71C - Round Table Knights

The knights sit on a circle, equally spaced. Each position is marked either 1 for a knight in a good mood or 0 for a knight in a bad mood.

codeforcescompetitive-programmingdpmathnumber-theory
LeetCode 500 - Keyboard Row

This problem asks us to determine which words in a given list can be typed using letters from only one row of an American keyboard. The input is an array of strings, words, where each string represents a word consisting only of English alphabet characters.

leetcodeeasyarrayhash-tablestring
LeetCode 1629 - Slowest Key

This problem asks us to determine which key on a keypad was pressed for the longest duration during a test sequence. We

leetcodeeasyarraystring
LeetCode 1527 - Patients With a Condition

The problem asks us to query a database table Patients and return the records of patients who have Type I Diabetes. Each

leetcodeeasydatabase
LeetCode 1379 - Find a Corresponding Node of a Binary Tree in a Clone of That Tree

The traversal is by reference, not value.

leetcodeeasytreedepth-first-searchbreadth-first-searchbinary-tree
CF 89D - Space mines

The Death Star is a sphere of radius R. Its center starts at point A and moves forever in a straight line with constant velocity vector v. Every mine consists of two kinds of geometry. The first part is a sphere centered at O with radius r. The second part is a set of spikes.

codeforcescompetitive-programminggeometry
LeetCode 1001 - Grid Illumination

This problem models a very large chessboard-like grid where certain cells contain active lamps. A lamp illuminates four directions simultaneously: - Its entire row - Its entire column - Its main diagonal, identified by row - col - Its anti-diagonal, identified by row + col For…

leetcodehardarrayhash-table
LeetCode 345 - Reverse Vowels of a String

The problem asks us to reverse only the vowels in a string while leaving all non-vowel characters in their original positions.

leetcodeeasytwo-pointersstring
LeetCode 1689 - Partitioning Into Minimum Number Of Deci-Binary Numbers

The problem asks us to determine the minimum number of positive deci-binary numbers required to sum up to a given decima

leetcodemediumstringgreedy
LeetCode 140 - Word Break II

The problem asks us to segment a given string s into all possible sentences where each word in the sentence exists in a given dictionary wordDict.

leetcodehardarrayhash-tablestringdynamic-programmingbacktrackingtriememoization
CF 135D - Cycle

We are given a binary grid. Cells containing '1' form usable tiles, while '0' cells are blocked. We want the longest cycle made entirely from '1' cells. The cycle must behave like a simple closed curve on the grid.

codeforcescompetitive-programmingbrute-forcedfs-and-similarimplementation
LeetCode 1053 - Previous Permutation With One Swap

The problem asks us to find the lexicographically largest permutation that is still smaller than the given array, using exactly one swap operation.

leetcodemediumarraygreedy
LeetCode 788 - Rotated Digits

The problem asks us to count the number of good integers within a given range [1, n]. An integer is considered good if each of its digits, when rotated 180 degrees, forms another valid digit and the resulting number is different from the original.

leetcodemediummathdynamic-programming
LeetCode 218 - The Skyline Problem

The Skyline Problem asks us to compute the visible outer contour formed by a collection of rectangular buildings when viewed from far away. Each building is represented by three integers: a left x-coordinate, a right x-coordinate, and a height.

leetcodehardarraydivide-and-conquerbinary-indexed-treesegment-treesweep-linesortingheap-(priority-queue)ordered-set
LeetCode 902 - Numbers At Most N Given Digit Set

The problem gives us a set of allowed digits, stored as strings, and an integer n. We may construct any positive integer by repeatedly using digits from the given set. Each digit can be reused any number of times.

leetcodehardarraymathstringbinary-searchdynamic-programming
LeetCode 212 - Word Search II

LeetCode 212, LeetCode Word Search II, asks us to find every word from a given dictionary that can be formed inside a 2D character grid. Each word must be built by moving one cell at a time horizontally or vertically.

leetcodehardarraystringbacktrackingtriematrix
LeetCode 652 - Find Duplicate Subtrees

The problem gives us the root of a binary tree and asks us to identify all duplicate subtrees inside it. A subtree is defined as any node together with all of its descendants.

leetcodemediumhash-tabletreedepth-first-searchbinary-tree
LeetCode 622 - Design Circular Queue

The problem asks us to implement a circular queue, a fixed-size queue where the end wraps back to the start to efficiently reuse empty space.

leetcodemediumarraylinked-listdesignqueue
CF 113B - Petr#

We are asked to count how many distinct substrings of a given string t start with a string sbegin and end with another string send. The key detail is that substrings are considered different only by their content, not by their position in t.

codeforcescompetitive-programmingbrute-forcedata-structureshashingstrings
LeetCode 169 - Majority Element

The problem asks us to identify the majority element in a given array of integers nums. The majority element is defined as the number that appears more than half of the times in the array, i.e., more than ⌊n / 2⌋ times where n is the length of the array.

leetcodeeasyarrayhash-tabledivide-and-conquersortingcounting
CF 69A - Young Physicist

We are given several force vectors acting on a body in three-dimensional space. Each vector has three components: its effect along the x-axis, y-axis, and z-axis. A body is in equilibrium only if the total force acting on it is zero in every direction.

codeforcescompetitive-programmingimplementationmath
LeetCode 91 - Decode Ways

This problem asks us to determine how many different valid ways a numeric string can be decoded into letters using the mapping: - "1" → 'A' - "2" → 'B' - ... - "26" → 'Z' The input is a string s containing only digits.

leetcodemediumstringdynamic-programming
LeetCode 550 - Game Play Analysis IV

This problem is asking us to calculate a retention metric from a table of player activities. Specifically, we need to determine the fraction of players who log in on the day immediately following their first login.

leetcodemediumdatabase
LeetCode 2020 - Number of Accounts That Did Not Stream

This problem asks us to analyze two database tables, Subscriptions and Streams, and determine how many accounts purchased a subscription during the year 2021 but never streamed any content during 2021. The Subscriptions table stores subscription intervals for each account.

leetcodemediumdatabase
LeetCode 427 - Construct Quad Tree

The problem asks us to convert a binary matrix into a Quad-Tree representation. A Quad-Tree is a recursive tree structure where every internal node has exactly four children, each representing one quadrant of the current square region.

leetcodemediumarraydivide-and-conquertreematrix
CF 13B - Letter A

We are given three line segments on a 2D plane. We must decide whether these three segments can be interpreted as the shape of the capital letter A.

codeforcescompetitive-programminggeometryimplementation
LeetCode 92 - Reverse Linked List II

This problem asks us to reverse only a specific portion of a singly linked list, rather than reversing the entire list. We are given the head of a linked list and two integer positions, left and right, where left <= right.

leetcodemediumlinked-list
LeetCode 997 - Find the Town Judge

The problem describes a town containing n people labeled from 1 to n. Among these people, there may exist a special person called the town judge. The judge must satisfy two strict conditions: 1. The judge trusts nobody. 2. Every other person trusts the judge.

leetcodeeasyarrayhash-tablegraph-theory
LeetCode 1721 - Swapping Nodes in a Linked List

The problem provides a singly linked list and an integer k. The task is to swap the values of the kth node from the start with the kth node from the end of the list. The list is 1-indexed, meaning that the first node is position 1, not 0.

leetcodemediumlinked-listtwo-pointers
LeetCode 1631 - Path With Minimum Effort

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

leetcodemediumarraybinary-searchdepth-first-searchbreadth-first-searchunion-findheap-(priority-queue)matrix
LeetCode 1485 - Clone Binary Tree With Random Pointer

That’s a detailed reference guide with multiple required sections and full implementations. Before I start, please confi

leetcodemediumhash-tabletreedepth-first-searchbreadth-first-searchbinary-tree
CF 123D - String

We are given a string s. For every substring x of s, we look at all positions where x appears inside s. Suppose these occurrences start at positions: $$p1 < p2 < dots < pk$$ The function F(s, x) counts how many contiguous segments we can choose from this ordered list of…

codeforcescompetitive-programmingstring-suffix-structures
LeetCode 1781 - Sum of Beauty of All Substrings

The problem asks us to calculate the sum of beauty for all substrings of a given string s. The beauty of a substring is defined as the difference between the highest frequency and the lowest frequency of any character that occurs in that substring.

leetcodemediumhash-tablestringcounting
CF 111B - Petya and Divisors

We are asked to process a sequence of queries, each defined by two integers, x and y. For each query, we need to count how many positive divisors of x do not divide any of the y numbers immediately preceding x in the sequence, that is, the numbers x-y, x-y+1, ..., x-1.

codeforcescompetitive-programmingbinary-searchdata-structuresnumber-theory
CF 53B - Blog Photo

We are given the dimensions of an uploaded photo, height h and width w. We want to cut out a smaller rectangle from it. The cut rectangle must satisfy three conditions.

codeforcescompetitive-programmingbinary-searchimplementation
LeetCode 1611 - Minimum One Bit Operations to Make Integers Zero

This problem asks us to transform a given integer n into 0 using a specialized set of bit-flipping operations. Each oper

leetcodehardmathdynamic-programmingbit-manipulationrecursionmemoization
LeetCode 705 - Design HashSet

The problem asks us to design our own HashSet implementation without using any built in hash table libraries such as Python's set or Go's built in map type as the primary solution idea. A HashSet is a data structure that stores unique values.

leetcodeeasyarrayhash-tablelinked-listdesignhash-function
CF 33E - Helper

Valera has a list of subjects he knows how to solve. Every subject takes a fixed amount of working time. Students come with requests: each request has a subject, an exam deadline, and a reward. If Valera finishes the solution strictly before the exam starts, he gets paid.

codeforcescompetitive-programming
LeetCode 899 - Orderly Queue

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

leetcodehardmathstringsorting
LeetCode 943 - Find the Shortest Superstring

The problem asks us to find the shortest superstring that contains all the given strings in the array words as substrings.

leetcodehardarraystringdynamic-programmingbit-manipulationbitmask
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
CF 45G - Prime Problem

We have houses numbered from 1 to n. Every house must receive a color. For each color, if we add together all house indices painted with that color, the result must be a prime number.

codeforcescompetitive-programmingnumber-theory
LeetCode 1762 - Buildings With an Ocean View

This problem gives us an array called heights, where each element represents the height of a building. The buildings are arranged in a straight line from left to right, and the ocean is located to the right side of the last building.

leetcodemediumarraystackmonotonic-stack
LeetCode 1207 - Unique Number of Occurrences

The problem gives us an integer array arr and asks whether every distinct number appears a unique number of times. In other words, we first count how many times each value occurs in the array.

leetcodeeasyarrayhash-table
LeetCode 774 - Minimize Max Distance to Gas Station

The problem gives us a sorted array called stations, where each value represents the position of an existing gas station on a one dimensional x-axis. We are also given an integer k, representing how many additional gas stations we are allowed to add.

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

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

leetcodemediumdatabase
LeetCode 1728 - Cat and Mouse II

This problem describes a two-player perfect-information game played on a small grid. One player controls the mouse and the other controls the cat. Both players move optimally and alternate turns, with the mouse always moving first.

leetcodehardarraymathdynamic-programminggraph-theorytopological-sortmemoizationmatrixgame-theory
CF 1C - Ancient Berland Circus

We are given the coordinates of three vertices of some regular polygon. The polygon itself is unknown: we do not know how many sides it has, where its center is, or which vertices the three points correspond to.

codeforcescompetitive-programminggeometrymath
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 737 - Sentence Similarity II

This problem asks us to determine whether two sentences are considered similar based on a set of similarity relationships between words. Each sentence is represented as an array of strings, where each string is a single word.

leetcodemediumarrayhash-tablestringdepth-first-searchbreadth-first-searchunion-find
LeetCode 1182 - Shortest Distance to Target Color

The problem gives us an array called colors, where each position contains one of three possible values: 1, 2, or 3. Each value represents a color assigned to that index. We are also given a list of queries.

leetcodemediumarraybinary-searchdynamic-programming
LeetCode 655 - Print Binary Tree

The problem asks us to transform a binary tree into a formatted 2D string matrix representation. Each node must appear in a specific row and column based on its position in the tree. The output is not simply a traversal order, it is a visual layout of the tree structure.

leetcodemediumtreedepth-first-searchbreadth-first-searchbinary-tree
LeetCode 1271 - Hexspeak

The problem asks us to convert a decimal number given as a string into its Hexspeak representation. Hexspeak is derived

leetcodeeasymathstring
CF 14A - Letter

We are given a rectangular grid representing a sheet of graph paper with _n_ rows and _m_ columns. Some of the squares are shaded, marked by *, and the rest are unshaded, marked by ..

codeforcescompetitive-programmingimplementation
LeetCode 1451 - Rearrange Words in a Sentence

The problem gives us a sentence where words are separated by single spaces, the very first character of the sentence is

leetcodemediumstringsorting
LeetCode 794 - Valid Tic-Tac-Toe State

This problem asks us to determine whether a given Tic-Tac-Toe board configuration could occur during a real game that follows all official rules. The input is a 3 x 3 board represented as an array of three strings.

leetcodemediumarraymatrix
LeetCode 1183 - Maximum Number of Ones

The problem gives us a binary matrix M with dimensions height x width. Every cell in the matrix must contain either 0 or 1. There is one important restriction: Every square submatrix of size sideLength x sideLength may contain at most maxOnes cells equal to 1.

leetcodehardmathgreedysortingheap-(priority-queue)
LeetCode 979 - Distribute Coins in Binary Tree

In this problem, we are given a binary tree where every node contains some number of coins. The total number of coins across the entire tree is exactly equal to the number of nodes in the tree.

leetcodemediumtreedepth-first-searchbinary-tree
LeetCode 771 - Jewels and Stones

In this problem, we are given two strings, jewels and stones. The string jewels represents all stone types that are considered jewels. Each character is a unique jewel type. For example, if jewels = "aA", then both lowercase 'a' and uppercase 'A' are jewel types.

leetcodeeasyhash-tablestring
CF 24B - F1 Champions

We are given the results of an entire Formula One season. Each race lists drivers from first place to last place. The championship winner depends on one of two ranking systems.

codeforcescompetitive-programmingimplementation
LeetCode 1147 - Longest Chunked Palindrome Decomposition

The problem asks us to decompose a given string text into the largest possible number of contiguous substrings such that the sequence of substrings forms a palindromic pattern.

leetcodehardtwo-pointersstringdynamic-programminggreedyrolling-hashhash-function
CF 75E - Ship's Shortest Path

We are given two points in the plane, the ship's starting position and destination, together with a convex polygon representing an island. Moving through the sea costs 1 per unit distance. Moving through the interior of the island costs 2 per unit distance.

codeforcescompetitive-programminggeometryshortest-paths
LeetCode 1584 - Min Cost to Connect All Points

This problem asks us to connect all given points on a 2D plane with the minimum possible total cost. Each point is repre

leetcodemediumarrayunion-findgraph-theoryminimum-spanning-tree
LeetCode 956 - Tallest Billboard

This problem asks us to split a collection of steel rods into two groups such that both groups have exactly the same total height. Among all possible equal-height pairs, we want the maximum achievable height. Each rod can be used in one of three ways: 1.

leetcodehardarraydynamic-programming
LeetCode 20 - Valid Parentheses

The problem gives a string containing only six possible characters: (, ), {, }, [ and ]. Each opening bracket must eventually be matched with the correct closing bracket, and the order of matching matters.

leetcodeeasystringstack
LeetCode 137 - Single Number II

This problem asks us to find a unique number in an array where every other number appears exactly three times. In simpler terms, if you imagine counting all the numbers in the array, every number except one will show up three times, and our task is to identify the number that…

leetcodemediumarraybit-manipulation
LeetCode 304 - Range Sum Query 2D - Immutable

The problem asks us to design a data structure that can efficiently answer multiple rectangular sum queries on a fixed 2D matrix.

leetcodemediumarraydesignmatrixprefix-sum
CF 101D - Castle

We are given a weighted tree rooted at hall 1, where Gerald starts. The treasure is hidden uniformly at random in one of the other halls. Gerald only discovers the treasure when he first enters the correct hall.

codeforcescompetitive-programmingdpgreedyprobabilitiessortingstrees
LeetCode 685 - Redundant Connection II

The problem asks us to identify a redundant edge in a directed graph that originated as a rooted tree. A rooted tree has a single root with all other nodes having exactly one parent.

leetcodeharddepth-first-searchbreadth-first-searchunion-findgraph-theory
LeetCode 1326 - Minimum Number of Taps to Open to Water a Garden

The problem describes a one-dimensional garden that stretches from position 0 to position n. At every integer position i, there is a tap that may water some interval around it.

leetcodehardarraydynamic-programminggreedy
LeetCode 511 - Game Play Analysis I

This problem asks us to determine the first day each player logged into a game based on a table called Activity. Each row of this table contains a playerid, the deviceid used, the eventdate on which the player logged in, and the number of gamesplayed during that session.

leetcodeeasydatabase
CF 23A - You're Given a String...

We are given a string of lowercase letters, and the task is to find the length of the longest substring that occurs at least twice in the string. The repeated occurrences may overlap. The input is a single string of at most 100 characters.

codeforcescompetitive-programmingbrute-forcegreedy
CF 67A - Partial Teacher

We have a line of students, and for every adjacent pair we know only the relative order of their marks. If the relation character between positions i and i + 1 is: - L, then student i must receive strictly more toffees than student i + 1 - R, then student i + 1 must receive…

codeforcescompetitive-programmingdpgraphsgreedyimplementation
LeetCode 670 - Maximum Swap

The problem asks us to take an integer num and find the maximum number we can create by swapping at most two digits. In other words, we can pick two positions in the number, swap their digits, and we want the resulting number to be as large as possible.

leetcodemediummathgreedy
LeetCode 735 - Asteroid Collision

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

leetcodemediumarraystacksimulation
LeetCode 1332 - Remove Palindromic Subsequences

The problem gives us a string s that contains only the characters 'a' and 'b'. In one operation, we are allowed to remov

leetcodeeasytwo-pointersstring
LeetCode 1205 - Monthly Transactions II

This problem asks us to generate a monthly financial summary for each country using information from two database tables: Transactions and Chargebacks. The Transactions table stores incoming transactions.

leetcodemediumdatabase
CF 23D - Tetragon

We are given three points in the plane. Each point is the midpoint of one side of an unknown strictly convex quadrilateral, and all four sides of that quadrilateral have equal length.

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

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

leetcodemediumarrayhash-tablegreedycounting