brain

tamnd's digital brain — notes, problems, research

42677 notes

CF 31C - Schedule

We are given a list of n lessons, each with a start and end time, scheduled in a single room. Two lessons overlap if one starts before another ends. The goal is to find which single lesson can be removed so that the remaining lessons have no overlaps.

codeforcescompetitive-programmingimplementation
LeetCode 710 - Random Pick with Blacklist

The problem asks us to design a data structure that can repeatedly return a random integer from the range [0, n - 1], while excluding all integers that appear in a blacklist. Every valid number must have exactly the same probability of being chosen.

leetcodehardarrayhash-tablemathbinary-searchsortingrandomized
CF 38B - Chess

We are given the positions of two chess pieces on a standard 8 × 8 board, one rook and one knight. Their starting positions are guaranteed to be safe, meaning the rook does not attack the knight and the knight does not attack the rook.

codeforcescompetitive-programmingbrute-forceimplementationmath
LeetCode 1480 - Running Sum of 1d Array

The problem asks us to compute the running sum, also called the prefix sum, of a one dimensional integer array. For ever

leetcodeeasyarrayprefix-sum
CF 14C - Four Segments

We are given exactly four line segments on the 2D plane. Every segment is axis-aligned, or may even degenerate into a single point.

codeforcescompetitive-programmingbrute-forceconstructive-algorithmsgeometryimplementationmath
LeetCode 1560 - Most Visited Sector in a Circular Track

In this problem, we are given a circular track divided into n sectors, numbered from 1 to n. A marathon runner moves around this track in increasing numerical order, and after sector n, the runner wraps back to sector 1.

leetcodeeasyarraysimulation
CF 75D - Big Maximum Sum

We are given a set of small arrays and a sequence of indexes indicating how to concatenate them into one larger array. Once the large array is built in this way, the goal is to find the maximum sum of a contiguous subarray.

codeforcescompetitive-programmingdata-structuresdpgreedyimplementationmathtrees
LeetCode 657 - Robot Return to Origin

This problem asks us to determine whether a robot, starting at the origin (0, 0) on a 2D plane, returns to the origin after executing a sequence of moves. Each move is represented by a character in a string: 'R' moves right, 'L' moves left, 'U' moves up, and 'D' moves down.

leetcodeeasystringsimulation
LeetCode 580 - Count Student Number in Departments

This problem asks us to determine how many students are enrolled in each department, including departments that currently have no students. We are given two tables: Student and Department.

leetcodemediumdatabase
LeetCode 478 - Generate Random Point in a Circle

This problem asks us to generate random points uniformly inside a circle. The circle is defined by its radius and the coordinates of its center. Every call to randPoint() must return a point [x, y] such that the point lies either inside the circle or exactly on its boundary.

leetcodemediummathgeometryrejection-samplingrandomized
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 2013 - Detect Squares

The problem presents a stream of points in a 2D plane and asks us to design a data structure that supports two operations efficiently: adding points and counting squares.

leetcodemediumarrayhash-tabledesigncountingdata-stream
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 1709 - Biggest Window Between Visits

The UserVisits table stores records of when users visited a retailer. Each row contains a userid and a visitdate. A user may appear multiple times because they can visit on many different days.

leetcodemediumdatabase
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 466 - Count The Repetitions

The problem asks us to find the maximum number of times a string str2 can be obtained from another string str1 when both are repeated multiple times. Specifically, str1 is the string s1 repeated n1 times, and str2 is the string s2 repeated n2 times.

leetcodehardtwo-pointersstringdynamic-programming
LeetCode 555 - Split Concatenated Strings

The problem gives an array of strings, and we must arrange them into a circular concatenation while preserving the original order of the strings. For every individual string, we are allowed to either keep it as-is or reverse it before joining it into the loop.

leetcodemediumarraystringgreedy
LeetCode 288 - Unique Word Abbreviation

The problem asks us to design a data structure that determines whether a word's abbreviation is unique within a given dictionary.

leetcodemediumarrayhash-tablestringdesign
LeetCode 2034 - Stock Price Fluctuation

Here’s a complete, detailed technical solution guide for LeetCode 2034 - Stock Price Fluctuation following your formatting and content requirements. The problem presents a stream of stock price records where each record consists of a timestamp and a price.

leetcodemediumhash-tabledesignheap-(priority-queue)data-streamordered-set
CF 35A - Shell Game

We have three cups arranged in a line, and a ball starts under one of them. The performer performs exactly three swaps. Each swap exchanges the positions of two cups. After all swaps finish, we must determine which cup contains the ball.

codeforcescompetitive-programmingimplementation
LeetCode 877 - Stone Game

The problem describes a two-player game played on an array of stone piles. Each pile contains a positive number of stones, and the piles are arranged in a row. Alice and Bob alternate turns, with Alice always moving first.

leetcodemediumarraymathdynamic-programminggame-theory
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 852 - Peak Index in a Mountain Array

This problem gives us a special type of array called a mountain array. A mountain array strictly increases until it reaches a single peak element, then strictly decreases afterward. In other words, there exists some index i such that: - arr[0] < arr[1] < ...

leetcodemediumarraybinary-search
CF 113D - Museum

We are asked to model the random movements of two friends inside a museum represented as an undirected connected graph with n rooms and m corridors. Each room has a probability of staying in place for a minute, and otherwise the person moves uniformly to a neighboring room.

codeforcescompetitive-programmingmathmatricesprobabilities
CF 41A - Translation

We are given two lowercase strings. The first string is a word in one language, and the second string is supposed to be its translation into another language where every word is written backwards.

codeforcescompetitive-programmingimplementationstrings
LeetCode 271 - Encode and Decode Strings

The problem asks us to design a reversible encoding system for a list of strings. We need two functions: - encode, which converts a list of strings into a single string - decode, which reconstructs the original list from that encoded string The important requirement is that…

leetcodemediumarraystringdesign
LeetCode 183 - Customers Who Never Order

This problem is asking us to identify all customers from a Customers table who have never placed an order according to the Orders table. In other words, we are looking for entries in Customers that do not have a corresponding customerId in the Orders table.

leetcodeeasydatabase
LeetCode 587 - Erect the Fence

This problem is asking us to find the convex hull of a set of points on a 2D plane. The input trees is a list of coordinates where each coordinate [xi, yi] represents the location of a tree in the garden.

leetcodehardarraymathgeometry
LeetCode 1452 - People Whose List of Favorite Companies Is Not a Subset of Another List

The problem requires identifying all people in a group whose list of favorite companies is not a subset of any other per

leetcodemediumarrayhash-tablestring
CF 70E - Information Reform

We are given a country with cities connected by roads such that the road network forms a tree: there is exactly one simple path between any two cities. Each road has equal length in terms of counting the number of edges.

codeforcescompetitive-programmingdpimplementationtrees
LeetCode 581 - Shortest Unsorted Continuous Subarray

The problem gives an integer array nums and asks for the length of the shortest continuous subarray such that, if only that subarray is sorted in non-decreasing order, the entire array becomes sorted.

leetcodemediumarraytwo-pointersstackgreedysortingmonotonic-stack
LeetCode 960 - Delete Columns to Make Sorted III

This problem asks us to find the minimum number of columns to delete from a set of equal-length strings so that each individual string becomes lexicographically sorted.

leetcodehardarraystringdynamic-programming
LeetCode 525 - Contiguous Array

This problem asks us to find the maximum length of a contiguous subarray in a binary array where the number of 0s and 1s are equal. A contiguous subarray means the elements must appear consecutively in the original array. We are not allowed to rearrange elements or skip indices.

leetcodemediumarrayhash-tableprefix-sum
CF 137E - Last Chance

We are given a string s consisting of uppercase and lowercase Latin letters, and we are asked to analyze its substrings according to a specific property: a substring is "good" if the number of vowels it contains is at most twice the number of consonants.

codeforcescompetitive-programmingdata-structuresimplementationstrings
LeetCode 158 - Read N Characters Given read4 II - Call Multiple Times

This problem asks us to implement a read(buf, n) function using a restricted API called read4(buf4). The challenge is that we are not allowed to access the file directly, instead, we can only retrieve data in chunks of up to four characters at a time.

leetcodehardarraysimulationinteractive
LeetCode 1719 - Number Of Ways To Reconstruct A Tree

The problem provides an array of pairs, where each pair [xi, yi] indicates that xi is either an ancestor of yi or yi is an ancestor of xi in a rooted tree. The key challenge is to determine how many different rooted trees satisfy all given pairs.

leetcodehardarrayhash-tabletreegraph-theorysimulation
LeetCode 415 - Add Strings

The problem asks us to add two non-negative integers where each integer is given as a string instead of a numeric type. The goal is to return the resulting sum as another string. For example, if the inputs are "11" and "123", we should return "134".

leetcodeeasymathstringsimulation
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
LeetCode 320 - Generalized Abbreviation

This problem asks us to generate every possible generalized abbreviation of a given word. A generalized abbreviation is created by replacing some characters in the string with their count, while preserving the order of the remaining characters.

leetcodemediumstringbacktrackingbit-manipulation
LeetCode 1490 - Clone N-ary Tree

This problem asks us to create a deep copy of an N-ary tree. An N-ary tree is a tree where each node can have zero or mo

leetcodemediumhash-tabletreedepth-first-searchbreadth-first-search
CF 130A - Hexagonal numbers

We need to compute the $n$-th hexagonal number. The sequence is defined by the formula $$hn = 2n^2 - n$$ The input contains a single integer $n$, and the output is the value produced by this formula.

codeforcescompetitive-programming*specialimplementation
CF 116A - Tram

We have a single tram traveling along a line with n stops, starting empty at the first stop and ending empty at the last stop. At each stop, a certain number of passengers exit before any new passengers enter.

codeforcescompetitive-programmingimplementation
LeetCode 404 - Sum of Left Leaves

The problem gives us the root node of a binary tree and asks us to compute the sum of all left leaves in the tree. A binary tree node may have up to two children, a left child and a right child.

leetcodeeasytreedepth-first-searchbreadth-first-searchbinary-tree
LeetCode 1587 - Bank Account Summary II

This problem asks us to analyze banking transaction data and determine which users currently have a balance greater than 10000. We are given two database tables: The Users table stores account information.

leetcodeeasydatabase
LeetCode 1255 - Maximum Score Words Formed by Letters

This problem asks us to select a subset of words that can be constructed using a limited supply of letters, such that th

leetcodehardarrayhash-tablestringdynamic-programmingbacktrackingbit-manipulationcountingbitmask
LeetCode 1358 - Number of Substrings Containing All Three Characters

The problem asks us to count all substrings of a given string s that contain at least one occurrence of each character '

leetcodemediumhash-tablestringsliding-window
LeetCode 875 - Koko Eating Bananas

The problem asks us to determine the minimum eating speed k for Koko such that she can finish all piles of bananas within a given number of hours h.

leetcodemediumarraybinary-search
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 2120 - Execution of All Suffix Instructions Staying in a Grid

The problem asks us to simulate a robot moving on an n x n grid, starting from a specified position startPos = [startrow, startcol].

leetcodemediumstringsimulation
CF 137C - History

Each historical event is represented by a time interval [a, b], where a is the starting year and b is the ending year. One event is considered contained inside another if it starts later and ends earlier.

codeforcescompetitive-programmingsortings
LeetCode 736 - Parse Lisp Expression

The problem asks us to evaluate a Lisp-like expression represented as a string. The expression can contain integers, variables, and three special operations: let, add, and mult. An expression evaluates to a single integer value.

leetcodehardhash-tablestringstackrecursion
LeetCode 1311 - Get Watched Videos by Your Friends

This problem models a social network as an undirected graph. Each person is represented by an integer ID from 0 to n - 1

leetcodemediumarrayhash-tablebreadth-first-searchgraph-theorysorting
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 3054 - Binary Tree Nodes

This problem asks us to classify nodes in a binary tree based on their role in the tree structure. The input is represen

leetcodemediumdatabase
CF 8A - Train and Peter

We are given a string that represents the sequence of station flags seen while traveling from city A to city B. Peter woke up twice during the trip and wrote down two substrings he saw, in chronological order.

codeforcescompetitive-programmingstrings
LeetCode 1385 - Find the Distance Value Between Two Arrays

The problem is asking us to compute the distance value between two arrays arr1 and arr2 given a threshold d. Specificall

leetcodeeasyarraytwo-pointersbinary-searchsorting
LeetCode 397 - Integer Replacement

The problem gives us a positive integer n and asks for the minimum number of operations required to transform it into 1.

leetcodemediumdynamic-programminggreedybit-manipulationmemoization
LeetCode 45 - Jump Game II

The problem gives an array nums where each value represents the maximum distance you can jump forward from that position. You start at index 0, and your goal is to reach the final index using the minimum number of jumps possible.

leetcodemediumarraydynamic-programminggreedy
LeetCode 841 - Keys and Rooms

This problem can be interpreted as a graph traversal challenge. Each room is a node in a graph labeled from 0 to n-1, and the keys inside a room represent directed edges to other nodes that can be unlocked.

leetcodemediumdepth-first-searchbreadth-first-searchgraph-theory
CF 47B - Coins

We have three coins labeled A, B, and C. Every pair of coins has already been compared once using a balance scale, and each comparison tells us which coin is heavier.

codeforcescompetitive-programmingimplementation
CF 1A - Theatre Square

We are given a rectangular plaza, the Theatre Square, with dimensions _n_ meters in length and _m_ meters in width. The city wants to pave the entire area with square flagstones of side _a_.

codeforcescompetitive-programmingmath
LeetCode 220 - Contains Duplicate III

The problem asks whether there exists a pair of different indices (i, j) in the array such that two conditions are satisfied at the same time. The first condition is about index distance: This means the two elements must be relatively close together in the array.

leetcodehardarraysliding-windowsortingbucket-sortordered-set
LeetCode 252 - Meeting Rooms

The problem provides a list of meeting intervals, where each interval is represented as [start, end]. Each pair describes the start time and end time of a meeting. The task is to determine whether a single person can attend every meeting without any scheduling conflicts.

leetcodeeasyarraysorting
LeetCode 668 - Kth Smallest Number in Multiplication Table

The problem gives us an m x n multiplication table where each cell contains the product of its row index and column index, using 1-based indexing. That means the value at position (i, j) is simply i j.

leetcodehardmathbinary-search
LeetCode 927 - Three Equal Parts

The problem asks us to partition a binary array arr into three non-empty contiguous segments such that each segment, when interpreted as a binary number (allowing leading zeros), is equal to the other two segments.

leetcodehardarraymath
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 59 - Spiral Matrix II

The problem asks us to generate an n x n matrix and fill it with numbers from 1 to n^2 in spiral order. A spiral order traversal means we begin at the top-left corner and move in a clockwise pattern: 1. Move left to right across the top row 2.

leetcodemediumarraymatrixsimulation
LeetCode 298 - Binary Tree Longest Consecutive Sequence

The problem asks us to find the length of the longest consecutive sequence path in a binary tree, where a consecutive sequence path is defined as a path in which the values increase by exactly one from parent to child.

leetcodemediumtreedepth-first-searchbinary-tree
CF 52B - Right Triangles

We are given a rectangular grid where each cell is either empty or marked with . Every cell represents a point located at the center of that cell. We need to count how many right triangles can be formed such that:

codeforcescompetitive-programmingcombinatorics
LeetCode 1625 - Lexicographically Smallest String After Applying Operations

The problem gives us a numeric string s of even length and two operations that can be performed any number of times in a

leetcodemediumstringdepth-first-searchbreadth-first-searchenumeration
CF 66C - Petya and File System

Each input line describes the full path of one file inside a file system. A path looks like: The disk name is the root and is not considered a folder. Every component between the disk and the file is a folder. The last component is always a file.

codeforcescompetitive-programmingdata-structuresimplementation
LeetCode 1035 - Uncrossed Lines

The problem gives us two integer arrays, nums1 and nums2. We are allowed to draw lines between matching values in the two arrays, but with an important restriction: the lines cannot cross each other. A line can only connect nums1[i] with nums2[j] when the values are equal.

leetcodemediumarraydynamic-programming
CF 55B - Smallest number

We start with four integers on the board. We also know the exact sequence of three operations that must be applied, where each operation is either addition or multiplication.

codeforcescompetitive-programmingbrute-force
LeetCode 1178 - Number of Valid Words for Each Puzzle

The problem asks us to determine, for each given puzzle string, how many words from a given list words are valid for that puzzle. A word is valid for a puzzle if it contains the first character of the puzzle and all characters of the word are also present in the puzzle.

leetcodehardarrayhash-tablestringbit-manipulationtrie
LeetCode 1000 - Minimum Cost to Merge Stones

The problem asks us to merge n piles of stones into a single pile under a very specific merging rule. Each pile is represented as an integer in the array stones, where stones[i] is the number of stones in the i-th pile.

leetcodehardarraydynamic-programmingprefix-sum
CF 89A - Robbery

The bank stores diamonds in a row of cells. After every minute, the security system checks the sums of every adjacent pair: $$a1 + a2, a2 + a3, dots, a{n-1} + an$$ If any of these sums changes compared to the previous check, the alarm triggers.

codeforcescompetitive-programminggreedy
LeetCode 2021 - Brightest Position on Street

The problem asks us to find the position on a straight street that is illuminated by the largest number of street lamps, which is referred to as its brightness.

leetcodemediumarraysortingprefix-sumordered-set
LeetCode 1840 - Maximum Building Height

This problem asks us to construct heights for n buildings arranged in a straight line while satisfying several constraints. Each building has a non-negative integer height. Building 1 must always have height 0.

leetcodehardarraymathsorting
LeetCode 1779 - Find Nearest Point That Has the Same X or Y Coordinate

The problem gives your current position on a 2D Cartesian grid as (x, y) and a list of other points. Each point is represented as [ai, bi].

leetcodeeasyarray
LeetCode 1458 - Max Dot Product of Two Subsequences

The problem is asking to find the maximum dot product of two non-empty subsequences of arrays nums1 and nums2 such that

leetcodehardarraydynamic-programming
LeetCode 947 - Most Stones Removed with Same Row or Column

The problem gives us a collection of stones placed on a 2D grid. Each stone occupies a unique coordinate (x, y). A stone can be removed only if there is at least one other stone that shares either the same row or the same column.

leetcodemediumhash-tabledepth-first-searchunion-findgraph-theory
LeetCode 270 - Closest Binary Search Tree Value

The problem gives us the root of a Binary Search Tree, abbreviated as BST, and a floating point target value. Our task is to return the integer value stored in the BST that is numerically closest to the target.

leetcodeeasybinary-searchtreedepth-first-searchbinary-search-treebinary-tree
LeetCode 37 - Sudoku Solver

The problem asks us to build a complete Sudoku solver. We are given a partially filled 9 x 9 grid where each cell contains either a digit from '1' to '9' or the character '.', which represents an empty space.

leetcodehardarrayhash-tablebacktrackingmatrix
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 501 - Find Mode in Binary Search Tree

This problem asks us to find the mode(s) in a Binary Search Tree (BST). A mode is the value that appears most frequently in the tree. Since duplicates are allowed in this BST definition, a value may occur multiple times. The input is the root node of a BST.

leetcodeeasytreedepth-first-searchbinary-search-treebinary-tree
LeetCode 1243 - Array Transformation

The problem requires simulating the transformation of an array over consecutive days according to a simple local rule. Each day, every element of the array (except the first and last) is compared with its immediate neighbors.

leetcodeeasyarraysimulation
LeetCode 523 - Continuous Subarray Sum

The problem asks us to determine whether an array contains a continuous subarray whose sum is a multiple of k, while also satisfying an important constraint: the subarray must contain at least two elements.

leetcodemediumarrayhash-tablemathprefix-sum
LeetCode 1333 - Filter Restaurants by Vegan-Friendly, Price and Distance

The problem is asking us to filter and sort a list of restaurants based on multiple criteria. Each restaurant is represe

leetcodemediumarraysorting
LeetCode 1793 - Maximum Score of a Good Subarray

In this problem, we are given an integer array nums and a specific index k. We must find a contiguous subarray that contains index k, and among all such subarrays, maximize the following score: The minimum element inside the chosen subarray determines the limiting value of the…

leetcodehardarraytwo-pointersbinary-searchstackmonotonic-stack
LeetCode 390 - Elimination Game

The problem gives us a sorted list containing every integer from 1 to n. We repeatedly eliminate numbers in alternating directions until only one number remains.

leetcodemediummathrecursion
CF 74E - Shift It!

We have a 6 × 6 board containing the characters 0-9 and A-Z, each appearing exactly once. The target configuration is fixed: characters must appear in row-major order. The only allowed moves are cyclic shifts of complete rows or complete columns.

codeforcescompetitive-programmingconstructive-algorithms
CF 62C - Inquisition

We are given up to 100 triangles on the plane. Each triangle represents a black spot on a white square. Triangles may overlap, intersect, or even completely cover one another. The task is to compute the perimeter of the union of all black regions.

codeforcescompetitive-programminggeometryimplementationsortings
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
CF 86C - Genetic engineering

We are given several short DNA fragments over the alphabet {A, C, G, T}. A longer DNA string is considered valid if every position of the string belongs to at least one occurrence of one of the given fragments. The fragments may overlap arbitrarily.

codeforcescompetitive-programmingdpstring-suffix-structurestrees
LeetCode 1184 - Distance Between Bus Stops

In this problem, we are given a circular bus route with n stops numbered from 0 to n - 1. The array distance describes the distance between neighboring stops. Specifically, distance[i] represents the distance from stop i to stop (i + 1) % n.

leetcodeeasyarray
CF 17B - Hierarchy

We have employees and directed supervisor offers between them. An offer (a, b, c) means employee a is willing to supervise employee b for cost c. Qualifications are strictly decreasing along every offer, so q[a] > q[b].

codeforcescompetitive-programmingdfs-and-similardsugreedyshortest-paths
CF 73B - Need For Brake

We know the current championship standings before the final race. Every racer already has some number of points, and the last race distributes additional points to the top m finishers.

codeforcescompetitive-programmingbinary-searchgreedysortings
LeetCode 1733 - Minimum Number of People to Teach

This problem models communication in a social network where each user knows one or more languages. Two users can communicate directly if they share at least one common language.

leetcodemediumarrayhash-tablegreedy
LeetCode 1106 - Parsing A Boolean Expression

The problem asks us to evaluate a boolean expression represented as a string. The expression can contain the literals 't' and 'f' for true and false, as well as three types of operators: logical NOT '!', logical AND '&', and logical OR ''. Each operator has a specific syntax: '!

leetcodehardstringstackrecursion
CF 95A - Hockey

We are given a string representing a hockey team name and a list of forbidden substrings. Our task is to modify the original string so that any letter that is part of a forbidden substring can be replaced with another letter of our choosing.

codeforcescompetitive-programmingimplementationstrings