brain

tamnd's digital brain — notes, problems, research

43815 notes

LeetCode 1788 - Maximize the Beauty of the Garden

We are given an integer array flowers, where each element represents the beauty value of a flower in a line. We may remove any flowers we want, while preserving the relative order of the remaining flowers. After removals, the remaining sequence must form a valid garden.

leetcodehardarrayhash-tablegreedyprefix-sum
CF 18E - Flag 2

We are given a flag represented as an _n_×_m_ grid where each cell is painted with one of 26 colours labeled a to z. The goal is to repaint as few squares as possible so that two conditions hold. First, each row can use at most two different colours.

codeforcescompetitive-programmingdp
CF 109D - Lucky Sorting

We are given an array of positive integers, and we want to sort it in non-decreasing order. The twist is that we can only swap elements if at least one of the two numbers involved is lucky. A lucky number is defined as a number containing only the digits 4 and 7.

codeforcescompetitive-programmingconstructive-algorithmssortings
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 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
CF 100E - Lamps in a Line

We have a row of n lamps, each initially either on or off. Each lamp has a number from 1 to n. We also have n keys numbered the same way. Pressing key i toggles every lamp whose number is divisible by i.

codeforcescompetitive-programming*specialmath
CF 27E - Number With The Given Amount Of Divisors

We are given a single integer n, and we need to construct the smallest positive integer whose number of divisors is exactly n.

codeforcescompetitive-programmingbrute-forcedpnumber-theory
LeetCode 654 - Maximum Binary Tree

The problem asks us to construct a maximum binary tree from a given integer array nums with unique elements. A maximum binary tree is a binary tree where each node is the maximum element of the subarray it represents.

leetcodemediumarraydivide-and-conquerstacktreemonotonic-stackbinary-tree
LeetCode 879 - Profitable Schemes

This problem asks us to count how many subsets of crimes satisfy two constraints simultaneously: 1. The total number of members used is at most n 2.

leetcodehardarraydynamic-programming
LeetCode 609 - Find Duplicate File in System

The problem gives us a list of directory descriptions, where each string represents a directory and the files inside it. Each file entry includes both the filename and its content. For example: means: - The directory path is root/a - Inside this directory: - 1.

leetcodemediumarrayhash-tablestring
LeetCode 315 - Count of Smaller Numbers After Self

The problem asks us to compute, for every element in the array, how many elements to its right are strictly smaller than it. Given an array nums, we must return another array counts of the same length.

leetcodehardarraybinary-searchdivide-and-conquerbinary-indexed-treesegment-treemerge-sortordered-set
LeetCode 828 - Count Unique Characters of All Substrings of a Given String

The problem asks us to compute the total number of unique characters across every possible substring of a given string. A character is considered unique inside a substring if it appears exactly once within that substring.

leetcodehardhash-tablestringdynamic-programming
LeetCode 1809 - Ad-Free Sessions

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

leetcodeeasydatabase
LeetCode 1796 - Second Largest Digit in a String

The problem gives us a string s that contains lowercase English letters and numerical digits. Our task is to find the second largest distinct digit that appears anywhere in the string. The important detail is that we care about distinct digits, not frequency.

leetcodeeasyhash-tablestring
LeetCode 2033 - Minimum Operations to Make a Uni-Value Grid

The problem gives us a 2D integer matrix called grid and an integer x. In one operation, we may either add x to a cell or subtract x from a cell. Our goal is to make every value in the grid equal using the minimum number of operations.

leetcodemediumarraymathsortingmatrix
LeetCode 2229 - Check if an Array Is Consecutive

The problem asks us to determine whether an integer array forms a perfect sequence of consecutive numbers without gaps o

leetcodeeasyarrayhash-tablesorting
LeetCode 1437 - Check If All 1's Are at Least Length K Places Away

The problem asks us to check whether all 1s in a given binary array nums are separated by at least k positions. In other

leetcodeeasyarray
LeetCode 1422 - Maximum Score After Splitting a String

The problem gives us a binary string s, meaning the string contains only the characters '0' and '1'. We must split this string into two non-empty parts, a left substring and a right substring.

leetcodeeasystringprefix-sum
LeetCode 813 - Largest Sum of Averages

The problem gives us an integer array nums and an integer k. We are allowed to split the array into at most k contiguous, non-empty subarrays. For each subarray, we compute its average, then sum all of those averages together. Our goal is to maximize that total score.

leetcodemediumarraydynamic-programmingprefix-sum
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 1557 - Minimum Number of Vertices to Reach All Nodes

The problem is asking us to identify the minimum set of vertices in a directed acyclic graph (DAG) such that starting from any of these vertices, all other nodes in the graph are reachable.

leetcodemediumgraph-theory
LeetCode 959 - Regions Cut By Slashes

Let's dive into a full, detailed technical solution guide for LeetCode 959 - Regions Cut By Slashes following your formatting rules. The problem gives us an n x n grid where each cell contains either a forward slash '/', a backslash '', or a blank space ' '.

leetcodemediumarrayhash-tabledepth-first-searchbreadth-first-searchunion-findmatrix
LeetCode 1496 - Path Crossing

This problem asks us to simulate movement on a 2D plane according to a string of directional instructions. Each characte

leetcodeeasyhash-tablestring
LeetCode 1734 - Decode XORed Permutation

The problem gives us an array called encoded, which was generated from an unknown permutation array perm. A permutation of the first n positive integers means the array contains every integer from 1 to n exactly once. For example: - [1,2,3] is a valid permutation of 1..

leetcodemediumarraybit-manipulation
LeetCode 1145 - Binary Tree Coloring Game

The problem is a two-player game played on a binary tree, where each player colors nodes starting from an initial chosen node. Player 1 picks a node x and colors it red, while Player 2 picks a different node y and colors it blue.

leetcodemediumtreedepth-first-searchbinary-tree
CF 87A - Trains

Vasya is at the central station of a subway branch with two endpoints. Each endpoint corresponds to one of his girlfriends: Dasha or Masha. Trains to Dasha’s station arrive every a minutes and trains to Masha’s station arrive every b minutes.

codeforcescompetitive-programmingimplementationmath
LeetCode 1700 - Number of Students Unable to Eat Lunch

This problem simulates a school cafeteria where students line up to take sandwiches from a stack. Each student has a preference for either a circular sandwich (0) or a square sandwich (1).

leetcodeeasyarraystackqueuesimulation
LeetCode 1367 - Linked List in Binary Tree

This problem asks whether a linked list appears as a continuous downward path inside a binary tree. The path does not ne

leetcodemediumlinked-listtreedepth-first-searchbinary-tree
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 646 - Maximum Length of Pair Chain

The problem gives us an array of integer pairs, where each pair represents an interval-like relationship of the form [left, right]. Every pair satisfies the condition left < right. We want to build the longest possible chain of pairs.

leetcodemediumarraydynamic-programminggreedysorting
LeetCode 1340 - Jump Game V

Here is a comprehensive solution guide for LeetCode 1340 following your requested format. The problem presents an array

leetcodehardarraydynamic-programmingsorting
LeetCode 361 - Bomb Enemy

The problem presents an m x n matrix called grid where each element is a character representing either a wall 'W', an enemy 'E', or an empty cell '0'. The task is to determine the maximum number of enemies that can be eliminated by placing a single bomb in an empty cell.

leetcodemediumarraydynamic-programmingmatrix
CF 130F - Prime factorization

The task is to decompose a given integer n into its prime factors and print them in non-decreasing order, with each prime repeated according to its multiplicity. Essentially, if a number is a product of primes like $n = 2^2 cdot 3^1 cdot 5^2$, the output should be 2 2 3 5 5.

codeforcescompetitive-programming*special
LeetCode 375 - Guess Number Higher or Lower II

This problem is a variant of the classic number guessing game with a twist: incorrect guesses cost money equal to the value guessed, and the goal is to minimize the maximum cost required to guarantee a win.

leetcodemediummathdynamic-programminggame-theory
LeetCode 598 - Range Addition II

The problem presents an m x n matrix M initialized with all zeros. You are also given an array of operations ops, where each operation ops[i] = [ai, bi] instructs you to increment by one all elements in the submatrix defined by the top-left corner (0,0) and the bottom-right…

leetcodeeasyarraymath
LeetCode 105 - Construct Binary Tree from Preorder and Inorder Traversal

The problem is asking us to reconstruct a binary tree given two traversal orders: preorder and inorder. In a preorder traversal, nodes are visited in the order: root, left subtree, right subtree.

leetcodemediumarrayhash-tabledivide-and-conquertreebinary-tree
LeetCode 1129 - Shortest Path with Alternating Colors

The problem gives us a directed graph with n nodes labeled from 0 to n - 1. Every edge in the graph has a color, either red or blue.

leetcodemediumbreadth-first-searchgraph-theory
LeetCode 1083 - Sales Analysis II

This problem asks us to identify all buyers who purchased the product named S8 but never purchased the product named iPhone. We are given two tables: The Product table stores information about products. Each row contains a unique productid, the product name, and its unit price.

leetcodeeasydatabase
LeetCode 1745 - Palindrome Partitioning IV

The problem asks us to determine whether a given string s can be split into exactly three non-empty substrings, each of which is a palindrome. A palindrome is a string that reads the same forward and backward. For example, the string "aba" is a palindrome, whereas "abc" is not.

leetcodehardstringdynamic-programming
CF 17E - Palisection

We are given a string and we consider every palindromic substring inside it. Each occurrence matters separately, even if two substrings have the same text. For example, in "aaa" there are three different occurrences of "a".

codeforcescompetitive-programmingstrings
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 572 - Subtree of Another Tree

This problem asks us to determine whether one binary tree appears as an exact subtree inside another binary tree.

leetcodeeasytreedepth-first-searchstring-matchingbinary-treehash-function
CF 76A - Gift

We have an undirected graph where every road has two thresholds attached to it. For a road with values (g, s), the road becomes safe only if the king gives at least g gold coins and at least s silver coins to the bandits.

codeforcescompetitive-programmingdsugraphssortingstrees
LeetCode 1717 - Maximum Score From Removing Substrings

The problem gives us a string s and two scoring rules: - Removing the substring "ab" earns x points. - Removing the substring "ba" earns y points. We may perform these removals as many times as possible, in any order we choose.

leetcodemediumstringstackgreedy
CF 58E - Expression

We are given a string representing a simple arithmetic expression of the form a+b=c, where a, b, and c are integers.

codeforcescompetitive-programmingdp
LeetCode 1263 - Minimum Moves to Move a Box to Their Target Location

The problem is a variant of the classic "Sokoban" puzzle. You are given a grid representing a warehouse, where a player

leetcodehardarraybreadth-first-searchheap-(priority-queue)matrix
LeetCode 636 - Exclusive Time of Functions

This problem models how functions execute on a single-threaded CPU. Since the CPU is single-threaded, only one function can actively execute at any given moment. However, functions may call other functions, including recursive calls to themselves.

leetcodemediumarraystack
LeetCode 1163 - Last Substring in Lexicographical Order

The problem asks us to find the substring of a given string s that is lexicographically largest among all possible substrings. A substring is any contiguous portion of the string.

leetcodehardtwo-pointersstring
LeetCode 1472 - Design Browser History

The problem is asking us to simulate a single-tab browser with a history mechanism. You start on a homepage, and from there, you can visit new URLs, backtrack a certain number of steps, or forward a certain number of steps.

leetcodemediumarraylinked-liststackdesigndoubly-linked-listdata-stream
LeetCode 605 - Can Place Flowers

The problem gives us a binary array called flowerbed, where: - 0 represents an empty plot - 1 represents a plot that already contains a flower We are also given an integer n, which represents how many new flowers we want to plant.

leetcodeeasyarraygreedy
LeetCode 1240 - Tiling a Rectangle with the Fewest Squares

The problem is asking us to completely cover a rectangle of size n x m with the fewest number of squares that have integer side lengths. The rectangle can be tiled with squares of any size, as long as each square fits entirely within the rectangle and there is no overlap.

leetcodehardbacktracking
CF 78C - Beaver Game

We have n independent logs, each with length m. On a move, a player chooses one existing log and splits it into several equal pieces. If a log of length x is split into t equal parts, then t 1, t must divide x, and every resulting part must have length at least k.

codeforcescompetitive-programmingdpgamesnumber-theory
CF 22E - Scheme

Each person points to exactly one other person. If someone learns the news, they call the person they point to, who then calls the next person, and so on. We may add extra directed edges of the form x -> y, meaning person x must also call y.

codeforcescompetitive-programmingdfs-and-similargraphstrees
LeetCode 1673 - Find the Most Competitive Subsequence

Here is a complete, detailed technical solution guide for LeetCode 1673 - Find the Most Competitive Subsequence followin

leetcodemediumarraystackgreedymonotonic-stack
LeetCode 488 - Zuma Game

The problem models a recursive elimination game played on a row of colored balls. The board is represented as a string where each character corresponds to a colored ball. The available colors are 'R', 'Y', 'B', 'G', and 'W'.

leetcodehardstringdynamic-programmingstackbreadth-first-searchmemoization
LeetCode 1209 - Remove All Adjacent Duplicates in String II

The problem asks us to repeatedly remove groups of exactly k adjacent identical characters from a string until no more such groups exist. A removal operation works as follows: - Find k consecutive characters that are all the same. - Remove those characters from the string.

leetcodemediumstringstack
LeetCode 121 - Best Time to Buy and Sell Stock

This problem asks us to determine the maximum profit that can be made from a single stock transaction. A transaction consists of buying one stock on one day and selling it on a later day. The key restriction is that the selling day must come after the buying day.

leetcodeeasyarraydynamic-programming
LeetCode 777 - Swap Adjacent in LR String

The problem gives us two strings, start and result, both consisting only of the characters 'L', 'R', and 'X'. We are allowed to transform the start string using only two kinds of moves: - Replace "XL" with "LX" - Replace "RX" with "XR" The goal is to determine whether it is…

leetcodemediumtwo-pointersstring
LeetCode 3053 - Classifying Triangles by Lengths

The problem requires classifying triangles based on the lengths of their three sides, represented by the columns A, B, a

leetcodeeasydatabase
LeetCode 400 - Nth Digit

The problem asks us to find the digit that appears at position n in an infinitely long sequence formed by concatenating all positive integers together.

leetcodemediummathbinary-search
LeetCode 1381 - Design a Stack With Increment Operation

This problem requires designing a specialized stack data structure, called CustomStack, that not only supports the usual

leetcodemediumarraystackdesign
LeetCode 1807 - Evaluate the Bracket Pairs of a String

The problem asks us to process a string s that contains bracketed keys like (name) or (age) and replace them with corres

leetcodemediumarrayhash-tablestring
CF 72E - Ali goes shopping

We are given a lowercase string and must find the substring that appears the largest number of times inside it. Occurrences may overlap. Among all substrings with the same maximum frequency, we choose the longest one.

codeforcescompetitive-programming*specialbrute-forcestrings
CF 120H - Brevity is Soul of Wit

We are given up to 200 distinct lowercase words. For every word, we must choose a short abbreviation whose length is between 1 and 4 characters, and whose characters appear in the original word in the same order.

codeforcescompetitive-programminggraph-matchings
LeetCode 322 - Coin Change

The problem gives us an array called coins, where each element represents a coin denomination, and an integer called amount, which represents the target sum we want to construct. Our goal is to determine the minimum number of coins needed to make exactly amount.

leetcodemediumarraydynamic-programmingbreadth-first-search
CF 80B - Depression

We are given a digital time in HH:MM format and need to determine how far the analog clock hands must rotate from the initial position 12:00. The clock starts with both hands pointing at 12. We may rotate each hand independently, and only in the clockwise direction.

codeforcescompetitive-programminggeometrymath
LeetCode 247 - Strobogrammatic Number II

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

leetcodemediumarraystringrecursion
LeetCode 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 1620 - Coordinate With Maximum Network Quality

The problem asks us to find the integral coordinate on a 2D plane where the network quality is maximized. We are given s

leetcodemediumarrayenumeration
LeetCode 1392 - Longest Happy Prefix

The problem asks us to find the longest substring that is both a prefix and a suffix of the given string s, while also e

leetcodehardstringrolling-hashstring-matchinghash-function
LeetCode 21 - Merge Two Sorted Lists

This problem asks us to merge two already sorted singly linked lists into one new sorted linked list. The important detail is that we are not creating entirely new nodes for the merged result. Instead, we reuse the existing nodes by reconnecting their next pointers.

leetcodeeasylinked-listrecursion
CF 17D - Notepad

Nick wants to list all numbers of a given length n in base b, where digits range from 0 to b-1, but numbers cannot start with 0. Each page in his notepad holds exactly c numbers. We are asked to compute how many numbers appear on the last page he fills.

codeforcescompetitive-programmingnumber-theory
LeetCode 258 - Add Digits

The problem asks us to repeatedly transform a number by summing its digits until only a single digit remains. The final single digit should then be returned. For example, if the input is 38, we first compute 3 + 8 = 11.

leetcodeeasymathsimulationnumber-theory
LeetCode 82 - Remove Duplicates from Sorted List II

This problem asks us to process a sorted singly linked list and remove every value that appears more than once. The important distinction is that we are not keeping one copy of duplicated values. Instead, every node containing a duplicated value must be removed entirely.

leetcodemediumlinked-listtwo-pointers
LeetCode 1165 - Single-Row Keyboard

The problem describes a single-row keyboard where each key is positioned at a unique index from 0 to 25. You are given a string keyboard of length 26 that specifies the layout of all lowercase English letters.

leetcodeeasyhash-tablestring
LeetCode 367 - Valid Perfect Square

The problem asks us to determine whether a given positive integer num is a perfect square without using built in square root functions such as sqrt(). A perfect square is a number that can be written as: where k is an integer.

leetcodeeasymathbinary-search
CF 42B - Game of chess unfinished

We are given a chess position containing exactly four pieces on a standard 8×8 board. White has two rooks and one king, black has only a king. The position is already legal, meaning no two pieces share a square and the two kings are not adjacent.

codeforcescompetitive-programmingimplementation
LeetCode 703 - Kth Largest Element in a Stream

The problem asks us to design a data structure that continuously tracks the kth largest element in a stream of integers. We are given an integer k and an initial list of numbers called nums. After initialization, new numbers are added one at a time using the add method.

leetcodeeasytreedesignbinary-search-treeheap-(priority-queue)binary-treedata-stream
CF 11C - How Many Squares?

We are given a binary grid. A valid object is not a filled square, it is only the border of a square drawn with 1s. Every cell not belonging to the border must be 0.

codeforcescompetitive-programmingimplementation
CF 63D - Dividing Island

We are asked to divide an island into connected territories for multiple parties. The island is represented by two rectangles placed side by side: one of size a by b and another of size c by d.

codeforcescompetitive-programmingconstructive-algorithms
LeetCode 527 - Word Abbreviation

The problem asks us to compute minimal unique abbreviations for an array of distinct strings. An abbreviation replaces the middle characters of a word with a count, keeping the first and last characters.

leetcodehardarraystringgreedytriesorting
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
LeetCode 160 - Intersection of Two Linked Lists

This problem asks us to determine whether two singly linked lists share a common node, and if they do, return the exact node where the intersection begins. The important detail is that an intersection is based on node reference, not node value.

leetcodeeasyhash-tablelinked-listtwo-pointers
LeetCode 854 - K-Similar Strings

The problem asks us to determine the minimum number of swaps needed to transform one string into another, where both strings are anagrams of each other. A single operation consists of swapping any two characters in s1.

leetcodehardhash-tablestringbreadth-first-search
LeetCode 626 - Exchange Seats

This problem asks us to swap the seat IDs of every two consecutive students in a classroom. The input is a table called Seat with two columns: id, which is a unique integer representing the seat number, and student, which is a string representing the student's name.

leetcodemediumdatabase
CF 48B - Land Lot

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

codeforcescompetitive-programmingbrute-forceimplementation
LeetCode 948 - Bag of Tokens

The problem gives us a collection of tokens, where each token has a numeric value. We also start with an initial amount of power and an initial score of 0. Every token can be used at most once, and each token can be played in exactly one of two ways.

leetcodemediumarraytwo-pointersgreedysorting
LeetCode 1072 - Flip Columns For Maximum Number of Equal Rows

The problem gives us an m x n binary matrix, where every element is either 0 or 1. We are allowed to choose any set of columns and flip them. Flipping a column means changing every 0 in that column to 1, and every 1 to 0.

leetcodemediumarrayhash-tablematrix
LeetCode 79 - Word Search

In this problem, we are given a two dimensional grid of characters called board and a target string called word. The task is to determine whether the word can be formed by traversing the grid under a strict set of movement rules.

leetcodemediumarraystringbacktrackingdepth-first-searchmatrix
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 1562 - Find Latest Group of Size M

Edit This problem gives us a permutation array arr containing integers from 1 to n, where n is the size of the binary st

leetcodemediumarrayhash-tablebinary-searchsimulation
LeetCode 1040 - Moving Stones Until Consecutive II

The problem gives an array stones representing positions of stones on the X-axis, where each position is unique. The goal is to move the endpoint stones-the stones at the smallest and largest positions-so that eventually all stones occupy consecutive positions on the X-axis.

leetcodemediumarraymathsliding-windowsorting
CF 39H - Multiplication Table

The task is to generate a multiplication table for numbers in a positional numeral system with a base k. Unlike the decimal system, the digits in this system range from 0 up to k-1. Petya wants to see products of numbers from 1 to k-1 expressed in this system.

codeforcescompetitive-programmingimplementation
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 566 - Reshape the Matrix

The problem is asking us to take an existing m x n matrix and "reshape" it into a new matrix with r rows and c columns. Reshaping means rearranging the elements in the matrix in row-major order (left-to-right, top-to-bottom) without changing the order of the elements themselves.

leetcodeeasyarraymatrixsimulation
LeetCode 1288 - Remove Covered Intervals

The problem gives us a list of intervals, where each interval is represented as [li, ri], corresponding to the half open

leetcodemediumarraysorting
LeetCode 1284 - Minimum Number of Flips to Convert Binary Matrix to Zero Matrix

The problem asks us to transform a given binary matrix mat into a zero matrix, where all elements are 0. Each operation

leetcodehardarrayhash-tablebit-manipulationbreadth-first-searchmatrix
LeetCode 1649 - Create Sorted Array through Instructions

The problem asks us to simulate building a sorted array incrementally. We process the instructions array from left to ri

leetcodehardarraybinary-searchdivide-and-conquerbinary-indexed-treesegment-treemerge-sortordered-set
LeetCode 1446 - Consecutive Characters

The problem asks us to compute the power of a string. The power is defined as the length of the longest contiguous subst

leetcodeeasystring
LeetCode 388 - Longest Absolute File Path

The problem gives us a string representation of a file system hierarchy. Every line represents either a directory or a file. The hierarchy is encoded using newline characters (n) to separate entries and tab characters (t) to indicate nesting depth.

leetcodemediumstringstackdepth-first-search