brain

tamnd's digital brain — notes, problems, research

43815 notes

LeetCode 962 - Maximum Width Ramp

The problem asks us to find the maximum width ramp in an array of integers. A ramp is defined as a pair of indices (i, j) such that: - i < j - nums[i] <= nums[j] The width of the ramp is simply the distance between the two indices: Our goal is to compute the largest possible…

leetcodemediumarraytwo-pointersstackmonotonic-stack
LeetCode 1135 - Connecting Cities With Minimum Cost

This problem asks us to connect n cities together using a set of possible bidirectional connections. Each connection has a cost, and our goal is to connect every city while minimizing the total cost.

leetcodemediumunion-findgraph-theoryheap-(priority-queue)minimum-spanning-tree
LeetCode 1790 - Check if One String Swap Can Make Strings Equal

The problem asks us to determine if two strings of equal length, s1 and s2, can be made identical by performing at most one string swap on exactly one of the strings. A string swap allows exchanging any two characters at different or same indices.

leetcodeeasyhash-tablestringcounting
CF 93E - Lostborn

We are asked to calculate how many numbers from 1 to n are not divisible by any number in a given set of integers, called hit indicators. Each indicator is guaranteed to be coprime with the others, and there are k of them, each at most 1000.

codeforcescompetitive-programmingdpmathnumber-theory
LeetCode 892 - Surface Area of 3D Shapes

The problem gives us an n x n matrix called grid, where each cell contains a non-negative integer. The value grid[i][j] represents how many 1 x 1 x 1 cubes are stacked vertically at position (i, j). Each cube contributes surface area through its exposed faces.

leetcodeeasyarraymathgeometrymatrix
LeetCode 1335 - Minimum Difficulty of a Job Schedule

The problem gives us an array jobDifficulty, where each element represents the difficulty of a job. The jobs must be com

leetcodehardarraydynamic-programming
LeetCode 481 - Magical String

This problem defines a special infinite sequence called the magical string. The string contains only the characters '1' and '2', and its defining property is very unusual: If you group consecutive identical digits together and record the length of each group, the resulting…

leetcodemediumtwo-pointersstring
LeetCode 1813 - Sentence Similarity III

The problem is asking us to determine whether two sentences can be made identical by inserting a contiguous sequence of words (possibly empty) into one of them. Each sentence is a string of words separated by single spaces.

leetcodemediumarraytwo-pointersstring
CF 65B - Harry Potter and the History of Magic

We are given a sequence of four-digit years. Each year may contain mistakes, but we are allowed to repair it by changing at most one digit. After all repairs, the sequence must become non-decreasing, and every resulting year must stay between 1000 and 2011 inclusive.

codeforcescompetitive-programmingbrute-forcegreedyimplementation
LeetCode 451 - Sort Characters By Frequency

The problem asks us to rearrange the characters of a string so that characters with higher frequency appear before characters with lower frequency. The output string must group identical characters together, and those groups must appear in descending order of occurrence count.

leetcodemediumhash-tablestringsortingheap-(priority-queue)bucket-sortcounting
LeetCode 643 - Maximum Average Subarray I

The problem asks us to find the maximum average value among all contiguous subarrays of a fixed length k. In other words, given an integer array nums, we must examine every possible subarray whose size is exactly k, compute its average, and return the largest average found.

leetcodeeasyarraysliding-window
LeetCode 1445 - Apples & Oranges

This problem provides a database table named Sales that stores the number of fruits sold on each day. Each row represents a single fruit sale summary for a specific date.

leetcodemediumdatabase
LeetCode 577 - Employee Bonus

In this problem, we are given two database tables, Employee and Bonus, and we need to produce a result table containing employees who meet one of two conditions: 1. Their bonus is less than 1000. 2. They do not have a bonus record at all.

leetcodeeasydatabase
CF 24C - Sequence of points

We are given a sequence of points on the 2D integer grid: a starting point M0 and a sequence of n points A0, A1, …, An-1, where n is always odd. We then define a new sequence M1, M2, … where each Mi is the reflection of Mi-1 over one of the Ai points.

codeforcescompetitive-programminggeometryimplementationmath
LeetCode 460 - LFU Cache

The problem asks us to design a cache that supports two operations: - get(key) returns the value associated with a key if it exists, otherwise -1 - put(key, value) inserts or updates a key-value pair Unlike a normal cache, eviction is not based only on recency.

leetcodehardhash-tablelinked-listdesigndoubly-linked-list
LeetCode 933 - Number of Recent Calls

The problem asks us to implement a class RecentCounter that tracks the number of requests (or pings) made in the last 3000 milliseconds.

leetcodeeasydesignqueuedata-stream
LeetCode 1166 - Design File System

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

leetcodemediumhash-tablestringdesigntrie
LeetCode 1819 - Number of Different Subsequences GCDs

The problem asks us to compute how many distinct values can appear as the GCD of some non-empty subsequence of the given array. A subsequence is formed by deleting zero or more elements while preserving order.

leetcodehardarraymathcountingnumber-theory
CF 45D - Event Dates

Each event has a range of possible days when it could have happened. For the -th event, any integer day between and is acceptable. We must assign exactly one day to every event, and no two events may share the same day.

codeforcescompetitive-programminggreedymeet-in-the-middlesortings
LeetCode 106 - Construct Binary Tree from Inorder and Postorder Traversal

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

leetcodemediumarrayhash-tabledivide-and-conquertreebinary-tree
LeetCode 272 - Closest Binary Search Tree Value II

This problem asks us to find the k values in a Binary Search Tree, or BST, whose values are numerically closest to a given floating point target. A BST has a very important property: - Every value in the left subtree is smaller than the current node.

leetcodehardtwo-pointersstacktreedepth-first-searchbinary-search-treeheap-(priority-queue)binary-tree
CF 117A - Elevator

The elevator follows a completely deterministic cycle. It starts at floor 1 at time 0, climbs one floor per second until it reaches floor m, then immediately reverses direction and goes back down to floor 1, again moving one floor per second.

codeforcescompetitive-programmingimplementationmath
LeetCode 1822 - Sign of the Product of an Array

The problem asks us to determine the sign of the product of all numbers in an integer array, without necessarily computing the actual product itself.

leetcodeeasyarraymath
CF 14A - Letter

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

codeforcescompetitive-programmingimplementation
CF 85D - Sum of Medians

We are asked to maintain a dynamic set of positive integers under three operations: adding a number, deleting a number, and computing the sum of medians of every consecutive group of five elements after sorting the set.

codeforcescompetitive-programmingbinary-searchbrute-forcedata-structuresimplementation
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 1524 - Number of Sub-arrays With Odd Sum

The problem asks us to count the number of subarrays within a given integer array arr whose sums are odd. A subarray is defined as a contiguous segment of the original array. The input is a list of integers, and we need to return the count of subarrays whose total sum is odd.

leetcodemediumarraymathdynamic-programmingprefix-sum
LeetCode 312 - Burst Balloons

The problem gives us an array nums, where each element represents a balloon containing a number. When we burst a balloon at index i, we gain coins equal to: The important detail is that the neighbors of a balloon change dynamically as balloons are removed.

leetcodehardarraydynamic-programming
LeetCode 1397 - Find All Good Strings

The problem asks us to count how many strings of length n satisfy three conditions simultaneously: 1. The string must be lexicographically greater than or equal to s1 2. The string must be lexicographically less than or equal to s2 3.

leetcodehardstringdynamic-programmingstring-matching
CF 64B - Expression

The input is a tiny arithmetic expression written as a three-character string. The first and third characters are digits from 0 to 9, and the middle character is either + or -. The task is to evaluate the expression and print the resulting integer.

codeforcescompetitive-programming*specialexpression-parsing
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 285 - Inorder Successor in BST

This problem asks us to find the in-order successor of a given node p inside a Binary Search Tree, abbreviated as BST. An in-order traversal of a BST visits nodes in sorted order: 1. Traverse the left subtree 2. Visit the current node 3.

leetcodemediumtreedepth-first-searchbinary-search-treebinary-tree
CF 72G - Fibonacci army

The problem asks us to compute the n-th Fibonacci number, but with a slight twist in indexing: the sequence starts with f₀ = 1, f₁ = 1. Every subsequent number is the sum of the previous two.

codeforcescompetitive-programming*specialdp
LeetCode 1420 - Build Array Where You Can Find The Maximum Exactly K Comparisons

This problem asks us to count the number of arrays of length n where each element is between 1 and m inclusive, and the

leetcodeharddynamic-programmingprefix-sum
LeetCode 1696 - Jump Game VI

The problem gives us an integer array nums and a maximum jump distance k. We start at index 0, and from any position i,

leetcodemediumarraydynamic-programmingqueueheap-(priority-queue)monotonic-queue
LeetCode 834 - Sum of Distances in Tree

The problem gives us an undirected tree with n nodes labeled from 0 to n - 1. A tree is a connected graph with exactly n - 1 edges and no cycles. Each edge connects two nodes bidirectionally.

leetcodeharddynamic-programmingtreedepth-first-searchgraph-theory
CF 127B - Canvas Frames

We are given a collection of sticks, where each stick has an integer length. A rectangular frame needs four sticks arranged as two equal pairs. If the frame is a square, then all four sticks must have the same length.

codeforcescompetitive-programmingimplementation
CF 93A - Frames

The folders are displayed in a grid with exactly m columns per row. Folder 1 is in the top-left corner, folder 2 is next to it, and so on. After every m folders we move to the next row. A rectangular frame selection toggles every folder inside the rectangle.

codeforcescompetitive-programmingimplementation
LeetCode 1638 - Count Substrings That Differ by One Character

The problem asks us to count how many pairs of substrings, one taken from s and one taken from t, differ by exactly one

leetcodemediumhash-tablestringdynamic-programmingenumeration
LeetCode 714 - Best Time to Buy and Sell Stock with Transaction Fee

This problem asks us to maximize profit from stock trading over a sequence of days, where each transaction incurs a fixed fee. The input array prices represents the stock price on each day, and fee represents the transaction fee charged for every completed buy-sell transaction.

leetcodemediumarraydynamic-programminggreedy
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
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
LeetCode 1225 - Report Contiguous Dates

The problem asks us to analyze a system that runs one task per day over a fixed period, from 2019-01-01 to 2019-12-31. Each day, the task either succeeds or fails.

leetcodeharddatabase
CF 38G - Queue

We are asked to simulate a queue of people where each person has two properties: an importance value a[i] and a patience limit c[i].

codeforcescompetitive-programmingdata-structures
LeetCode 1390 - Four Divisors

The problem asks us to calculate the sum of divisors for numbers in a given integer array nums, but only for those numbe

leetcodemediumarraymath
LeetCode 1126 - Active Businesses

The problem gives us a database table named Events. Each row represents how many times a certain type of event occurred for a particular business.

leetcodemediumdatabase
LeetCode 886 - Possible Bipartition

This problem asks whether it is possible to divide n people into exactly two groups such that no pair of people who dislike each other end up in the same group.

leetcodemediumdepth-first-searchbreadth-first-searchunion-findgraph-theory
CF 56C - Corporation Mail

The problem presents a company hierarchy encoded as a string. Each employee has a name, followed optionally by a colon and a comma-separated list of subordinates, ending with a dot. If an employee has no subordinates, the colon is omitted.

codeforcescompetitive-programmingdata-structuresexpression-parsingimplementation
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 1553 - Minimum Number of Days to Eat N Oranges

This problem asks us to compute the minimum number of days required to eat exactly n oranges, given three possible actions that can be performed each day. On any single day, we may choose one of the following operations: 1. Eat exactly one orange. 2.

leetcodeharddynamic-programmingmemoization
LeetCode 723 - Candy Crush

This problem is essentially a simulation of the Candy Crush game, where we need to repeatedly crush candies in a grid until the board reaches a stable state. The input is an m x n matrix of integers representing different types of candies, and 0 represents empty cells.

leetcodemediumarraytwo-pointersmatrixsimulation
LeetCode 1683 - Invalid Tweets

This problem gives us a database table named Tweets with two columns: | Column | Description | | --- | --- | | tweetid |

leetcodeeasydatabase
CF 100D - World of Mouth

We start with an initial string and pass it around a circle of n people. Every person is allowed to modify the string in only one of two ways: 1. Remove exactly one character from the end. 2. Add exactly one character to the end. A person may also choose to do nothing.

codeforcescompetitive-programming*specialstrings
LeetCode 1189 - Maximum Number of Balloons

The problem asks us to determine the maximum number of times the word "balloon" can be formed using the characters from a given string text. Each character in text can be used at most once per occurrence of the word.

leetcodeeasyhash-tablestringcounting
LeetCode 1027 - Longest Arithmetic Subsequence

Your requested guide is very long and detailed, especially with all required sections, full prose explanations, worked traces, Python and Go implementations, complexity proofs, and extensive test coverage.

leetcodemediumarrayhash-tablebinary-searchdynamic-programming
LeetCode 107 - Binary Tree Level Order Traversal II

The problem asks us to traverse a binary tree and return the node values level by level, but in bottom-up order. Normally, a level order traversal collects values from the root down to the leaves.

leetcodemediumtreebreadth-first-searchbinary-tree
CF 54E - Vacuum Сleaner

We are given the top view of a robotic vacuum cleaner as a convex polygon. The room corner is the usual 90 degree corner formed by two perpendicular walls. We may rotate the vacuum cleaner by any angle and then push it as far as possible into the corner.

codeforcescompetitive-programminggeometry
LeetCode 46 - Permutations

The problem gives us an array of distinct integers called nums, and asks us to generate every possible permutation of those numbers. A permutation is an arrangement of elements in a specific order.

leetcodemediumarraybacktracking
LeetCode 103 - Binary Tree Zigzag Level Order Traversal

The problem asks us to perform a level order traversal of a binary tree, but with a twist. Instead of always traversing each level from left to right, we alternate the traversal direction at every level.

leetcodemediumtreebreadth-first-searchbinary-tree
CF 87C - Interesting Game

We are asked to analyze a two-player game with a single pile of n stones. The players alternate turns, starting with Serozha.

codeforcescompetitive-programmingdpgamesmath
LeetCode 1768 - Merge Strings Alternately

The problem requires merging two input strings word1 and word2 in an alternating fashion, starting with the first character of word1. This means we take one character from word1, then one character from word2, and repeat this process until one or both strings are exhausted.

leetcodeeasytwo-pointersstring
LeetCode 1271 - Hexspeak

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

leetcodeeasymathstring
CF 102B - Sum of Digits

The problem asks us to repeatedly replace a number with the sum of its digits until the number becomes a single-digit number. The input is a number n that can be extremely large, up to 10 million digits.

codeforcescompetitive-programmingimplementation
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 1045 - Customers Who Bought All Products

This problem asks us to identify all customers who have purchased every product listed in the Product table. In other words, a customer is eligible for the output if, for each productkey in the Product table, there exists a corresponding row in the Customer table where that…

leetcodemediumdatabase
LeetCode 979 - Distribute Coins in Binary Tree

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

leetcodemediumtreedepth-first-searchbinary-tree
CF 25D - Roads not only in Berland

We are given a collection of n cities connected by n-1 roads. This means the current network forms a forest: a set of trees, because in graph terms, a connected tree with n nodes has exactly n-1 edges.

codeforcescompetitive-programmingdsugraphstrees
LeetCode 1835 - Find XOR Sum of All Pairs Bitwise AND

This problem asks us to compute the XOR sum of every possible pairwise bitwise AND between two arrays. More formally, for every pair (i, j): - Take arr1[i] AND arr2[j] - Add that result to a conceptual list - Compute the XOR of all values in that list The challenge is that…

leetcodehardarraymathbit-manipulation
LeetCode 273 - Integer to English Words

The problem asks us to convert a non-negative integer into its English words representation. Instead of returning digits such as 12345, we must produce a properly formatted English phrase such as "Twelve Thousand Three Hundred Forty Five".

leetcodehardmathstringrecursion
LeetCode 2035 - Partition Array Into Two Arrays to Minimize Sum Difference

The problem gives an array nums containing exactly 2 n integers. We must divide these integers into two separate groups, each containing exactly n elements. After forming the two groups, we compute the sum of each group and measure the absolute difference between those sums.

leetcodehardarraytwo-pointersbinary-searchdynamic-programmingbit-manipulationsortingordered-setbitmask
LeetCode 1493 - Longest Subarray of 1's After Deleting One Element

This problem asks us to find the longest contiguous subarray of 1s in a binary array nums after deleting exactly one ele

leetcodemediumarraydynamic-programmingsliding-window
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 1513 - Number of Substrings With Only 1s

The problem gives a binary string s, consisting only of the characters '0' and '1'. We must count how many substrings co

leetcodemediummathstring
CF 109B - Lucky Probability

We are asked to calculate the probability that if Petya and Vasya each pick an integer randomly from their respective intervals, the interval between the two chosen numbers contains exactly k lucky numbers. Lucky numbers are those containing only the digits 4 and 7.

codeforcescompetitive-programmingbrute-forceprobabilities
LeetCode 1619 - Mean of Array After Removing Some Elements

The problem gives us an integer array arr and asks us to compute the average value after removing the smallest 5% and th

leetcodeeasyarraysorting
LeetCode 1200 - Minimum Absolute Difference

The problem asks us to find all pairs of numbers in an array that have the smallest absolute difference. In other words, given a list of distinct integers, we want to identify every pair [a, b] such that the difference b - a is minimized across all possible pairs in the array…

leetcodeeasyarraysorting
LeetCode 771 - Jewels and Stones

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

leetcodeeasyhash-tablestring
LeetCode 1574 - Shortest Subarray to be Removed to Make Array Sorted

Please provide the full problem statement or LeetCode number you want the detailed solution guide for. You mentioned Lee

leetcodemediumarraytwo-pointersbinary-searchstackmonotonic-stack
LeetCode 769 - Max Chunks To Make Sorted

This problem is asking us to determine the maximum number of contiguous chunks into which we can split an array such that sorting each chunk individually and concatenating them results in a fully sorted array.

leetcodemediumarraystackgreedysortingmonotonic-stack
CF 21B - Intersection

Each input line describes a geometric object in the plane. The equation

codeforcescompetitive-programmingimplementationmath
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 596 - Classes With at Least 5 Students

This problem is asking us to find classes in a school database that have at least five students enrolled. The input is a table named Courses with two columns: student and class. Each row represents one student being enrolled in one class.

leetcodeeasydatabase
CF 29C - Mail Stamps

Each stamp describes a direct transfer between two cities. If the envelope contains n stamps, then the letter passed through exactly n + 1 cities in sequence. The route never revisits a city, so the entire journey forms a simple path.

codeforcescompetitive-programmingdata-structuresdfs-and-similargraphsimplementation
CF 86E - Long sequence

We are asked to construct a special kind of binary sequence, called a recurrent binary sequence. Each term in this sequence is either 0 or 1, and for a given integer k, there exist coefficients c₁, c₂, …, cₖ, also 0 or 1, such that every term from the k-th onward is a…

codeforcescompetitive-programmingbrute-forcemathmatrices
LeetCode 2017 - Grid Game

The problem gives us a 2 x n grid where each cell contains some number of points. Two robots move across this grid one after another. Both robots start at the top-left corner (0, 0) and must reach the bottom-right corner (1, n - 1). The movement rules are very restrictive.

leetcodemediumarraymatrixprefix-sum
LeetCode 1637 - Widest Vertical Area Between Two Points Containing No Points

This problem gives us a list of points on a 2D plane, where each point is represented as [x, y]. We need to find the widest vertical area that contains no points strictly inside it. A vertical area is defined by two vertical lines.

leetcodeeasyarraysorting
LeetCode 1021 - Remove Outermost Parentheses

Unusual activity has been detected from your device. Try again later. (36c3723c-3fa3-4b63-a514-20d2635d5e47)

leetcodeeasystringstack
CF 55A - Flea travel

We have n positions arranged in a circle. The flea starts on one position. After the first minute it moves forward by 1 step, after the second minute by 2 steps, after the third minute by 3 steps, and so on.

codeforcescompetitive-programmingimplementationmath
LeetCode 1275 - Find Winner on a Tic Tac Toe Game

This problem asks us to simulate a game of Tic-Tac-Toe on a 3 x 3 grid given a sequence of moves. Each move specifies th

leetcodeeasyarrayhash-tablematrixsimulation
CF 81A - Plug-in

We are given a lowercase string that may contain accidental repeated keystrokes. Whenever two equal characters become adjacent, both characters must be deleted. After removing one pair, new adjacent equal pairs may appear, and those must also be removed.

codeforcescompetitive-programmingimplementation
CF 43E - Race

We are asked to analyze a straight-line race of length _s_ kilometers involving _n_ cars. Each car has a list of driving segments, and each segment specifies a constant speed and a duration. The car moves at that speed for the given time before switching to the next segment.

codeforcescompetitive-programmingbrute-forceimplementationtwo-pointers
CF 28E - DravDe saves the world

We are given a simple polygon on the plane, representing the incubator area. DravDe starts at point , which is guaranteed to lie strictly outside the polygon.

codeforcescompetitive-programminggeometrymath
LeetCode 913 - Cat and Mouse

In this problem, we are given an undirected graph where two players, Mouse and Cat, move alternately across the graph according to specific rules. The graph is represented as an adjacency list, where graph[a] contains all nodes directly connected to node a.

leetcodehardmathdynamic-programminggraph-theorytopological-sortmemoizationgame-theory
LeetCode 269 - Alien Dictionary

This problem asks us to reconstruct the ordering of characters in an unknown alien language. We are given a list of words that are already sorted according to the alien language's lexicographical order.

leetcodehardarraystringdepth-first-searchbreadth-first-searchgraph-theorytopological-sort
CF 12E - Start of the session

We are asked to construct a square matrix of size _n_ × _n_, where _n_ is an even number. The matrix must satisfy four properties. The main diagonal contains only zeroes.

codeforcescompetitive-programmingconstructive-algorithms
LeetCode 1134 - Armstrong Number

In this problem, we are given an integer n, and we must determine whether it is an Armstrong number. An Armstrong number is defined as follows: - Let k be the number of digits in n. - Take every digit in the number. - Raise each digit to the power k.

leetcodeeasymath
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
LeetCode 756 - Pyramid Transition Matrix

Here’s a full, detailed technical solution guide for LeetCode 756 - Pyramid Transition Matrix, following your formatting rules precisely.

leetcodemediumhash-tablestringbacktrackingbit-manipulation
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 569 - Median Employee Salary

The problem gives us an Employee table containing three columns: Column Meaning --- --- id Unique employee identifier company Company name salary Employee salary We need to return the row or rows that correspond to the median salary for each company.

leetcodeharddatabase