brain

tamnd's digital brain — notes, problems, research

42657 notes

LeetCode 1777 - Product's Price for Each Store

The problem provides a table named Products, where each row represents the price of a specific product in a specific store.

leetcodeeasydatabase
LeetCode 416 - Partition Equal Subset Sum

The problem asks whether an array of positive integers can be divided into two subsets such that both subsets have exactly the same sum. Suppose the total sum of all numbers in the array is S.

leetcodemediumarraydynamic-programming
LeetCode 937 - Reorder Data in Log Files

In this problem, we are given a list of log strings. Each log contains an identifier followed by one or more words separated by spaces. The first token is always the identifier, and everything after it represents the content of the log.

leetcodemediumarraystringsorting
LeetCode 434 - Number of Segments in a String

The problem asks us to count how many separate word-like groups exist inside a string. In this problem, a "segment" is defined as a continuous sequence of characters that are not spaces.

leetcodeeasystring
LeetCode 161 - One Edit Distance

The problem asks us to determine whether two strings are exactly one edit apart. An edit can be one of three operations: 1. Insert a single character 2. Delete a single character 3. Replace one character with a different character The key detail is the word exactly.

leetcodemediumtwo-pointersstring
LeetCode 1096 - Brace Expansion II

The problem asks us to interpret a string expression representing a set of words generated according to a specific grammar and return all distinct words sorted in lexicographical order. The expression can contain lowercase letters, curly braces {}, and commas ,.

leetcodehardhash-tablestringbacktrackingstackbreadth-first-searchsorting
LeetCode 1380 - Lucky Numbers in a Matrix

This problem asks us to identify all lucky numbers in a given matrix. A lucky number is defined as a value that satisfie

leetcodeeasyarraymatrix
LeetCode 1508 - Range Sum of Sorted Subarray Sums

The problem requires calculating the sum of a subrange of all possible contiguous subarray sums of a given array nums.

leetcodemediumarraytwo-pointersbinary-searchsortingprefix-sum
LeetCode 1061 - Lexicographically Smallest Equivalent String

Here is the complete, detailed technical solution guide for LeetCode 1061 following your exact formatting requirements.

leetcodemediumstringunion-find
LeetCode 1281 - Subtract the Product and Sum of Digits of an Integer

The problem asks us to compute a simple mathematical transformation on the digits of an integer. Given an integer n, we

leetcodeeasymath
LeetCode 1443 - Minimum Time to Collect All Apples in a Tree

The problem is asking for the minimum time required to collect all apples in a tree, where each edge traversal takes 1 s

leetcodemediumhash-tabletreedepth-first-searchbreadth-first-search
LeetCode 513 - Find Bottom Left Tree Value

The problem asks us to find the leftmost value in the last row of a binary tree. A binary tree is a hierarchical data structure where each node has at most two children: a left child and a right child.

leetcodemediumtreedepth-first-searchbreadth-first-searchbinary-tree
CF 123E - Maze

We are given a tree, and two independent probability distributions over its vertices. One distribution chooses the starting vertex of a DFS, the other chooses the target vertex where the search stops.

codeforcescompetitive-programmingdfs-and-similardpprobabilitiestrees
CF 48G - Galaxy Union

We are given an undirected weighted graph with exactly n vertices and n edges. Since a connected graph with n vertices and n edges contains exactly one cycle, the graph is a unicyclic graph, a tree with one extra edge.

codeforcescompetitive-programmingdptreestwo-pointers
CF 119A - Epic Game

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

codeforcescompetitive-programmingimplementation
LeetCode 1561 - Maximum Number of Coins You Can Get

The problem gives us an array called piles, where each element represents the number of coins in a pile. The length of the array is always divisible by 3, meaning there are exactly 3n piles for some integer n. In every round, three piles are selected.

leetcodemediumarraymathgreedysortinggame-theory
LeetCode 686 - Repeated String Match

The problem asks us to determine the minimum number of times a string a must be repeated such that another string b becomes a substring of the repeated version of a. A substring is a consecutive sequence of characters within a string.

leetcodemediumstringstring-matching
LeetCode 403 - Frog Jump

The problem describes a frog trying to cross a river by jumping across stones placed at specific positions. The input array stones contains the positions of all stones in sorted ascending order. The frog starts on the first stone, which is always at position 0.

leetcodehardarraydynamic-programming
LeetCode 683 - K Empty Slots

Let's go through a complete, detailed technical solution guide for LeetCode 683 - K Empty Slots following your formatting instructions. The problem asks us to find the earliest day when there are exactly k bulbs turned off between two bulbs that are turned on.

leetcodehardarraybinary-indexed-treesegment-treequeuesliding-windowheap-(priority-queue)ordered-setmonotonic-queue
LeetCode 151 - Reverse Words in a String

The problem asks us to take a string s containing words separated by spaces and return a new string where the words appear in reverse order. A word is defined as any sequence of non-space characters, and words can be separated by multiple spaces.

leetcodemediumtwo-pointersstring
CF 44G - Shooting Gallery

The problem can be restated as simulating bullets flying along the positive _Z_ axis at given coordinates on a 2D shooting plane (_XOY_). Each bullet may hit one of multiple rectangular targets floating at distinct heights along the _Z_ axis.

codeforcescompetitive-programmingdata-structuresimplementation
LeetCode 1833 - Maximum Ice Cream Bars

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

leetcodemediumarraygreedysortingcounting-sort
LeetCode 1408 - String Matching in an Array

You included two different problems in one message, and the second problem (LeetCode 1408) appears to replace the first

leetcodeeasyarraystringstring-matching
LeetCode 1436 - Destination City

In this problem, we are given a list of directed paths between cities. Each entry in paths has the form [cityA, cityB],

leetcodeeasyarrayhash-tablestring
LeetCode 1581 - Customer Who Visited but Did Not Make Any Transactions

The problem gives us two database tables, Visits and Transactions. The Visits table records every time a customer visite

leetcodeeasydatabase
LeetCode 745 - Prefix and Suffix Search

The problem asks us to design a data structure that supports efficient searches based on both a prefix and a suffix. We are given an array of words, where each word has an implicit index based on its position in the array. The WordFilter class must support two operations: 1.

leetcodehardarrayhash-tablestringdesigntrie
LeetCode 1208 - Get Equal Substrings Within Budget

The problem asks us to determine the longest contiguous substring of s that can be transformed into the corresponding substring of t without exceeding a given budget, maxCost.

leetcodemediumstringbinary-searchsliding-windowprefix-sum
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
LeetCode 1727 - Largest Submatrix With Rearrangements

The problem gives us a binary matrix, meaning every cell contains either 0 or 1. We are allowed to rearrange the columns of the matrix in any order we want.

leetcodemediumarraygreedysortingmatrix
CF 106E - Space Rescuers

We are asked to place a space rescue station in three-dimensional space such that the maximum distance from it to any of the given planets is minimized. Each planet is represented by its coordinates $(x, y, z)$.

codeforcescompetitive-programminggeometryternary-search
LeetCode 1814 - Count Nice Pairs in an Array

The problem gives us an array of non-negative integers called nums. We need to count how many index pairs (i, j) satisfy the following conditions: - i < j - nums[i] + rev(nums[j]) == nums[j] + rev(nums[i]) Here, rev(x) means reversing the digits of the integer.

leetcodemediumarrayhash-tablemathcounting
LeetCode 762 - Prime Number of Set Bits in Binary Representation

The problem requires counting the numbers within a given inclusive range [left, right] that have a prime number of set bits in their binary representation. The set bits of a number refer to the number of 1s in its binary representation.

leetcodeeasymathbit-manipulation
LeetCode 526 - Beautiful Arrangement

The problem asks us to count how many permutations of the integers from 1 to n satisfy a special divisibility condition. A permutation is an arrangement of all numbers from 1 to n where every number appears exactly once.

leetcodemediumarraydynamic-programmingbacktrackingbit-manipulationbitmask
LeetCode 963 - Minimum Area Rectangle II

The problem gives us a collection of unique points on a 2D plane. Our task is to determine the minimum possible area of any rectangle that can be formed using exactly four of these points as vertices.

leetcodemediumarrayhash-tablemathgeometry
CF 81B - Sequence Formatting

We are given a messy textual representation of a sequence. The string may contain positive integers, commas, spaces, and the special token .... Spaces may appear in the wrong places or appear multiple times. The task is purely formatting.

codeforcescompetitive-programmingimplementationstrings
LeetCode 1421 - NPV Queries

The problem presents two database tables: NPV and Queries. The NPV table contains historical net present value (NPV) dat

leetcodeeasydatabase
LeetCode 331 - Verify Preorder Serialization of a Binary Tree

The problem gives us a string that represents the preorder serialization of a binary tree. Each value is separated by commas. A normal integer represents a real tree node, while the character '' represents a null pointer.

leetcodemediumstringstacktreebinary-tree
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 485 - Max Consecutive Ones

The problem gives us a binary array named nums, where every element is either 0 or 1. Our task is to determine the maximum number of consecutive 1s that appear anywhere in the array.

leetcodeeasyarray
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
LeetCode 1350 - Students With Invalid Departments

This problem asks us to identify students who are enrolled in university departments that no longer exist in the departm

leetcodeeasydatabase
LeetCode 653 - Two Sum IV - Input is a BST

This problem gives us the root of a Binary Search Tree (BST) and an integer k. We must determine whether there are two distinct nodes in the tree whose values add up to k.

leetcodeeasyhash-tabletwo-pointerstreedepth-first-searchbreadth-first-searchbinary-search-treebinary-tree
CF 65E - Harry Potter and Moving Staircases

We are given an undirected multigraph. Floors are vertices, staircases are edges. Harry starts at floor 1 and wants to visit every floor at least once. The graph is dynamic. Between Harry's walks, Ron and Hermione may modify staircases.

codeforcescompetitive-programmingdfs-and-similarimplementation
CF 61D - Eternal Victory

We are asked to find the minimum distance Shapur must travel to visit all cities at least once. The cities are connected in a tree structure, meaning there are exactly $n-1$ bidirectional roads and a unique path between any two cities.

codeforcescompetitive-programmingdfs-and-similargraphsgreedyshortest-pathstrees
LeetCode 250 - Count Univalue Subtrees

The problem asks us to count how many subtrees in a binary tree are "uni-value" subtrees. A uni-value subtree is a subtree in which every node has the same value. A subtree consists of a node together with all of its descendants.

leetcodemediumtreedepth-first-searchbinary-tree
LeetCode 1015 - Smallest Integer Divisible by K

The problem asks us to find the length of the smallest positive integer that satisfies two conditions: 1. The integer contains only the digit 1 2. The integer is divisible by k Such numbers are commonly called repunits.

leetcodemediumhash-tablemath
CF 82D - Two out of Three

We are asked to simulate a queue of customers, where each customer has a known service time. The cashier can serve two people simultaneously, and the time to serve two people at once is the maximum of their individual times.

codeforcescompetitive-programmingdp
CF 92B - Binary Number

The task is to take a positive integer represented in binary and determine how many steps it takes to reduce it to 1 using a simple iterative process. In each step, if the number is odd, we increment it by 1, and if it is even, we divide it by 2.

codeforcescompetitive-programminggreedy
CF 89C - Chip Play

We have a grid containing chips. Every chip stores one direction, left, right, up, or down. When we start a move from some chip, the process behaves like this: The current chip looks in the direction of its arrow.

codeforcescompetitive-programmingbrute-forcedata-structuresimplementation
LeetCode 469 - Convex Polygon

The problem gives us a sequence of points on a 2D plane. These points are connected in order, and the final point connects back to the first point, forming a polygon. Our task is to determine whether that polygon is convex.

leetcodemediumarraymathgeometry
LeetCode 838 - Push Dominoes

This problem models a chain reaction of falling dominoes. We are given a string where each character represents the initial state of a domino in a row. A domino can be in one of three states: - 'L' means the domino has been pushed to the left.

leetcodemediumtwo-pointersstringdynamic-programming
CF 45I - TCMCF+++

We are given a list of integers representing problem scores in a contest. A contestant may solve any non-empty subset of these problems, and the final score becomes the product of all chosen values.

codeforcescompetitive-programminggreedy
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
LeetCode 80 - Remove Duplicates from Sorted Array II

This problem asks us to modify a sorted integer array in-place so that every unique value appears at most twice. Since the array is already sorted in non-decreasing order, duplicate values will always appear next to each other, which is a very important property that makes an…

leetcodemediumarraytwo-pointers
CF 30C - Shooting Gallery

We are asked to help King Copa maximize his expected number of hits in a shooting gallery. The gallery is represented as a 2D plane, and each target appears at a specific point exactly at a specific time and disappears immediately afterward.

codeforcescompetitive-programmingdpprobabilities
LeetCode 2029 - Stone Game IX

The problem describes a turn-based game between Alice and Bob with a row of stones, each having a numeric value. On each turn, a player removes any stone of their choice.

leetcodemediumarraymathgreedycountinggame-theory
LeetCode 1131 - Maximum of Absolute Value Expression

The problem gives us two integer arrays, arr1 and arr2, both having the same length. We must compute the maximum possible value of the following expression across every pair of indices (i, j): The task is not asking for the indices themselves, only the largest achievable value.

leetcodemediumarraymath
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 431 - Encode N-ary Tree to Binary Tree

This problem asks us to design a reversible transformation between two different tree structures: - An N-ary tree, where each node can have any number of children - A binary tree, where each node has at most two children The important requirement is not how the encoding looks…

leetcodehardtreedepth-first-searchbreadth-first-searchdesignbinary-tree
LeetCode 617 - Merge Two Binary Trees

This problem asks us to combine two binary trees into a single merged tree. Each tree consists of nodes where every node contains a value and pointers to a left and right child.

leetcodeeasytreedepth-first-searchbreadth-first-searchbinary-tree
LeetCode 945 - Minimum Increment to Make Array Unique

This problem asks us to take an integer array nums and perform a series of increment operations so that every element in the array becomes unique. An increment operation increases an element by exactly 1. The goal is to compute the minimum number of such moves required.

leetcodemediumarraygreedysortingcounting
CF 127A - Wasted Time

Scrooge signs papers by moving a pen along a polyline. The signature starts at the first point, then draws straight segments between consecutive points until the last point is reached.

codeforcescompetitive-programminggeometry
LeetCode 586 - Customer Placing the Largest Number of Orders

The problem gives us a database table named Orders with two columns: Column Meaning --- --- ordernumber Unique identifier for an order customernumber Identifier for the customer who placed the order Each row represents a single order placed by a customer.

leetcodeeasydatabase
CF 54A - Presents

We are asked to estimate the minimum number of presents the Hedgehog will receive over the next N days. He has two rules governing present reception: every holiday he receives a gift, and he cannot go more than K days without receiving one.

codeforcescompetitive-programmingimplementation
LeetCode 489 - Robot Room Cleaner

This problem is an interactive backtracking problem where we must control a robot without directly seeing the room layout. Unlike traditional grid traversal problems, we are not given access to the actual room matrix during execution.

leetcodehardbacktrackinginteractive
LeetCode 917 - Reverse Only Letters

The problem asks us to reverse only the English letters in a string while keeping all non-letter characters fixed in their original positions. In other words, letters move, but symbols, digits, and punctuation marks stay exactly where they started.

leetcodeeasytwo-pointersstring
LeetCode 60 - Permutation Sequence

The problem gives us the numbers from 1 to n, and asks us to find the kth permutation when all possible permutations are ordered lexicographically.

leetcodehardmathrecursion
LeetCode 796 - Rotate String

The problem asks us to determine whether one string can be transformed into another string using repeated left rotations. A single shift operation removes the first character of the string and appends it to the end.

leetcodeeasystringstring-matching
LeetCode 792 - Number of Matching Subsequences

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

leetcodemediumarrayhash-tablestringbinary-searchdynamic-programmingtriesorting
LeetCode 1048 - Longest String Chain

That is a long, structured technical guide that will exceed a practical single-message limit if done comprehensively with all requested sections, detailed walkthroughs, Python and Go solutions, worked examples, full test suite, and edge case analysis.

leetcodemediumarrayhash-tabletwo-pointersstringdynamic-programmingsorting
LeetCode 1006 - Clumsy Factorial

The problem asks us to compute a clumsy factorial for a given positive integer n. A standard factorial multiplies all integers from n down to 1, but the clumsy factorial modifies the operations: instead of multiplying all numbers, it cycles through '', '/', '+', and '-' in…

leetcodemediummathstacksimulation
LeetCode 1092 - Shortest Common Supersequence

The problem asks us to construct the shortest possible string that contains both str1 and str2 as subsequences. A subsequence does not require characters to appear contiguously. Instead, the characters only need to appear in the same relative order.

leetcodehardstringdynamic-programming
CF 73C - LionAge II

We are given a string representing a character's name in a game, and we can change at most k of its letters to maximize a score called euphony. The euphony is computed as the sum of bonuses for every consecutive pair of letters in the string.

codeforcescompetitive-programmingdp
LeetCode 76 - Minimum Window Substring

The problem asks us to find the smallest contiguous substring inside string s that contains every character from string t, including duplicate occurrences. A substring must consist of consecutive characters. We are not allowed to reorder characters or skip positions.

leetcodehardhash-tablestringsliding-window
LeetCode 1351 - Count Negative Numbers in a Sorted Matrix

The problem asks us to count all the negative numbers in a 2D matrix grid where each row and column is sorted in non-inc

leetcodeeasyarraybinary-searchmatrix
LeetCode 1628 - Design an Expression Tree With Evaluate Function

The problem requires constructing a binary expression tree from a postfix arithmetic expression and implementing a metho

leetcodemediumarraymathstacktreedesignbinary-tree
LeetCode 548 - Split Array with Equal Sum

The problem asks us to determine whether an integer array nums can be split into four non-empty subarrays with equal sums by selecting three indices i, j, and k that satisfy strict ordering constraints: 0 < i, i + 1 < j, j + 1 < k < n - 1.

leetcodehardarrayhash-tableprefix-sum
CF 85C - Petya and Tree

We are given a valid binary search tree where every internal node has exactly two children. Each node stores a unique key. We are also given several query keys that are guaranteed not to appear in the tree. A normal BST search starts at the root.

codeforcescompetitive-programmingbinary-searchdfs-and-similarprobabilitiessortingstrees
CF 48H - Black and White

We are asked to tile an rectangular floor with three types of 2x2 square tiles: black, white, and mixed tiles that have a black and a white section in a diagonal pattern.

codeforcescompetitive-programmingconstructive-algorithms
LeetCode 1042 - Flower Planting With No Adjacent

The problem presents n gardens, labeled from 1 to n, and a list of bidirectional paths connecting pairs of gardens. Each garden must be planted with one of four types of flowers (1 through 4).

leetcodemediumdepth-first-searchbreadth-first-searchgraph-theory
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 1245 - Tree Diameter

The problem asks us to find the diameter of a tree, which is defined as the number of edges in the longest path between any two nodes. We are given an undirected tree represented as a list of edges. Each edge connects two nodes, labeled from 0 to n - 1.

leetcodemediumtreedepth-first-searchbreadth-first-searchgraph-theorytopological-sort
LeetCode 1789 - Primary Department for Each Employee

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

leetcodeeasydatabase
LeetCode 778 - Swim in Rising Water

In this problem, we are given an n x n grid where each cell contains a unique integer representing its elevation. Rain begins falling, and the water level rises over time.

leetcodehardarraybinary-searchdepth-first-searchbreadth-first-searchunion-findheap-(priority-queue)matrix
CF 83E - Two Subsequences

We are given a sequence of binary strings, all of equal length, and we need to split them into two subsequences in a way that minimizes the sum of the lengths of their compressed forms.

codeforcescompetitive-programmingbitmasksdp
LeetCode 1308 - Running Total for Different Genders

The problem is asking us to compute cumulative scores for each gender across different days in a competition. The input

leetcodemediumdatabase
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 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 422 - Valid Word Square

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

leetcodeeasyarraymatrix
LeetCode 1303 - Find the Team Size

This problem provides a database table named Employee, where every row represents a single employee and the team they belong to.

leetcodeeasydatabase
LeetCode 373 - Find K Pairs with Smallest Sums

The problem gives us two sorted integer arrays, nums1 and nums2, and asks us to return the k pairs with the smallest sums. A pair is formed by taking one element from nums1 and one element from nums2.

leetcodemediumarrayheap-(priority-queue)
CF 136A - Presents

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

codeforcescompetitive-programmingimplementation
CF 62B - Tyndex.Brome

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

codeforcescompetitive-programmingbinary-searchimplementation
CF 102A - Clothes

We are asked to find the cheapest way for Gerald to buy three pieces of clothing that all match each other. Each clothing item has a price, and some pairs of items are marked as matching. The input gives us the total number of items, the prices, and a list of matching pairs.

codeforcescompetitive-programmingbrute-force
LeetCode 1660 - Correct a Binary Tree

Here is a complete, detailed technical solution guide for LeetCode 1660 - Correct a Binary Tree, formatted exactly as re

leetcodemediumhash-tabletreedepth-first-searchbreadth-first-searchbinary-tree
CF 122A - Lucky Division

We are asked to determine whether a given number is almost lucky. A number is almost lucky if it is divisible by at least one lucky number. Lucky numbers are positive integers composed entirely of the digits 4 and 7, like 4, 7, 44, 47, 74, and so on.

codeforcescompetitive-programmingbrute-forcenumber-theory
LeetCode 211 - Design Add and Search Words Data Structure

The problem asks us to design a data structure that supports two operations efficiently: 1. Adding words into the structure. 2. Searching for words, where the search pattern may contain the wildcard character '.'. The wildcard '.' represents any single lowercase English letter.

leetcodemediumstringdepth-first-searchdesigntrie
LeetCode 1754 - Largest Merge Of Two Strings

This problem asks us to build the lexicographically largest possible string by repeatedly choosing characters from the front of two given strings.

leetcodemediumtwo-pointersstringgreedy
CF 39G - Inverse Function

We are given the source code of a tiny recursive function f(n) written in a heavily restricted subset of C++. The function only contains sequential if (...) return ...; statements and unconditional return ...; statements.

codeforcescompetitive-programmingimplementation
LeetCode 1664 - Ways to Make a Fair Array

The problem gives us an integer array nums, and asks us to remove exactly one element from the array. After removing that element, the remaining elements shift left, which means their indices may change.

leetcodemediumarrayprefix-sum