Tags¶
TODO¶
- [CodeChef] Starters 84 — SUM OR: a correct digit DP that still TLEs
- [CodeChef] Starters 88 — Chef and Good Array: pairs are intervals
- [CodeChef] Starters 88 — Minimize the Bits: the one I couldn't solve
ad_hoc¶
- [CodeChef] Starters 117 — Equality Etiquette: the sign choice is the whole problem
- [CodeChef] Starters 253 — Flower Reversal: only the two boundaries move
- [CodeChef] Starters 96 — Zero Array: when the last equation is the whole problem
amortized_analysis¶
arrays¶
atcoder¶
- [AtCoder] ABC 476 D — Automat: equal money, unequal wallets
- [AtCoder] ABC466 C — Count Close Pairs
- [AtCoder] ABC469 E — Pro Exam Eligibility
- [AtCoder] ABC470 C — Inc, Dec, Xor: the "pay with tokens you already minted" trick
- [AtCoder] ABC471 D — Chargers: subtract the common term
- [AtCoder] ABC472 E — Odd Cycle: depth parity, and two bugs in reconstructing the cycle
- [AtCoder] ARC226 A — Meeting Division: when the constraint is the solution
backtracking¶
bfs¶
- [CodeChef] Starters 106 — Reach Anywhere: finding shortest odd and even parity distances
- [CodeChef] Starters 116 — Expected Diameter: two extra nodes and the vertices that matter
bfs_tree¶
binary_search¶
- [AtCoder] ABC469 E — Pro Exam Eligibility
- [CodeChef] Starters 115 — Make All Zero: Only Prefix Minima Can Be Eliminated
- [CodeChef] Starters 253 — Dis-Card: my dominance count was off by one, and off by a lot
- [CodeChef] Starters 89 — Two Averages: fix the total, then split it
- [CodeChef] Starters 97 — Triplets Min: the binary search that collapses into a prefix sum
- [LeetCode] Weekly Contest 514 — Maximum Area of Two Non-Overlapping Square Submatrices: only the extremes can witness a valid pair
- [LeetCode] Weekly Contest 515 — Maximum Gap Between Stations: greedy extremes, and the max-of-max trap
- [Leetcode] Biweekly 188 — Minimum Possible Maximum Waiting Time
- [Repovive] Starter Round 4 D — Distant Transfers: Deriving Invariants Instead of Constructing Moves
bipartite¶
- [AtCoder] ABC472 E — Odd Cycle: depth parity, and two bugs in reconstructing the cycle
- [CodeChef] Starters 96 — Zero Array: when the last equation is the whole problem
bit_manipulation¶
- [CodeChef] Starters 84 — SUM OR: a correct digit DP that still TLEs
- [CodeChef] Starters 88 — Minimize the Bits: the one I couldn't solve
- [Codeforces] Round 2239 D1 — XOR Sorting (Easy)
bitmask¶
- [CodeChef] Starters 93 — Greedy: the problem is called Greedy and the answer is a DP
- [LeetCode] Weekly Contest 515 — Elevator Requests III: Held–Karp, a poisoned sentinel, and a duplicate-floor scare
bitmasks¶
brute_force¶
- [CodeChef] Starters 253 — Grid Jump: I assumed the answer sits at a corner
- [Codeforces] Round 1103 (Div. 3) E — Friendly Gifts: Disjoint Value Intervals
codechef¶
- [CodeChef] FALLPR — Fall Prevention: I deleted the wrong element
- [CodeChef] SHSC — Shift Score: I reached for rerooting when counting edges was enough
- [CodeChef] Starters 105 — Wishcraft
- [CodeChef] Starters 106 — Reach Anywhere: finding shortest odd and even parity distances
- [CodeChef] Starters 108 — Clan Expansion: the largest gap between sources
- [CodeChef] Starters 115 — Make All Zero: Only Prefix Minima Can Be Eliminated
- [CodeChef] Starters 116 — Expected Diameter: two extra nodes and the vertices that matter
- [CodeChef] Starters 117 — Equality Etiquette: the sign choice is the whole problem
- [CodeChef] Starters 247 — Fair Flipping (Easy): What This Constructive Proof Taught Me
- [CodeChef] Starters 247 — Red Blue Swaps: From Swaps to Buckets (A DP Pattern)
- [CodeChef] Starters 250 — Subsequence 1: Chains, not cuts
- [CodeChef] Starters 250 — Subsequence 2: Counting windows, one threshold at a time
- [CodeChef] Starters 252 — Tree Counting: a parity invariant, Scoins' formula, and a DP state I got wrong
- [CodeChef] Starters 253 — Dis-Card: my dominance count was off by one, and off by a lot
- [CodeChef] Starters 253 — Flower Reversal: only the two boundaries move
- [CodeChef] Starters 253 — Grid Jump: I assumed the answer sits at a corner
- [CodeChef] Starters 81 — Beautiful Strings: the DP state I didn't need
- [CodeChef] Starters 81 — Good XOR: the case I ruled out with a parity argument
- [CodeChef] Starters 84 — SUM OR: a correct digit DP that still TLEs
- [CodeChef] Starters 86 — Minimum Operation: the case my gut missed
- [CodeChef] Starters 87 — Count the Permutations (always)
- [CodeChef] Starters 88 — Chef and Good Array: pairs are intervals
- [CodeChef] Starters 88 — Minimize the Bits: the one I couldn't solve
- [CodeChef] Starters 89 — Two Averages: fix the total, then split it
- [CodeChef] Starters 90 — Minimum Ugliness: the diameter of a subset
- [CodeChef] Starters 93 — Greedy: the problem is called Greedy and the answer is a DP
- [CodeChef] Starters 93 — Thank U, Next: dijkstra on energy graph
- [CodeChef] Starters 95 — Break This Array: the cut probability I kept forgetting
- [CodeChef] Starters 96 — Zero Array: when the last equation is the whole problem
- [CodeChef] Starters 97 — Triplets Min: the binary search that collapses into a prefix sum
codeforces¶
- [Codeforces] Edu Round 192 B — A Small Algebra Trick That Turns an O(n²) Idea into O(n)
- [Codeforces] Edu Round 192 D — From Merging Digits to Longest Common Subsequence
- [Codeforces] Round 1103 (Div. 3) E — Friendly Gifts: Disjoint Value Intervals
- [Codeforces] Round 1103 (Div. 3) F1 — Elections in Saransk (Easy Version): Prime-wise Counting
- [Codeforces] Round 1103 (Div. 3) F2 — Elections in Saransk (Hard Version): Sum-minus-Max DP
- [Codeforces] Round 179 (Div. 1) B — Greg and Graph: Learning to Think in Reverse
- [Codeforces] Round 2239 D1 — XOR Sorting (Easy)
- [Codeforces] Round 267 (Div. 2) C — George and Job: DP on Fixed-Length Segments
combinatorics¶
- [CodeChef] Starters 81 — Beautiful Strings: the DP state I didn't need
- [CodeChef] Starters 84 — SUM OR: a correct digit DP that still TLEs
- [CodeChef] Starters 87 — Count the Permutations (always)
- [CodeChef] Starters 97 — Triplets Min: the binary search that collapses into a prefix sum
complexity_analysis¶
constructive¶
- [CodeChef] Starters 117 — Equality Etiquette: the sign choice is the whole problem
- [CodeChef] Starters 96 — Zero Array: when the last equation is the whole problem
constructive_algorithms¶
contribution_technique¶
convolution¶
counting¶
- [CodeChef] Starters 116 — Expected Diameter: two extra nodes and the vertices that matter
- [CodeChef] Starters 250 — Subsequence 2: Counting windows, one threshold at a time
- [CodeChef] Starters 252 — Tree Counting: a parity invariant, Scoins' formula, and a DP state I got wrong
- [CodeChef] Starters 81 — Beautiful Strings: the DP state I didn't need
- [CodeChef] Starters 87 — Count the Permutations (always)
- [Leetcode] Biweekly 188 — Fence Width Optimization: From O(n³) to O(n²)
cp_cases¶
cycles¶
dfs¶
digit_dp¶
dijkstra¶
divisibility¶
dynamic_programming¶
- Dynamic Programming
- [CodeChef] Starters 247 — Red Blue Swaps: From Swaps to Buckets (A DP Pattern)
- [CodeChef] Starters 250 — Subsequence 1: Chains, not cuts
- [CodeChef] Starters 250 — Subsequence 2: Counting windows, one threshold at a time
- [CodeChef] Starters 252 — Tree Counting: a parity invariant, Scoins' formula, and a DP state I got wrong
- [CodeChef] Starters 81 — Beautiful Strings: the DP state I didn't need
- [CodeChef] Starters 84 — SUM OR: a correct digit DP that still TLEs
- [CodeChef] Starters 88 — Chef and Good Array: pairs are intervals
- [CodeChef] Starters 93 — Greedy: the problem is called Greedy and the answer is a DP
- [CodeChef] Starters 95 — Break This Array: the cut probability I kept forgetting
- [Codechef] Starters 248 — Merging Parity
- [Codeforces] Edu Round 192 D — From Merging Digits to Longest Common Subsequence
- [Codeforces] Round 1103 (Div. 3) F2 — Elections in Saransk (Hard Version): Sum-minus-Max DP
- [Codeforces] Round 267 (Div. 2) C — George and Job: DP on Fixed-Length Segments
- [LeetCode] Weekly Contest 514 — Maximum Area of Two Non-Overlapping Square Submatrices: only the extremes can witness a valid pair
- [LeetCode] Weekly Contest 515 — Elevator Requests III: Held–Karp, a poisoned sentinel, and a duplicate-floor scare
- [Leetcode] Biweekly 186 — Count Distinct Ways to Form Target from Two Strings
- [Leetcode] Biweekly 188 — Minimum Possible Maximum Waiting Time
expected_value¶
fft¶
floyd_warshall¶
gcd¶
graph¶
graph_theory¶
- [AtCoder] ARC226 A — Meeting Division: when the constraint is the solution
- [CodeChef] Starters 116 — Expected Diameter: two extra nodes and the vertices that matter
- [CodeChef] Starters 90 — Minimum Ugliness: the diameter of a subset
graphs¶
- [AtCoder] ABC472 E — Odd Cycle: depth parity, and two bugs in reconstructing the cycle
- [CodeChef] Starters 106 — Reach Anywhere: finding shortest odd and even parity distances
- [Codeforces] Round 179 (Div. 1) B — Greg and Graph: Learning to Think in Reverse
- [Codeforces] Round 2239 D1 — XOR Sorting (Easy)
greedy¶
- [AtCoder] ABC 476 D — Automat: equal money, unequal wallets
- [CodeChef] FALLPR — Fall Prevention: I deleted the wrong element
- [CodeChef] Starters 105 — Wishcraft
- [CodeChef] Starters 108 — Clan Expansion: the largest gap between sources
- [CodeChef] Starters 115 — Make All Zero: Only Prefix Minima Can Be Eliminated
- [CodeChef] Starters 250 — Subsequence 1: Chains, not cuts
- [CodeChef] Starters 253 — Dis-Card: my dominance count was off by one, and off by a lot
- [CodeChef] Starters 253 — Flower Reversal: only the two boundaries move
- [CodeChef] Starters 253 — Grid Jump: I assumed the answer sits at a corner
- [CodeChef] Starters 81 — Good XOR: the case I ruled out with a parity argument
- [CodeChef] Starters 88 — Chef and Good Array: pairs are intervals
- [CodeChef] Starters 88 — Minimize the Bits: the one I couldn't solve
- [CodeChef] Starters 89 — Two Averages: fix the total, then split it
- [LeetCode] Weekly Contest 515 — Elevator Requests III: Held–Karp, a poisoned sentinel, and a duplicate-floor scare
- [LeetCode] Weekly Contest 515 — Maximum Gap Between Stations: greedy extremes, and the max-of-max trap
- [Repovive] Starter Round 4 D — Distant Transfers: Deriving Invariants Instead of Constructing Moves
- [yukicoder] Contest 509 — Product: the answer is always 2^k times 2^k-1
hash_maps¶
hashing¶
heap¶
interactive¶
interval_graphs¶
intervals¶
invariants¶
- [AtCoder] ABC471 D — Chargers: subtract the common term
- [CodeChef] Starters 252 — Tree Counting: a parity invariant, Scoins' formula, and a DP state I got wrong
- [CodeChef] Starters 81 — Good XOR: the case I ruled out with a parity argument
- [Codechef] Starters 248 — Deleting Elements (Easy)
- [LeetCode] Weekly Contest 514 — Maximum Area of Two Non-Overlapping Square Submatrices: only the extremes can witness a valid pair
lca¶
lcs¶
leetcode¶
- [LeetCode] Weekly Contest 514 — Maximum Area of Two Non-Overlapping Square Submatrices: only the extremes can witness a valid pair
- [LeetCode] Weekly Contest 515 — Elevator Requests III: Held–Karp, a poisoned sentinel, and a duplicate-floor scare
- [LeetCode] Weekly Contest 515 — Maximum Gap Between Stations: greedy extremes, and the max-of-max trap
- [LeetCode] Weekly Contest 516 — Valid K-Unique Subarrays I: Mo's algorithm, and where the √N actually comes from
- [Leetcode] Biweekly 186 — Count Distinct Ways to Form Target from Two Strings
- [Leetcode] Biweekly 188 — Fence Width Optimization: From O(n³) to O(n²)
- [Leetcode] Biweekly 188 — Minimum Possible Maximum Waiting Time
- [Leetcode] Weekly 509 — Palindromic Subarray Sum with Rolling Hashes
- [Leetcode] Weekly 509 — Subsequence After One Replacement: Did You Consume the Matched Character?
linear_algebra¶
math¶
- [CodeChef] Starters 117 — Equality Etiquette: the sign choice is the whole problem
- [CodeChef] Starters 253 — Grid Jump: I assumed the answer sits at a corner
- [CodeChef] Starters 89 — Two Averages: fix the total, then split it
- [Repovive] Starter Round 4 C — Corner Meeting: Minimizing the Max of an Increasing and a Decreasing Function
missed_case¶
mobius¶
modular_arithmetic¶
mos_algorithm¶
new_pattern¶
ntt¶
number_theory¶
- Dynamic Programming
- Möbius Function
- Number Theory
- [CodeChef] Starters 86 — Minimum Operation: the case my gut missed
- [Codeforces] Round 1103 (Div. 3) F1 — Elections in Saransk (Easy Version): Prime-wise Counting
- [Codeforces] Round 1103 (Div. 3) F2 — Elections in Saransk (Hard Version): Sum-minus-Max DP
numpy¶
offline_queries¶
palindromes¶
parity¶
- [CodeChef] Starters 117 — Equality Etiquette: the sign choice is the whole problem
- [CodeChef] Starters 253 — Grid Jump: I assumed the answer sits at a corner
- [CodeChef] Starters 81 — Good XOR: the case I ruled out with a parity argument
- [CodeChef] Starters 96 — Zero Array: when the last equation is the whole problem
pending¶
permutations¶
- [CodeChef] Starters 253 — Dis-Card: my dominance count was off by one, and off by a lot
- [CodeChef] Starters 87 — Count the Permutations (always)
polynomials¶
prefix_sums¶
- [AtCoder] ABC 476 D — Automat: equal money, unequal wallets
- [AtCoder] ABC469 E — Pro Exam Eligibility
- [AtCoder] ARC226 A — Meeting Division: when the constraint is the solution
- [CodeChef] FALLPR — Fall Prevention: I deleted the wrong element
- [CodeChef] Starters 97 — Triplets Min: the binary search that collapses into a prefix sum
- [Codeforces] Edu Round 192 B — A Small Algebra Trick That Turns an O(n²) Idea into O(n)
- [LeetCode] Weekly Contest 514 — Maximum Area of Two Non-Overlapping Square Submatrices: only the extremes can witness a valid pair
probability¶
problem_solving¶
python¶
- [AtCoder] ABC 476 D — Automat: equal money, unequal wallets
- [CodeChef] FALLPR — Fall Prevention: I deleted the wrong element
- [CodeChef] Starters 81 — Beautiful Strings: the DP state I didn't need
- [CodeChef] Starters 81 — Good XOR: the case I ruled out with a parity argument
- [CodeChef] Starters 84 — SUM OR: a correct digit DP that still TLEs
- [CodeChef] Starters 86 — Minimum Operation: the case my gut missed
- [CodeChef] Starters 87 — Count the Permutations (always)
- [CodeChef] Starters 88 — Chef and Good Array: pairs are intervals
- [CodeChef] Starters 88 — Minimize the Bits: the one I couldn't solve
- [CodeChef] Starters 89 — Two Averages: fix the total, then split it
- [CodeChef] Starters 90 — Minimum Ugliness: the diameter of a subset
- [CodeChef] Starters 93 — Greedy: the problem is called Greedy and the answer is a DP
- [CodeChef] Starters 93 — Thank U, Next: dijkstra on energy graph
recursion¶
repovive¶
- [Repovive] Starter Round 4 C — Corner Meeting: Minimizing the Max of an Increasing and a Decreasing Function
- [Repovive] Starter Round 4 D — Distant Transfers: Deriving Invariants Instead of Constructing Moves
rolling_hashing¶
rust¶
scheduling¶
shortest_paths¶
- [CodeChef] Starters 106 — Reach Anywhere: finding shortest odd and even parity distances
- [CodeChef] Starters 93 — Thank U, Next: dijkstra on energy graph
- [Codeforces] Round 179 (Div. 1) B — Greg and Graph: Learning to Think in Reverse
sieve¶
silly_mistake¶
- [CodeChef] FALLPR — Fall Prevention: I deleted the wrong element
- [CodeChef] Starters 253 — Grid Jump: I assumed the answer sits at a corner
sorting¶
- [CodeChef] Starters 105 — Wishcraft
- [CodeChef] Starters 97 — Triplets Min: the binary search that collapses into a prefix sum
sparse_table¶
sqrt_decomposition¶
strings¶
- [CodeChef] Starters 253 — Flower Reversal: only the two boundaries move
- [CodeChef] Starters 93 — Greedy: the problem is called Greedy and the answer is a DP
subset_sum¶
todo¶
- [CodeChef] SHSC — Shift Score: I reached for rerooting when counting edges was enough
- [CodeChef] Starters 95 — Break This Array: the cut probability I kept forgetting
trees¶
- [CodeChef] SHSC — Shift Score: I reached for rerooting when counting edges was enough
- [CodeChef] Starters 116 — Expected Diameter: two extra nodes and the vertices that matter
- [CodeChef] Starters 252 — Tree Counting: a parity invariant, Scoins' formula, and a DP state I got wrong
- [CodeChef] Starters 90 — Minimum Ugliness: the diameter of a subset
two_pointers¶
- Two Pointers
- [AtCoder] ABC 476 D — Automat: equal money, unequal wallets
- [AtCoder] ABC466 C — Count Close Pairs
- [AtCoder] ABC469 E — Pro Exam Eligibility
- [LeetCode] Weekly Contest 515 — Maximum Gap Between Stations: greedy extremes, and the max-of-max trap
- [Leetcode] Weekly 509 — Subsequence After One Replacement: Did You Consume the Matched Character?
unnessary_introduction_of_complexity¶
xor¶
- [AtCoder] ABC470 C — Inc, Dec, Xor: the "pay with tokens you already minted" trick
- [Codeforces] Round 2239 D1 — XOR Sorting (Easy)