brain

tamnd's digital brain — notes, problems, research

43815 notes

LeetCode 924 - Minimize Malware Spread

In this problem, we are given an undirected graph represented as an adjacency matrix. Each node represents a computer in a network, and an edge between two nodes means those computers are directly connected. Some subset of nodes is initially infected with malware.

leetcodehardarrayhash-tabledepth-first-searchbreadth-first-searchunion-findgraph-theory
LeetCode 1800 - Maximum Ascending Subarray Sum

The problem gives an array of positive integers called nums. We must find the contiguous subarray that is strictly increasing and has the largest possible sum. A subarray is contiguous, which means the elements must appear next to each other in the original array.

leetcodeeasyarray
LeetCode 419 - Battleships in a Board

This problem gives us a two dimensional grid where each cell contains either 'X' or '.'. An 'X' represents part of a battleship, while '.' represents empty water. The important rule is that battleships are always placed in straight lines.

leetcodemediumarraydepth-first-searchmatrix
LeetCode 1062 - Longest Repeating Substring

The problem asks us to find the length of the longest substring that appears at least twice in a given string s. A substring is a contiguous sequence of characters inside a string. The repeated substrings may overlap with each other, which is an important detail.

leetcodemediumstringbinary-searchdynamic-programmingrolling-hashsuffix-arrayhash-function
LeetCode 342 - Power of Four

This problem asks us to determine whether a given integer n is an exact power of four. In other words, we need to check whether there exists some integer x such that: Examples of powers of four are: The input consists of a single integer n, and the expected output is a boolean…

leetcodeeasymathbit-manipulationrecursion
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 10C - Digital Root

We are given an integer N. Consider all triples (A, B, C) where every value lies in the range [1, N].

codeforcescompetitive-programmingnumber-theory
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 91E - Igloo Skyscraper

Each walrus builds a skyscraper whose height changes linearly over time. Walrus i starts with height a[i] and gains b[i] floors every minute, so at time t its height equals: $$hi(t) = ai + bi cdot t$$ For every query [l, r, t], we must find an index inside that interval whose…

codeforcescompetitive-programmingdata-structuresgeometry
LeetCode 1569 - Number of Ways to Reorder Array to Get Same BST

The problem gives us a permutation of integers from 1 to n, and we insert the numbers into an initially empty Binary Search Tree (BST) in the exact order they appear in the array. A BST has the following property: - Values smaller than the current node go to the left subtree.

leetcodehardarraymathdivide-and-conquerdynamic-programmingtreeunion-findbinary-search-treememoizationcombinatoricsbinary-tree
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 1399 - Count Largest Group

The problem asks us to group all integers from 1 to n based on the sum of their digits. Every number belongs to exactly

leetcodeeasyhash-tablemathcounting
CF 99B - Help Chef Gerasim

We are given a set of cups, each containing some amount of juice, and we want to determine whether the volumes could result from the pages pouring juice from one cup to another exactly once, or not at all.

codeforcescompetitive-programmingimplementationsortings
LeetCode 448 - Find All Numbers Disappeared in an Array

The problem asks us to find all the integers in the range [1, n] that are missing from an input array nums of length n.

leetcodeeasyarrayhash-table
LeetCode 213 - House Robber II

This problem is a variation of the classic House Robber dynamic programming problem, with one important twist: the houses are arranged in a circle rather than a straight line.

leetcodemediumarraydynamic-programming
CF 21D - Traveling Graph

We are given a weighted undirected graph with up to 15 vertices and up to 2000 edges. Each edge has a positive weight, and there may be multiple edges connecting the same pair of vertices or edges that loop back to the same vertex.

codeforcescompetitive-programmingbitmasksgraph-matchingsgraphs
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 1449 - Form Largest Integer With Digits That Add up to Target

This problem asks us to construct the numerically largest possible integer such that the total painting cost of its digi

leetcodehardarraydynamic-programming
LeetCode 289 - Game of Life

The problem asks us to simulate one iteration of Conway's Game of Life on a two-dimensional grid. Each cell in the grid is either alive, represented by 1, or dead, represented by 0. Every cell changes state simultaneously according to the number of live neighbors surrounding it.

leetcodemediumarraymatrixsimulation
LeetCode 519 - Random Flip Matrix

The problem gives us an m x n matrix where every cell initially contains 0. We need to design a data structure that supports two operations efficiently: 1.

leetcodemediumhash-tablemathreservoir-samplingrandomized
LeetCode 177 - Nth Highest Salary

This problem asks us to write a SQL function that returns the nth highest distinct salary from the Employee table. The table contains two columns: Column Meaning --- --- id Unique employee identifier salary Employee salary The key detail is that the salary must be distinct.

leetcodemediumdatabase
LeetCode 1272 - Remove Interval

The problem asks us to remove a given interval toBeRemoved from a list of non-overlapping, sorted intervals intervals. E

leetcodemediumarray
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
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 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
CF 5C - Longest Regular Bracket Sequence

We are given a string made only of ( and ). Among all contiguous substrings, we need to find the maximum length of a substring that forms a valid bracket sequence. We also need to count how many substrings achieve that maximum length.

codeforcescompetitive-programmingconstructive-algorithmsdata-structuresdpgreedysortingsstrings
LeetCode 1121 - Divide Array Into Increasing Sequences

The problem asks us to determine if a sorted integer array nums can be divided into one or more disjoint increasing subsequences, where each subsequence has a length of at least k.

leetcodehardarraycounting
LeetCode 1256 - Encode Number

Sure, let's build a full, detailed technical solution guide for LeetCode 1256 following your requested structure. The problem asks us to take a non-negative integer num and encode it as a string using a secret encoding rule.

leetcodemediummathstringbit-manipulation
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 338 - Counting Bits

The problem asks us to compute the number of set bits, also called population count or popcount, for every integer from 0 through n. A set bit is a bit with value 1 in the binary representation of a number.

leetcodeeasydynamic-programmingbit-manipulation
LeetCode 1112 - Highest Grade For Each Student

The problem gives us a database table named Enrollments. Each row represents a student taking a course and receiving a grade for that course.

leetcodemediumdatabase
CF 39D - Cubical Planet

We are given two vertices of a unit cube. Each vertex is described by three coordinates, and every coordinate is either 0 or 1. Since each coordinate can only take two values, these coordinates represent the eight corners of the cube. Two flies stand on two different vertices.

codeforcescompetitive-programmingmath
LeetCode 564 - Find the Closest Palindrome

The problem gives us a string n representing a positive integer, and asks us to find the numerically closest palindrome that is not equal to the original number itself. A palindrome is a number that reads the same forward and backward. Examples include 121, 999, and 1331.

leetcodehardmathstring
LeetCode 405 - Convert a Number to Hexadecimal

The problem asks us to convert a given 32-bit integer num into its hexadecimal representation as a string. Hexadecimal, or base-16, uses digits 0-9 and letters a-f to represent values 0-15.

leetcodeeasymathstringbit-manipulation
LeetCode 781 - Rabbits in Forest

In this problem, every rabbit tells us how many other rabbits share its color. The input array answers contains these responses. If a rabbit says x, that means there are exactly x + 1 rabbits of that color group in total, including itself.

leetcodemediumarrayhash-tablemathgreedy
CF 70D - Professor's task

We are asked to maintain a set of points on a plane and support two operations: adding a point, and checking if a point lies inside the convex hull of the current set. The convex hull is the minimal convex polygon enclosing all points.

codeforcescompetitive-programmingdata-structuresgeometry
LeetCode 48 - Rotate Image

The problem gives us an n x n square matrix that represents an image. Each element in the matrix corresponds to a pixel or value in the image. Our task is to rotate the entire image by 90 degrees clockwise. The important requirement is that the rotation must happen in-place.

leetcodemediumarraymathmatrix
LeetCode 922 - Sort Array By Parity II

The problem gives an integer array nums where exactly half of the elements are even numbers and the other half are odd numbers. The task is to rearrange the array so that every even index contains an even number and every odd index contains an odd number.

leetcodeeasyarraytwo-pointerssorting
LeetCode 1323 - Maximum 69 Number

The problem gives us a positive integer num that contains only the digits 6 and 9. We are allowed to change at most one

leetcodeeasymathgreedy
LeetCode 116 - Populating Next Right Pointers in Each Node

This problem asks us to populate the next pointers of nodes in a perfect binary tree. A perfect binary tree has all levels completely filled; every internal node has exactly two children, and all leaves are at the same depth.

leetcodemediumlinked-listtreedepth-first-searchbreadth-first-searchbinary-tree
LeetCode 1568 - Minimum Number of Days to Disconnect Island

The problem gives us a binary matrix where each cell is either land (1) or water (0). Land cells that touch vertically or horizontally belong to the same island. A grid is considered connected only when there is exactly one island in the entire grid.

leetcodehardarraydepth-first-searchbreadth-first-searchmatrixstrongly-connected-component
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 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 123 - Best Time to Buy and Sell Stock III

The problem asks us to determine the maximum profit we can earn from at most two stock transactions given the daily prices of a stock in an array prices. A transaction is defined as buying once and selling once.

leetcodehardarraydynamic-programming
LeetCode 261 - Graph Valid Tree

The problem asks whether a given undirected graph forms a valid tree. A tree is a special type of graph with two important properties: 1. The graph is fully connected, meaning every node can be reached from every other node. 2. The graph contains no cycles.

leetcodemediumdepth-first-searchbreadth-first-searchunion-findgraph-theory
CF 68A - Irrational problem

We are asked to count integers $x$ in a given range $[a, b]$ that satisfy a certain remainder-based property. Petya has four distinct integers $p1, p2, p3, p4$.

codeforcescompetitive-programmingimplementationnumber-theory
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
LeetCode 1353 - Maximum Number of Events That Can Be Attended

The problem gives us a list of events, where each event is represented as a pair [startDay, endDay]. An event is available to attend on any single day within that inclusive range.

leetcodemediumarraygreedysortingheap-(priority-queue)
LeetCode 809 - Expressive Words

The problem asks us to determine how many words in the words array can be transformed into the target string s using a very specific type of expansion operation.

leetcodemediumarraytwo-pointersstring
CF 111A - Petya and Inequiations

We need to construct an array of n positive integers. The array must satisfy two conditions at the same time. The sum of squares of all elements must be at least x, while the ordinary sum of the elements must not exceed y. The task is not to optimize anything.

codeforcescompetitive-programminggreedy
LeetCode 1111 - Maximum Nesting Depth of Two Valid Parentheses Strings

The problem asks us to take a valid parentheses string seq and split it into two disjoint subsequences A and B such that each subsequence is itself a valid parentheses string (VPS).

leetcodemediumstringstack
LeetCode 515 - Find Largest Value in Each Tree Row

The problem asks us to find the largest value in each row of a binary tree, where a row is defined as all nodes at the same depth. The input is the root of a binary tree, which may contain up to 10,000 nodes, and each node's value is a signed 32-bit integer.

leetcodemediumtreedepth-first-searchbreadth-first-searchbinary-tree
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 1688 - Count of Matches in Tournament

The problem describes a tournament where teams compete until only one winner remains. At every round, teams are paired t

leetcodeeasymathsimulation
CF 3D - Least Cost Bracket Sequence

We are given a bracket string containing three kinds of characters: '(', ')', and '?'. Every '?' must eventually become either an opening or closing bracket. For each unknown position, the input provides two costs, one for replacing it with '(' and one for replacing it with ')'.

codeforcescompetitive-programminggreedy
LeetCode 862 - Shortest Subarray with Sum at Least K

The problem asks us to find the length of the shortest contiguous subarray whose sum is at least k. We are given an integer array nums, which may contain both positive and negative numbers, and an integer k.

leetcodehardarraybinary-searchqueuesliding-windowheap-(priority-queue)prefix-summonotonic-queue
LeetCode 32 - Longest Valid Parentheses

The problem asks us to find the length of the longest contiguous substring that forms a valid parentheses sequence. A valid parentheses sequence is one where every opening parenthesis '(' has a corresponding closing parenthesis ')', and the pairs are correctly nested.

leetcodehardstringdynamic-programmingstack
CF 93C - Azembler

We start with one register, eax, containing some unknown value x. Every other register contains 0. The goal is to produce n x in any register using the minimum possible number of lea instructions. The instruction set is surprisingly limited, but also surprisingly powerful.

codeforcescompetitive-programmingbrute-forceimplementation
LeetCode 302 - Smallest Rectangle Enclosing Black Pixels

This problem gives us a binary matrix where each cell contains either '0' or '1'. A '1' represents a black pixel, while a '0' represents a white pixel.

leetcodehardarraybinary-searchdepth-first-searchbreadth-first-searchmatrix
LeetCode 659 - Split Array into Consecutive Subsequences

The problem gives us a sorted integer array nums, and asks whether we can divide every element into one or more subsequences that satisfy two conditions. First, each subsequence must consist of consecutive increasing integers.

leetcodemediumarrayhash-tablegreedyheap-(priority-queue)
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
LeetCode 727 - Minimum Window Subsequence

This problem asks us to find the smallest contiguous substring of s1 such that s2 appears inside that substring as a subsequence. A subsequence does not require characters to be adjacent, but they must appear in the same relative order.

leetcodehardstringdynamic-programmingsliding-window
CF 66E - Petya and Post

We have a circular route with n post offices, each with a gas station. Each station i has a[i] liters of gasoline available, and the distance from station i to i+1 is b[i] kilometers, wrapping around at the end.

codeforcescompetitive-programmingdata-structuresdp
CF 130J - Date calculation

We are given a year in the Gregorian calendar and a day number inside that year. The task is to determine the actual calendar date corresponding to that day number.

codeforcescompetitive-programming*special
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
CF 26E - Multithreading

Each process repeatedly executes two atomic instructions:

codeforcescompetitive-programmingconstructive-algorithms
LeetCode 1233 - Remove Sub-Folders from the Filesystem

This problem asks us to process a list of folder paths and remove all sub-folders, returning only the top-level folders. A folder "/a/b" is considered a sub-folder of "/a" because it is nested inside it.

leetcodemediumarraystringdepth-first-searchtrie
LeetCode 1300 - Sum of Mutated Array Closest to Target

The problem gives us an integer array arr and an integer target. We are allowed to choose a value x, then modify the arr

leetcodemediumarraybinary-searchsorting
LeetCode 1322 - Ads Performance

This problem asks us to calculate the Click-Through Rate, abbreviated as CTR, for every advertisement stored in the Ads

leetcodeeasydatabase
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 100A - Carpeting the Room

We have a square room with side length n, so the total area is n × n. We also have k square carpets, each with side length n1. Every carpet always stays axis-aligned because rotation is forbidden, but since the carpets are squares, rotation would not actually change anything.

codeforcescompetitive-programming*specialimplementation
CF 8B - Obsession with Robots

We are asked to analyze a robot's path on an infinite 2D grid. The robot can move up, down, left, or right, and its moves are recorded as a string of the characters U, D, L, R.

codeforcescompetitive-programmingconstructive-algorithmsgraphsimplementation
LeetCode 1760 - Minimum Limit of Balls in a Bag

You are given several bags of balls, where nums[i] represents how many balls are inside the i-th bag. You are allowed to perform at most maxOperations split operations.

leetcodemediumarraybinary-search
LeetCode 30 - Substring with Concatenation of All Words

The problem asks us to find all starting indices in a string s where a substring exists that is a concatenation of all the words in the array words exactly once, without any intervening characters. The words can appear in any order, and all words in words have the same length.

leetcodehardhash-tablestringsliding-window
LeetCode 812 - Largest Triangle Area

The problem gives us a list of unique points on a 2D X-Y plane. Each point is represented as a pair of integers [x, y]. Our task is to choose any three distinct points and compute the area of the triangle formed by those points.

leetcodeeasyarraymathgeometry
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 1529 - Minimum Suffix Flips

This problem is asking us to transform an initial binary string s (all zeros) into a target binary string target using a

leetcodemediumstringgreedy
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
LeetCode 1293 - Shortest Path in a Grid with Obstacles Elimination

This problem asks us to find the minimum number of steps required to move from the top-left corner of a grid to the bott

leetcodehardarraybreadth-first-searchmatrix
CF 12A - Super Agent

We are asked to check whether a password entered on a 3×3 keypad is symmetric with respect to its central button. The keypad is represented as a 3×3 grid of characters, where "X" indicates a pressed button and "." indicates an unpressed one.

codeforcescompetitive-programmingimplementation
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 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
CF 128A - Statues

We have an 8 × 8 board. Maria starts in the bottom-left corner, Anna stays permanently in the top-right corner, and several statues occupy other cells. The game proceeds in rounds. Maria moves first, then every statue moves one row downward simultaneously.

codeforcescompetitive-programmingdfs-and-similar
LeetCode 688 - Knight Probability in Chessboard

The problem asks us to compute the probability that a chess knight remains on an n x n board after making exactly k moves. A knight starts at position (row, column).

leetcodemediumdynamic-programming
LeetCode 238 - Product of Array Except Self

The problem gives an integer array nums, and for every index i, we must compute the product of every element in the array except nums[i].

leetcodemediumarrayprefix-sum
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 83C - Track

We have a rectangular grid. Each cell contains either a terrain type represented by a lowercase letter, the start cell S, or the target cell T. We may move in four directions between side-adjacent cells. Every move costs exactly one minute. The path must start at S and end at T.

codeforcescompetitive-programminggraphsgreedyshortest-paths
LeetCode 815 - Bus Routes

This problem asks us to determine the minimum number of buses required to travel from a given starting bus stop (source) to a destination bus stop (target) given a set of bus routes.

leetcodehardarrayhash-tablebreadth-first-search
LeetCode 987 - Vertical Order Traversal of a Binary Tree

The problem asks us to compute the vertical order traversal of a binary tree. In simpler terms, we are asked to “look at the tree from the side” and collect the nodes that align in the same vertical column.

leetcodehardhash-tabletreedepth-first-searchbreadth-first-searchsortingbinary-tree
LeetCode 1573 - Number of Ways to Split a String

The problem gives us a binary string s, meaning the string contains only the characters '0' and '1'. We must split this

leetcodemediummathstring
LeetCode 368 - Largest Divisible Subset

The problem gives us an array of distinct positive integers and asks us to find the largest subset where every pair of numbers satisfies a divisibility relationship. For any two elements a and b in the subset, either a % b == 0 or b % a == 0 must hold.

leetcodemediumarraymathdynamic-programmingsorting
LeetCode 1005 - Maximize Sum Of Array After K Negations

The problem is asking us to maximize the sum of an integer array after performing exactly k negations. A negation operation consists of picking an index i and replacing nums[i] with -nums[i]. This operation can be applied to the same element multiple times.

leetcodeeasyarraygreedysorting
LeetCode 1654 - Minimum Jumps to Reach Home

This problem asks us to find the minimum number of jumps required for a bug to move from position 0 to position x on a one dimensional number line. The bug follows several movement rules: - It may jump forward by exactly a units. - It may jump backward by exactly b units.

leetcodemediumarrayhash-tablebreadth-first-search
LeetCode 396 - Rotate Function

The problem defines a special value called the rotation function for an array. Given an integer array nums of length n, we rotate the array clockwise by k positions to create a new array arrk.

leetcodemediumarraymathdynamic-programming
LeetCode 799 - Champagne Tower

The problem asks us to simulate a process of pouring champagne into a pyramid of glasses. Each glass can hold exactly one cup of champagne, and any excess from a glass flows evenly to the two glasses immediately below it.

leetcodemediumdynamic-programming
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 1710 - Maximum Units on a Truck

The problem gives us several types of boxes, where each box type contains two values: - The number of boxes available for that type - The number of units inside each box of that type We also have a truck that can carry at most truckSize boxes total, regardless of type.

leetcodeeasyarraygreedysorting
CF 114B - PFAST Inc.

We are given a small group of people and a list of pairs who cannot work together. We need to choose the largest possible subset such that every pair inside the chosen group is compatible. This is naturally a graph problem. Think of each volunteer as a vertex.

codeforcescompetitive-programmingbitmasksbrute-forcegraphs
LeetCode 1156 - Swap For Longest Repeated Character Substring

The problem asks us to determine the length of the longest substring in a given string text where all characters are the same, and we are allowed to swap exactly two characters in the string.

leetcodemediumhash-tablestringsliding-window
LeetCode 770 - Basic Calculator IV

The problem requires parsing and evaluating a mathematical expression that includes integers, variables, addition, subtraction, multiplication, and parentheses, while also applying a substitution map for certain variables.

leetcodehardhash-tablemathstringstackrecursion