---
schema_version: "1.0"
project_name: "reasons"
updated_at: "2026-08-15T22:56:54+00:00"
node_count: 1790
generator: ftl-reasons/0.48.0
---

# Belief Registry
<!-- Generated by reasons export-markdown. Do not edit — operate through reasons. -->

## Repos
- leetcode-implementations: /Users/ben/git/leetcode-implementations

## Claims

### absences-monotonic-lates-resettable [IN] OBSERVATION
In `checkRecord`, `absences` is monotonically increasing (global count) while `consecutive_lates` resets on every non-`'L'` character (local streak), reflecting the two different rule scopes
- Source: entries/2026/06/06/student-attendance-record-i-solution.md

### abstraction-cost-predicts-convergence-strength [IN] DERIVED
Strategy convergence strength in an uncoordinated repo appears predictable from abstraction overhead: streaming (zero abstractions) converges strongest, hash-then-stream (one preprocessing step with Counter/set) converges next, sort-then-scan (ordering prerequisite plus pointer management) converges weakest — the adoption barrier gradient closely tracks the abstraction cost gradient.
- Depends on: adoption-barrier-gradient-explains-convergence-pattern, abstraction-overhead-explains-strategy-hierarchy

### abstraction-overhead-explains-strategy-hierarchy [IN] DERIVED
Non-streaming strategies require lookup abstractions (Counter, set, binary search) as load-bearing infrastructure between pipeline phases, while streaming requires none — this asymmetric abstraction overhead causally explains the strategy hierarchy: streaming dominates because it avoids the data-structure selection and initialization cost that alternatives impose on each solution author.
- Depends on: lookup-abstractions-instantiate-pipeline-phases, streaming-is-privileged-default-strategy

### add-strings-avoids-int-conversion [IN] OBSERVATION
`addStrings` converts between characters and digit values using `ord()/chr()` arithmetic (`ord(c) - 48`, `chr(d + 48)`) and never calls `int()` or `str()`, satisfying the problem's constraint against built-in integer conversion.
- Source: entries/2026/06/06/add-strings-solution.md

### add-to-array-form-k-as-carry [IN] OBSERVATION
The add-to-array-form solution uses the input integer `k` as both the addend and carry accumulator via `k //= 10`, eliminating the need for a separate carry variable.
- Source: entries/2026/06/06/add-to-array-form-of-integer-solution.md

### add-to-array-form-prepend-quadratic-worst-case [IN] OBSERVATION
When `k` has more digits than `num`, each extra digit triggers an O(n) `list.insert(0, ...)`, making the overflow phase O(d*n) rather than the O(max(n,d)) achievable with append-and-reverse.
- Source: entries/2026/06/06/add-to-array-form-of-integer-solution.md

### additive-then-subtractive-counting-pattern [IN] OBSERVATION
Grid geometry problems (surface area, island perimeter) use an "add full contribution, then subtract shared faces" strategy — computing isolated values first, then removing occlusion — as a reusable template.
- Source: entries/2026/06/06/surface-area-of-3d-shapes-solution.md

### adjacent-pair-range-minus-one [IN] OBSERVATION
`range(len(nums) - 1)` with `nums[i+1]` access is the repo's standard pattern for pairwise element comparison, preventing out-of-bounds reads on the last index.
- Source: entries/2026/06/06/most-frequent-number-following-key-in-an-array-solution.md

### adoption-barrier-gradient-explains-convergence-pattern [IN] DERIVED
The repo's multi-level convergence appears to correlate with strategy self-sufficiency: streaming, which requires no preprocessing or data structure selection, exhibits the strongest convergence, consistent with the principle that lower adoption barriers tend to produce stronger convergence pressure in an uncoordinated environment. Whether this gradient extends predictably to other paradigms (sort-then-scan, hash-then-scan) remains an observed pattern rather than a confirmed causal relationship.
- Depends on: convergence-without-coordination-at-every-level, streaming-dominates-because-lowest-adoption-barrier

### algorithmic-coherence-emerges-without-engineering [IN] DERIVED
Despite zero cross-solution coordination and no consistency enforcement, solutions independently converge on two dominant paradigms (streaming and sort-then-scan), demonstrating that LeetCode's problem domain naturally constrains the algorithmic solution space.
- Depends on: repo-optimized-for-submission-not-engineering, two-paradigms-cover-solution-space

### algorithmic-precision-despite-engineering-neglect [IN] DERIVED
The repo invests in algorithmic quality (exact arithmetic via isqrt, integer division; stdlib delegation for precision via Counter, set) while neglecting engineering quality (naming, structure, reusability), creating an asymmetry where computational correctness is high but code maintainability is low.
- Depends on: repo-optimized-for-submission-not-engineering, stdlib-reinforces-exactness

### alias-is-identity [IN] OBSERVATION
`min_time_to_remove_balloons` is a module-level alias (same function object) for `countStudents`, not a wrapper — likely exists for a test harness or problem variant that expects that name.
- Source: entries/2026/06/06/number-of-students-unable-to-eat-lunch-solution.md

### alien-dict-assumes-valid-order [IN] OBSERVATION
The alien dictionary solution assumes `order` covers all characters in `words`; a missing character produces an unhandled `KeyError` — no input validation.
- Source: entries/2026/06/06/verifying-an-alien-dictionary-solution.md

### alien-dict-function-misnamed [IN] OBSERVATION
The function solving LeetCode 953 (alien dictionary verification) is named `reverse_string`, which has nothing to do with its actual behavior — a naming bug, not an alias.
- Source: entries/2026/06/06/verifying-an-alien-dictionary-solution.md

### alien-dict-prefix-rule [IN] OBSERVATION
The alien dictionary solution explicitly enforces the prefix rule: if all shared characters match but the first word is longer, it returns `False`.
- Source: entries/2026/06/06/verifying-an-alien-dictionary-solution.md

### alien-dict-rank-map-idiom [IN] OBSERVATION
The alien dictionary solution builds a `{char: index}` dict from the ordering string, converting custom-alphabet comparison to integer comparison with O(1) lookups.
- Source: entries/2026/06/06/verifying-an-alien-dictionary-solution.md

### all-groups-equal-length-k [IN] OBSERVATION
Every element returned by divideString has exactly k characters, guaranteed by the pad step preceding the slice step.
- Source: entries/2026/06/06/divide-a-string-into-groups-of-size-k-solution.md

### all-nonalgorithmic-defects-invisible-at-runtime [IN] DERIVED
All engineering defects — whether sourced from the generation pipeline (naming errors, stale aliases) or from the isolation architecture (tooling confusion, convention drift, duplicated definitions) — are invisible at runtime because the submission-optimized architecture confines their blast radius to non-functional dimensions.
- Source type: derived
- Depends on: generation-errors-remain-invisible, zero-coupling-cost-invisible-at-runtime
- Unless: misnamed-module-exports-in-test-harness

### all-ones-check-idiom [IN] OBSERVATION
`(m & (m + 1)) == 0` tests whether `m` is zero or all-ones up to the MSB — the complement of the `n & (n-1) == 0` power-of-two check, reusable across bit-manipulation problems.
- Source: entries/2026/06/06/binary-number-with-alternating-bits-solution.md

### all-solutions-pure-python-no-imports [IN] OBSERVATION
All five solutions use only Python builtins and (optionally) `typing.List` or `unittest` — none import third-party libraries or non-trivial standard library modules, keeping each solution self-contained
- Source: entries/2026/06/06/largest-local-values-in-a-matrix-solution.md

### all-solutions-reduce-to-adapted-streaming [IN] DERIVED
Every solution in the repo is fundamentally a streaming algorithm: pure streaming solutions operate directly, while sort-then-scan and hash-then-scan solutions use preprocessing as a domain adapter that transforms the problem into one where streaming's self-sufficiency applies — making the preprocessing phase structurally optional rather than architecturally distinct.
- Source type: derived
- Depends on: preprocessing-is-domain-transformation-to-streaming, streaming-is-self-sufficient-paradigm

### alternating-bits-o1 [IN] OBSERVATION
`has_alternating_bits` runs in O(1) time and space with no loops or string conversion — pure arithmetic on two intermediate values.
- Source: entries/2026/06/06/binary-number-with-alternating-bits-solution.md

### anagram-check-uses-sorted-canonical-form [IN] OBSERVATION
Anagram comparison in `anagramOperations` uses `sorted(word) == sorted(other)` — O(k log k) per word but avoids the complexity of frequency-counting approaches.
- Source: entries/2026/06/06/find-resultant-array-after-removing-anagrams-solution.md

### anagram-comparison-target-is-last-accepted [IN] OBSERVATION
Each word is compared against `result[-1]` (the last *accepted* word), not the previous word in the input — when consecutive anagrams are dropped, the comparison target stays the same until a non-anagram breaks the run.
- Source: entries/2026/06/06/find-resultant-array-after-removing-anagrams-solution.md

### anagram-dedup-consecutive-only [IN] OBSERVATION
`anagramOperations` only collapses *consecutive* anagram runs; non-adjacent anagram pairs survive (e.g., `["ab", "cd", "ba"]` returns unchanged).
- Source: entries/2026/06/06/find-resultant-array-after-removing-anagrams-solution.md

### anagram-mappings-duplicate-safe [IN] OBSERVATION
`anagramMappings` handles duplicate values correctly by queuing all indices per value in a `defaultdict(deque)`, with each occurrence in `nums1` consuming exactly one queued index via `pop()`.
- Source: entries/2026/06/06/find-anagram-mappings-solution.md

### anagram-mappings-lifo-index-order [IN] OBSERVATION
When duplicates exist, `anagramMappings` assigns indices in LIFO order (last-appended index consumed first) because `deque.pop()` removes from the right.
- Source: entries/2026/06/06/find-anagram-mappings-solution.md

### anagram-ops-crashes-on-empty [IN] OBSERVATION
`anagramOperations([])` raises `IndexError` because `words[0]` is accessed unconditionally with no length check.
- Source: entries/2026/06/06/find-resultant-array-after-removing-anagrams-solution.md

### anchor-tracking-pattern-shared [IN] OBSERVATION
The "last-seen non-zero" anchor-tracking idiom appears in both `max_captured_forts` and `countHillValley` — skip irrelevant elements, compare the current significant value to the previous one.
- Source: entries/2026/06/06/maximum-enemy-forts-that-can-be-captured-solution.md

### ap-integer-division-exact [IN] OBSERVATION
In `missing-number-in-arithmetic-progression/solution.py`, the expression `(arr[-1] - arr[0]) // n` never truncates under valid inputs because the span of a valid AP is always an exact multiple of the gap count.
- Source: entries/2026/06/06/missing-number-in-arithmetic-progression-solution.md

### apples-capacity-hardcoded [IN] OBSERVATION
The basket capacity of 5000 is hardcoded in `maxNumberOfApples`, not parameterized — matching the LeetCode spec but preventing reuse with different limits.
- Source: entries/2026/06/06/how-many-apples-can-you-put-into-the-basket-solution.md

### apples-early-return-index [IN] OBSERVATION
`maxNumberOfApples` returns the loop index `i` (not `i+1`) on budget overflow because `enumerate` is zero-based and `i` equals the count of previously accumulated apples before the one that broke the budget.
- Source: entries/2026/06/06/how-many-apples-can-you-put-into-the-basket-solution.md

### apples-greedy-optimality [IN] OBSERVATION
Sorting ascending and taking greedily is provably optimal for maximizing item count under a weight budget when all items have equal value (1 apple = 1 unit).
- Source: entries/2026/06/06/how-many-apples-can-you-put-into-the-basket-solution.md

### apples-mutates-input [IN] OBSERVATION
`maxNumberOfApples` mutates the caller's list via `weight.sort()` rather than using `sorted()`, so callers cannot rely on original order being preserved.
- Source: entries/2026/06/06/how-many-apples-can-you-put-into-the-basket-solution.md

### apply-ops-two-phase-pattern [IN] OBSERVATION
`apply-operations-to-an-array` uses a two-phase in-place transformation: Phase 1 (pairwise doubling, left-to-right with sequential dependency) must complete before Phase 2 (zero compaction via write-pointer), and interleaving them produces incorrect results.
- Source: entries/2026/06/06/apply-operations-to-an-array-solution.md

### architecture-immune-to-own-engineering-defects [IN] DERIVED
The repo's architecture exhibits structural immunity to its own engineering defects: zero-coupling costs are invisible at runtime because each solution's correctness is independent, and the most prominent such cost — naming drift — serves no functional role at any layer. This means the architecture cannot be degraded by the class of inconsistencies it systematically produces; even adversarial naming errors would be absorbed without observable effect.
- Source type: derived
- Depends on: zero-coupling-cost-invisible-at-runtime, names-serve-no-functional-role

### arithmetic-progression-mutates-input [IN] OBSERVATION
`can_construct` calls `arr.sort()`, mutating the input list in place; callers needing the original order must pass a copy.
- Source: entries/2026/06/06/can-make-arithmetic-progression-from-sequence-solution.md

### arithmetic-progression-sort-then-scan [IN] OBSERVATION
`can_construct` sorts the input then verifies constant consecutive difference in one pass — O(n log n) time, O(1) extra space beyond the sort.
- Source: entries/2026/06/06/can-make-arithmetic-progression-from-sequence-solution.md

### arithmetic-triplets-set-lookup-linear [IN] OBSERVATION
`count_arithmetic_triplets` achieves O(n) time via set-based membership lookups, treating each element as the largest of a potential triplet and checking for `x - diff` and `x - 2*diff` in a `seen` set
- Source: entries/2026/06/06/number-of-arithmetic-triplets-solution.md

### array-partition-mutates-input [IN] OBSERVATION
`nums.sort()` mutates the caller's list in-place rather than using `sorted()` to preserve the original.
- Source: entries/2026/06/06/array-partition-solution.md

### array-partition-no-validation [IN] OBSERVATION
`array_pair_sum` assumes even-length input and performs no length or type checking; odd-length input silently produces a wrong answer.
- Source: entries/2026/06/06/array-partition-solution.md

### array-partition-sort-greedy [IN] OBSERVATION
`array_pair_sum` uses sort + even-index sum as its greedy strategy; no dynamic programming or enumeration.
- Source: entries/2026/06/06/array-partition-solution.md

### array-transform-endpoints-immutable [IN] OBSERVATION
The first and last elements of the array are never modified; only indices 1 through len-2 are candidates for change.
- Source: entries/2026/06/06/array-transformation-solution.md

### array-transform-no-mutation [IN] OBSERVATION
The input list is copied on entry (`arr[:]`), so the caller's original list is never modified — contrasting with array-partition and assign-cookies which mutate in-place.
- Source: entries/2026/06/06/array-transformation-solution.md

### array-transform-simultaneous-update [IN] OBSERVATION
All comparisons in a single round use the pre-round snapshot (`arr`), not the in-progress mutations (`new`), making updates simultaneous rather than sequential.
- Source: entries/2026/06/06/array-transformation-solution.md

### array-transform-strict-comparison [IN] OBSERVATION
Only strict local minima/maxima trigger adjustments; elements equal to a neighbor are left unchanged, meaning plateaus are inherently stable.
- Source: entries/2026/06/06/array-transformation-solution.md

### ascending-check-uses-sentinel-minus-one [IN] OBSERVATION
`areNumbersAscending` initializes `prev = -1`, relying on the constraint that all numbers are positive integers (1–200); any other sentinel could break the first comparison
- Source: entries/2026/06/06/check-if-numbers-are-ascending-in-a-sentence-solution.md

### ascending-subarray-empty-input-crashes [IN] OBSERVATION
Passing an empty list raises `IndexError` on `nums[0]`; the function relies on the LeetCode guarantee that `nums` is non-empty rather than handling this edge case.
- Source: entries/2026/06/06/maximum-ascending-subarray-sum-solution.md

### ascending-subarray-function-name-is-wrong [IN] OBSERVATION
The function is named `concatenated_binary` but implements maximum ascending subarray sum; this is a copy-paste naming bug that doesn't affect correctness since tests import by name.
- Source: entries/2026/06/06/maximum-ascending-subarray-sum-solution.md

### ascending-subarray-resets-to-current [IN] OBSERVATION
On a non-ascending step, `current_sum` resets to the current element (not zero), because the current element is always the start of the next potential ascending subarray.
- Source: entries/2026/06/06/maximum-ascending-subarray-sum-solution.md

### ascending-subarray-uses-strict-inequality [IN] OBSERVATION
The ascending condition is strictly greater-than (`>`), not `>=`, so equal adjacent elements reset the running sum — matching the LeetCode specification.
- Source: entries/2026/06/06/maximum-ascending-subarray-sum-solution.md

### ascii-32-detects-case-pairs [IN] OBSERVATION
`abs(ord(a) - ord(b)) == 32` is true if and only if `a` and `b` are the same English letter in different cases, given inputs restricted to `[a-zA-Z]`, because ASCII lower and upper variants of every letter differ by exactly 32.
- Source: entries/2026/06/06/make-the-string-great-solution.md

### assign-cookies-greedy-optimal [IN] OBSERVATION
The greedy strategy (smallest sufficient cookie to least greedy child) produces a provably optimal assignment; no DP or exhaustive search needed.
- Source: entries/2026/06/06/assign-cookies-solution.md

### assign-cookies-mutates-inputs [IN] OBSERVATION
`find_content_children` mutates both input lists via in-place `.sort()`; callers cannot assume list order is preserved.
- Source: entries/2026/06/06/assign-cookies-solution.md

### assign-cookies-zero-extra-space [IN] OBSERVATION
The two-pointer algorithm uses O(1) auxiliary space beyond the in-place sort — no heaps, hash maps, or copied arrays.
- Source: entries/2026/06/06/assign-cookies-solution.md

### assumes-square-grid [IN] OBSERVATION
`projectionArea` uses a single `n = len(grid)` for both dimensions, relying on the LeetCode constraint that the grid is always n × n; non-square grids would produce incorrect results
- Source: entries/2026/06/06/projection-area-of-3d-shapes-solution.md

### average-salary-divisor-assumes-length-gte-3 [IN] OBSERVATION
The expression `len(salary) - 2` in the average-salary solution would produce a ZeroDivisionError if called with fewer than 3 elements; correctness relies on the problem's length guarantee.
- Source: entries/2026/06/06/average-salary-excluding-the-minimum-and-maximum-salary-solution.md

### average-salary-single-pass-arithmetic [IN] OBSERVATION
The average-salary solution computes the trimmed mean algebraically via `(sum - min - max) / (n - 2)` using three linear scans, avoiding O(n log n) sorting entirely.
- Source: entries/2026/06/06/average-salary-excluding-the-minimum-and-maximum-salary-solution.md

### average-salary-unique-values-invariant [IN] OBSERVATION
Correctness of the average-salary solution depends on all salary values being unique; duplicate min or max values would cause only one copy to be subtracted, producing a wrong answer.
- Source: entries/2026/06/06/average-salary-excluding-the-minimum-and-maximum-salary-solution.md

### ba-substring-equivalence [IN] OBSERVATION
`"ba" not in s` is equivalent to "every 'a' precedes every 'b'" when the input contains only 'a' and 'b' — the only way to violate the ordering is a b-to-a transition, which is exactly the substring "ba".
- Source: entries/2026/06/06/check-if-all-as-appears-before-all-bs-solution.md

### backspace-compare-reverse-two-pointer-o1-space [IN] OBSERVATION
The backspace-string-compare solution uses reverse traversal with a skip counter instead of a stack, achieving O(1) auxiliary space and O(n+m) time for comparing two backspace-processed strings.
- Source: entries/2026/06/06/backspace-string-compare-solution.md

### balanced-strings-function-name-mismatch [IN] OBSERVATION
`find_special_integer` in `split-a-string-in-balanced-strings/solution.py` does not match the problem it solves — it's a template artifact that was never renamed, suggesting other solutions may share this issue.
- Source: entries/2026/06/06/split-a-string-in-balanced-strings-solution.md

### balanced-substring-always-even-result [IN] OBSERVATION
`longestBalancedSubstring` always returns an even integer (including 0) because `best` is updated as `2 * min(zeros, ones)`, and updates occur only when processing `'1'` characters.
- Source: entries/2026/06/06/find-the-longest-balanced-substring-of-a-binary-string-solution.md

### balanced-substring-reset-on-zero-after-ones [IN] OBSERVATION
Both `zeros` and `ones` counters reset to zero when a `'0'` follows a `'1'`, which prevents stale zero-counts from inflating results across non-contiguous balanced segments.
- Source: entries/2026/06/06/find-the-longest-balanced-substring-of-a-binary-string-solution.md

### balanced-substring-single-pass-counter [IN] OBSERVATION
`longestBalancedSubstring` uses a single-pass O(n) time, O(1) space counter technique — tracking running counts of consecutive zeros and ones — rather than checking all substrings or using groupby.
- Source: entries/2026/06/06/find-the-longest-balanced-substring-of-a-binary-string-solution.md

### balanced-tree-short-circuit-propagation [IN] OBSERVATION
The balanced-binary-tree solution achieves O(n) time by short-circuiting: once any subtree returns `-1` (unbalanced), the value propagates upward immediately without recursing into sibling subtrees.
- Source: entries/2026/06/06/balanced-binary-tree-solution.md

### balloon-hardcoded-target-not-generalizable [IN] OBSERVATION
The five-argument `min(...)` in `max_number_of_balloons` encodes the word "balloon" directly; changing the target word requires rewriting the return expression rather than parameterizing.
- Source: entries/2026/06/06/maximum-number-of-balloons-solution.md

### balloon-needs-double-l-and-o [IN] OBSERVATION
The `// 2` divisor in `max_number_of_balloons` is applied to exactly `l` and `o` counts because "balloon" contains two of each; all other target characters (`b`, `a`, `n`) appear once.
- Source: entries/2026/06/06/maximum-number-of-balloons-solution.md

### banned-set-conversion-for-o1-lookup [IN] OBSERVATION
`mostCommonWord` converts the `banned` list to a `set` before filtering, ensuring O(1) amortized membership checks during the counting pass.
- Source: entries/2026/06/06/most-common-word-solution.md

### bare-function-vs-solution-class-inconsistency [IN] OBSERVATION
Some solutions use a `Solution` class with methods (e.g., `reverseVowels`, `maximumWealth`, `countPoints`) while others use bare functions (e.g., `judgeCircle`, `reverse_words_in_string`) — the repo is not consistent about which convention to use.
- Source: entries/2026/06/06/robot-return-to-origin-solution.md

### base7-digits-lsb-first [IN] OBSERVATION
Digits in convert_to_base7 are accumulated least-significant-first via repeated `% 7` and `//= 7`, then reversed at the end — the standard accumulate-then-reverse idiom that avoids O(n) prepend costs.
- Source: entries/2026/06/06/base-7-solution.md

### base7-sign-magnitude [IN] OBSERVATION
Negative inputs in convert_to_base7 are handled by converting to absolute value and prepending `"-"`, avoiding Python's floor-division behavior on negative numbers which would complicate digit extraction.
- Source: entries/2026/06/06/base-7-solution.md

### base7-zero-special-case [IN] OBSERVATION
`convert_to_base7` handles input 0 via an explicit early return; without this guard, the `while num:` loop would never execute and the function would return an empty string.
- Source: entries/2026/06/06/base-7-solution.md

### baseline-then-upgrade-allocation [IN] OBSERVATION
distribute-money allocates $1 to every child first, reducing the problem to distributing `remaining` in increments of $7 — separating feasibility from optimization.
- Source: entries/2026/06/06/distribute-money-to-maximum-children-solution.md

### bfs-guarantees-manhattan-order [IN] OBSERVATION
BFS from a center cell on a grid with 4-directional edges produces cells in non-decreasing Manhattan distance order, because every edge has weight 1 and BFS explores layer by layer.
- Source: entries/2026/06/06/matrix-cells-in-distance-order-solution.md

### bfs-level-snapshot-pattern [IN] OBSERVATION
`averageOfLevels` partitions BFS into discrete levels by snapshotting `len(queue)` before each inner loop, not by using sentinels or multiple queues.
- Source: entries/2026/06/06/average-of-levels-in-binary-tree-solution.md

### bigram-empty-input-degrades-gracefully [IN] OBSERVATION
When `text` has fewer than 3 words, `range(len(words) - 2)` produces an empty range and the result is `[]` — no special-case code needed
- Source: entries/2026/06/06/occurrences-after-bigram-solution.md

### bigram-index-bound-prevents-oob [IN] OBSERVATION
`findOcurrences` uses `range(len(words) - 2)` so that `words[i+2]` is always in-bounds — no try/except or sentinel values needed
- Source: entries/2026/06/06/occurrences-after-bigram-solution.md

### bigram-overlap-naturally-handled [IN] OBSERVATION
Overlapping bigram matches are collected independently — a word can serve as `second` in one match and `first` in the next because each index `i` is checked without regard to prior matches
- Source: entries/2026/06/06/occurrences-after-bigram-solution.md

### bin-count-for-popcount [IN] OBSERVATION
The repo uses `bin(n).count('1')` as the standard Python popcount idiom; no bit-manipulation tricks or `int.bit_count()` (Python 3.10+) are used
- Source: entries/2026/06/06/prime-number-of-set-bits-in-binary-representation-solution.md

### binary-gap-bit-scan-pattern [IN] OBSERVATION
`binary_gap` uses `n & 1` / `n >>= 1` right-shift scanning rather than `bin()` string conversion — the same bit-scanning idiom appears in `number-of-1-bits/solution.py`.
- Source: entries/2026/06/06/binary-gap-solution.md

### binary-gap-measures-adjacent-ones-only [IN] OBSERVATION
`binary_gap` measures distances between consecutive `1` bits only — `last_one` is updated on every `1` bit, so it never computes gaps between non-adjacent set bits.
- Source: entries/2026/06/06/binary-gap-solution.md

### binary-search-closed-interval-style [IN] OBSERVATION
The binary search implementation uses closed-interval bounds `[left, right]` with `while left <= right`, where both endpoints are inclusive candidates — not the half-open `[left, right)` alternative.
- Source: entries/2026/06/06/binary-search-solution.md

### binary-search-on-derived-quantities-pattern [IN] OBSERVATION
Binary searching on a derived monotonic function (like missing-count) rather than on array values directly is a recurring technique in this repo, applicable to problems like kth-missing-positive and first-bad-version.
- Source: entries/2026/06/06/kth-missing-positive-number-solution.md

### binary-search-on-value-pattern [IN] OBSERVATION
`is_perfect_square` binary-searches the range `[1, num]` for a value whose square equals `num`, achieving O(log n) time and O(1) space with no library calls.
- Source: entries/2026/06/06/valid-perfect-square-solution.md

### binary-search-oracle-pattern [IN] OBSERVATION
`guessNumber` uses standard binary search but replaces array-index comparison with a ternary oracle function (`guess()`), making it a search over an implicit sorted sequence.
- Source: entries/2026/06/06/guess-number-higher-or-lower-solution.md

### binary-search-variants-share-convergence-structure [IN] DERIVED
All binary search solutions share the same convergence loop structure (narrow [lo, hi] until they meet) but vary along three independent dimensions: what is searched (raw values vs. derived monotonic functions), bias direction (leftmost vs. rightmost match), and post-loop extraction (lo, hi, or result variable).
- Depends on: binary-search-on-derived-quantities-pattern, binary-search-on-value-pattern, left-biased-binary-search-pattern, fixed-point-uses-leftmost-binary-search

### binary-string-segment-depends-on-no-leading-zeros [IN] OBSERVATION
The `"01" not in s` check for at-most-one-segment-of-ones is only correct because the problem guarantees no leading zeros; without that constraint, `"011"` (a valid single segment) would be incorrectly rejected.
- Source: entries/2026/06/06/check-if-binary-string-has-at-most-one-segment-of-ones-solution.md

### binary-watch-brute-force-enumeration [IN] OBSERVATION
`readBinaryWatch` evaluates all 720 (h, m) candidates via nested `range(12) × range(60)` and filters by popcount match; there is no combinatorial generation or pruning.
- Source: entries/2026/06/06/binary-watch-solution.md

### binary-watch-deterministic-order [IN] OBSERVATION
`readBinaryWatch` output is ordered hours ascending, then minutes ascending within each hour, as a direct consequence of nested `range()` iteration order.
- Source: entries/2026/06/06/binary-watch-solution.md

### bisect-right-for-strict-greater-than [IN] OBSERVATION
`bisect_right` (not `bisect_left`) is required when searching for the first element strictly greater than a target in a sorted array; `bisect_left` would incorrectly return the target itself when present.
- Source: entries/2026/06/06/find-smallest-letter-greater-than-target-solution.md

### bisect-two-neighbor-sufficiency [IN] OBSERVATION
After `bisect_left` on sorted `arr2`, checking only `arr2[pos]` and `arr2[pos-1]` is sufficient to determine if any element is within distance `d` of `val` — all other elements are provably farther away.
- Source: entries/2026/06/06/find-the-distance-value-between-two-arrays-solution.md

### bit-position-independence-principle [IN] OBSERVATION
In XOR-subset problems, each bit position contributes independently to the total sum — if any element has bit b set, exactly half of all 2^n subsets have that bit survive XOR.
- Source: entries/2026/06/06/sum-of-all-subset-xor-totals-solution.md

### bit-shift-accumulation-correctness [IN] OBSERVATION
`(current << 1) | node.val` correctly builds a binary number MSB-first, equivalent to `current * 2 + node.val` — used in tree and linked-list path-to-number problems.
- Source: entries/2026/06/06/sum-of-root-to-leaf-binary-numbers-solution.md

### bit-walking-over-string-conversion [IN] OBSERVATION
`even_odd_indices` walks bits via `n & 1` and `n >>= 1` rather than converting to a binary string with `bin()`, avoiding string allocation and keeping the solution at O(log n) with no dependencies.
- Source: entries/2026/06/06/number-of-even-and-odd-bits-solution.md

### both-reversal-variants-mutate-in-place [IN] OBSERVATION
Neither `reverse_list` nor `reverse_list_recursive` creates new `ListNode` instances; they rewire existing `.next` pointers, meaning the original head's `.next` is `None` after reversal.
- Source: entries/2026/06/06/reverse-linked-list-solution.md

### box-category-exhaustive-return [IN] OBSERVATION
`boxCategory` always returns exactly one of four string literals; the if/elif chain covers all four (bulky, heavy) combinations with no unreachable or missing branch.
- Source: entries/2026/06/06/categorize-box-according-to-criteria-solution.md

### box-category-flag-then-branch [IN] OBSERVATION
`boxCategory` separates classification into two phases: compute boolean flags (`bulky`, `heavy`) from thresholds, then map the flag pair to a string label via cascading if/elif.
- Source: entries/2026/06/06/categorize-box-according-to-criteria-solution.md

### box-category-short-circuit-bulky [IN] OBSERVATION
The `bulky` check uses `any(d >= 10_000 for d in ...)` joined with `or` to the volume check, so if any dimension is >= 10,000 the volume multiplication is never evaluated.
- Source: entries/2026/06/06/categorize-box-according-to-criteria-solution.md

### box-category-trailing-space [IN] OBSERVATION
All `boxCategory` return values include a trailing space character, matching the LeetCode problem's expected output format — this is intentional, not a bug.
- Source: entries/2026/06/06/categorize-box-according-to-criteria-solution.md

### boyer-moore-constant-space [IN] OBSERVATION
The Boyer-Moore implementation uses exactly two scalar variables (`candidate`, `count`) — O(1) auxiliary space regardless of input size.
- Source: entries/2026/06/06/majority-element-solution.md

### boyer-moore-no-verification-pass [IN] OBSERVATION
`majority_element` in `majority-element/solution.py` does not include a second pass to verify the candidate; it assumes the precondition (a majority element exists) holds, and returns an arbitrary element if violated.
- Source: entries/2026/06/06/majority-element-solution.md

### broken-set-disjoint-pattern [IN] OBSERVATION
`canBeTypedWords` converts `brokenLetters` to a set and uses `set.isdisjoint` against each word, achieving O(n) time in total text length instead of O(n*b).
- Source: entries/2026/06/06/maximum-number-of-words-you-can-type-solution.md

### brute-force-deletion-over-analytical [IN] OBSERVATION
`can_equal_frequency` uses O(n^2) brute-force simulation (try every single deletion) rather than an analytical O(n) approach, deliberately trading efficiency for correctness — this problem is notorious for edge-case bugs in analytical solutions.
- Source: entries/2026/06/06/remove-letter-to-equalize-frequency-solution.md

### bst-inorder-no-materialized-list [IN] OBSERVATION
The BST minimum-difference solution computes the answer in O(h) stack space during traversal without collecting all node values into a list first.
- Source: entries/2026/06/06/minimum-absolute-difference-in-bst-solution.md

### bst-min-diff-between-inorder-neighbors [IN] OBSERVATION
The minimum absolute difference in a BST always occurs between two values adjacent in the inorder (sorted) traversal; the solution exploits this by comparing only consecutive visits rather than all pairs.
- Source: entries/2026/06/06/minimum-absolute-difference-in-bst-solution.md

### bst-property-assumed-not-validated [IN] OBSERVATION
`minDiffInBST` assumes its input is a valid BST without checking; a non-BST tree produces incorrect (possibly negative) differences silently.
- Source: entries/2026/06/06/minimum-distance-between-bst-nodes-solution.md

### bst-pruning-correctness [IN] OBSERVATION
`range_sum_bst` prunes the left subtree when `root.val < low` and the right subtree when `root.val > high`; this is correct only if the input is a valid BST — feeding a non-BST tree silently produces wrong results
- Source: entries/2026/06/06/range-sum-of-bst-solution.md

### buddy-strings-cross-match-invariant [IN] OBSERVATION
The final correctness check requires that the two differing positions cross-match (`s[i] == goal[j]` and `s[j] == goal[i]`), not merely that they differ — this is the necessary and sufficient condition for a single-swap solution.
- Source: entries/2026/06/06/buddy-strings-solution.md

### buddy-strings-early-exit-on-third-diff [IN] OBSERVATION
The diff-collection loop returns `False` immediately upon finding a 3rd mismatch, bounding the `diffs` list to at most length 2 and guaranteeing safe index access in the final check.
- Source: entries/2026/06/06/buddy-strings-solution.md

### buddy-strings-equal-case-duplicate-check [IN] OBSERVATION
When `s == goal`, `buddyStrings` returns `True` only if `s` contains a duplicate character (`len(s) != len(set(s))`), because swapping two copies of the same character is the only valid "swap that produces the same string."
- Source: entries/2026/06/06/buddy-strings-solution.md

### build-array-encode-order-safety [IN] OBSERVATION
The `% n` in `nums[nums[i]] % n` during the encode pass ensures correctness regardless of whether `nums[nums[i]]` has already been encoded earlier in the same loop iteration.
- Source: entries/2026/06/06/build-array-from-permutation-solution.md

### build-array-in-place-modular-encoding [IN] OBSERVATION
`buildArray` encodes two values per slot as `original + n * new_value`, recoverable via `% n` (original) and `// n` (new value), achieving the O(1) extra space follow-up challenge.
- Source: entries/2026/06/06/build-array-from-permutation-solution.md

### build-array-mutates-input [IN] OBSERVATION
`buildArray` mutates and returns the input `nums` list rather than allocating a separate output array — callers lose access to the original values after the call.
- Source: entries/2026/06/06/build-array-from-permutation-solution.md

### build-array-permutation-precondition [IN] OBSERVATION
The modular encoding algorithm is only correct when `nums` is a valid zero-based permutation (all values in `[0, n)`, each appearing exactly once); invalid input produces silently wrong results.
- Source: entries/2026/06/06/build-array-from-permutation-solution.md

### build-tree-bfs-from-level-order [IN] OBSERVATION
Tree solutions use a `build_tree` utility that constructs a `TreeNode` tree from a level-order list (LeetCode's serialization format) via BFS queue traversal, with `None` representing absent nodes.
- Source: entries/2026/06/06/leaf-similar-trees-solution.md

### build-tree-is-shared-infra [IN] OBSERVATION
`TreeNode` and `build_tree` defined in `sum-of-root-to-leaf-binary-numbers/solution.py` are imported by hundreds of test files across the repository, making that file load-bearing shared infrastructure despite being a solution file.
- Source: entries/2026/06/06/sum-of-root-to-leaf-binary-numbers-solution.md

### build-tree-level-order [IN] OBSERVATION
`_build_tree(values)` constructs a tree from a level-order (BFS) list where `None` represents absent children, matching LeetCode's standard serialization format; it is used across tree-problem test suites
- Source: entries/2026/06/06/range-sum-of-bst-solution.md

### build-tree-level-order-convention [IN] OBSERVATION
`build_tree` constructs trees from level-order lists (LeetCode's serialization format) using BFS, where `None` entries represent missing nodes — this is the standard tree construction interface across the repo.
- Source: entries/2026/06/06/sum-of-root-to-leaf-binary-numbers-solution.md

### build-tree-levelorder-serialization [IN] OBSERVATION
`build_tree` constructs trees level-by-level using a queue, matching LeetCode's standard level-order serialization format where `None` marks absent nodes.
- Source: entries/2026/06/06/find-all-the-lonely-nodes-solution.md

### build-tree-uses-leetcode-level-order [IN] OBSERVATION
`_build_tree` constructs trees from LeetCode's standard level-order serialization format (BFS order with `None` for missing nodes), making test cases directly copy-pasteable from problem examples.
- Source: entries/2026/06/06/evaluate-boolean-binary-tree-solution.md

### build-tree-uses-level-order [IN] OBSERVATION
`build_tree` deserializes LeetCode's bracket/level-order format using a FIFO queue (`list.pop(0)`), assigning left then right children per node; `None` entries represent absent children.
- Source: entries/2026/06/06/minimum-distance-between-bst-nodes-solution.md

### bus-stops-clockwise-complement [IN] OBSERVATION
The counterclockwise distance is computed as `sum(distance) - clockwise` rather than by iterating the reverse path — a complement trick that avoids modular wrap-around logic.
- Source: entries/2026/06/06/distance-between-bus-stops-solution.md

### bus-stops-swap-normalization [IN] OBSERVATION
The solution normalizes `start > destination` by swapping, guaranteeing `start <= destination` so that `distance[start:destination]` captures the clockwise path without wrap-around indexing.
- Source: entries/2026/06/06/distance-between-bus-stops-solution.md

### busyStudent-inclusive-boundaries [IN] OBSERVATION
`busyStudent` uses `s <= queryTime <= e` (inclusive on both ends), meaning a student is counted as busy when queryTime equals exactly startTime or endTime.
- Source: entries/2026/06/06/number-of-students-doing-homework-at-a-given-time-solution.md

### buy-sell-stock-returns-zero-for-no-profit [IN] OBSERVATION
When no profitable transaction exists (monotonically decreasing prices), `maxProfit` returns `0`, never a negative number.
- Source: entries/2026/06/06/best-time-to-buy-and-sell-stock-solution.md

### buy-sell-stock-single-pass-greedy [IN] OBSERVATION
`maxProfit` runs in O(n) time and O(1) space by tracking the running minimum price — a Kadane's-style greedy pattern.
- Source: entries/2026/06/06/best-time-to-buy-and-sell-stock-solution.md

### buy-sell-stock-single-transaction-only [IN] OBSERVATION
`maxProfit` finds the best single buy-sell pair; it is not the unlimited-transactions variant (LeetCode #122).
- Source: entries/2026/06/06/best-time-to-buy-and-sell-stock-solution.md

### calpoints-linear-time [IN] OBSERVATION
`calPoints` runs in O(n) time and O(n) space, where n is the number of operations.
- Source: entries/2026/06/06/baseball-game-solution.md

### calpoints-no-input-validation [IN] OBSERVATION
`calPoints` assumes all inputs are valid per the LeetCode contract and raises unhandled `IndexError` or `ValueError` on malformed input.
- Source: entries/2026/06/06/baseball-game-solution.md

### calpoints-stack-only [IN] OBSERVATION
`calPoints` uses a single list as a stack, accessing only `[-1]` and `[-2]` — never arbitrary indexes.
- Source: entries/2026/06/06/baseball-game-solution.md

### calpoints-strip-defensive [IN] OBSERVATION
The `op.strip()` call in `calPoints` is a defensive guard against whitespace that LeetCode inputs never contain.
- Source: entries/2026/06/06/baseball-game-solution.md

### camelcase-solution-methods-snakecase-helpers [IN] OBSERVATION
Solution class methods use camelCase to match LeetCode's interface signatures, while standalone helper functions and local utilities use Python's snake_case convention.
- Source: entries/2026/06/06/leaf-similar-trees-solution.md

### can-place-flowers-boundary-as-empty [IN] OBSERVATION
Array boundaries are treated as empty plots: index 0 has no left constraint and the last index has no right constraint, handled by short-circuit `or` guards rather than sentinel padding.
- Source: entries/2026/06/06/can-place-flowers-solution.md

### can-place-flowers-greedy-is-optimal [IN] OBSERVATION
Greedy left-to-right placement is provably optimal: planting at the earliest valid slot never reduces the number of remaining valid slots compared to any alternative placement order.
- Source: entries/2026/06/06/can-place-flowers-solution.md

### can-place-flowers-mutates-input [IN] OBSERVATION
`canPlaceFlowers` modifies the `flowerbed` list in place by setting planted positions to `1`; callers who need the original must copy first.
- Source: entries/2026/06/06/can-place-flowers-solution.md

### canformarray-bounds-check-before-value [IN] OBSERVATION
The inner loop checks `i >= len(arr)` before comparing `arr[i] != val`, preventing an out-of-bounds access when a piece would extend past the end of `arr`.
- Source: entries/2026/06/06/check-array-formation-through-concatenation-solution.md

### canformarray-distinctness-required [IN] OBSERVATION
The `{p[0]: p for p in pieces}` lookup strategy is only correct because the problem guarantees all integers across all pieces are distinct; duplicate first elements would silently overwrite entries.
- Source: entries/2026/06/06/check-array-formation-through-concatenation-solution.md

### canformarray-first-element-keyed-lookup [IN] OBSERVATION
`canFormArray` indexes pieces by their first element into a dict, enabling O(1) lookup at each position in `arr` — a pattern that recurs in problems with distinctness constraints.
- Source: entries/2026/06/06/check-array-formation-through-concatenation-solution.md

### canformarray-linear-time [IN] OBSERVATION
`canFormArray` runs in O(n) time where n = len(arr), visiting each element exactly once via a greedy left-to-right scan with hash-map lookups.
- Source: entries/2026/06/06/check-array-formation-through-concatenation-solution.md

### canonical-form-frequency-counting-pattern [IN] OBSERVATION
Multiple solutions (domino pairs, good pairs, similar strings) reduce pair/group-counting problems to: canonicalize each element, count frequencies, then derive the answer from counts — avoiding O(n^2) pairwise comparison.
- Source: entries/2026/06/06/number-of-equivalent-domino-pairs-solution.md

### canonical-pipeline-has-exactly-two-instantiations [IN] DERIVED
The preprocess-then-stream pipeline has exactly two concrete forms — hash-then-stream (Counter/set for membership and frequency queries) and sort-then-stream (sorted order for positional queries) — matching the two preprocessing paradigms one-to-one with a single shared consumption phase.
- Depends on: preprocess-then-stream-is-canonical-pipeline, two-preprocessing-paradigms-partition-problems

### capitalize-title-no-builtin-titlecase [IN] OBSERVATION
The solution manually constructs title case (`w[0].upper() + w[1:].lower()`) rather than using `str.title()` or `str.capitalize()`, because the length-based conditional requires a branch regardless.
- Source: entries/2026/06/06/capitalize-the-title-solution.md

### capitalize-title-threshold-is-2 [IN] OBSERVATION
Words of length `<= 2` are fully lowercased; words of length `>= 3` are title-cased. The boundary is at exactly 3 characters.
- Source: entries/2026/06/06/capitalize-the-title-solution.md

### carfleet-alias-is-dead-code [IN] OBSERVATION
`carFleet = projectionArea` in the projection-area solution is a stale alias from the automated solution generation pipeline; it is never called by tests and is unrelated to the problem
- Source: entries/2026/06/06/projection-area-of-3d-shapes-solution.md

### ceiling-div-integer-idiom [IN] OBSERVATION
The codebase uses `(n + d - 1) // d` (here `(sum + 1) // 2`) as the standard integer ceiling division idiom, avoiding floating-point precision issues from `math.ceil`.
- Source: entries/2026/06/06/minimum-amount-of-time-to-fill-cups-solution.md

### cell-range-column-major-by-nesting [IN] OBSERVATION
`cell_range` output order is column-major (all rows for column A before column B) enforced structurally by the loop nesting order, not by a post-hoc sort.
- Source: entries/2026/06/06/cells-in-a-range-on-an-excel-sheet-solution.md

### cell-range-empty-on-inverted-bounds [IN] OBSERVATION
If the start column/row exceeds the end column/row, `cell_range` returns an empty list because `range()` produces no values — no explicit guard needed.
- Source: entries/2026/06/06/cells-in-a-range-on-an-excel-sheet-solution.md

### cell-range-single-char-columns [IN] OBSERVATION
`cell_range` parses the input string by fixed character positions (s[0], s[1], s[3], s[4]), so it only handles single-letter columns (A-Z) and single-digit rows (1-9).
- Source: entries/2026/06/06/cells-in-a-range-on-an-excel-sheet-solution.md

### century-leap-year-rule-tested [IN] OBSERVATION
The `day-of-the-year` test suite covers both the century non-leap case (1900) and the 400-year leap case (2000), exercising the two most commonly missed leap-year edge cases.
- Source: entries/2026/06/06/day-of-the-year-solution.md

### chars-pool-shared-readonly-across-words [IN] OBSERVATION
The `chars_count` Counter is built once and reused read-only for every word check; the character pool resets between words rather than being consumed.
- Source: entries/2026/06/06/find-words-that-can-be-formed-by-characters-solution.md

### chebyshev-distance-for-8dir-grid [IN] OBSERVATION
The minimum steps between two points on an 8-directional grid equals Chebyshev distance `max(|dx|, |dy|)`, not Manhattan distance `|dx| + |dy|`; diagonal moves close both axes simultaneously.
- Source: entries/2026/06/06/minimum-time-visiting-all-points-solution.md

### check-double-even-guard [IN] OBSERVATION
The `x % 2 == 0` guard is required for correctness; without it, odd numbers would falsely match via integer division truncation (e.g., `7 // 2 = 3`)
- Source: entries/2026/06/06/check-if-n-and-its-double-exist-solution.md

### check-double-insert-after-lookup [IN] OBSERVATION
`checkIfExist` inserts each element into `seen` only after checking for its double/half, which prevents self-matching at the same index
- Source: entries/2026/06/06/check-if-n-and-its-double-exist-solution.md

### check-double-linear-complexity [IN] OBSERVATION
`checkIfExist` runs in O(n) time and O(n) space via single-pass iteration with hash set lookups
- Source: entries/2026/06/06/check-if-n-and-its-double-exist-solution.md

### check-double-zero-pair [IN] OBSERVATION
Two zeros in the input correctly return `True` because the second zero finds `2 * 0 = 0` already in `seen` from the first zero
- Source: entries/2026/06/06/check-if-n-and-its-double-exist-solution.md

### chips-parity-reduction [IN] OBSERVATION
Moving chips by any even distance is free, so `min_cost_to_move_chips` reduces to `min(count_odd, count_even)` — move the smaller parity group across the boundary at cost 1 each.
- Source: entries/2026/06/06/minimum-cost-to-move-chips-to-the-same-position-solution.md

### chr-arithmetic-maps-1-to-a [IN] OBSERVATION
`chr(ord("a") + num - 1)` maps integer 1 to `'a'` and integer 26 to `'z'` — the standard idiom for 1-based alphabet mapping in this repo.
- Source: entries/2026/06/06/decrypt-string-from-alphabet-to-integer-mapping-solution.md

### circular-distance-formula-no-modulo [IN] OBSERVATION
The circular distance between two indices in an array of size n is computed as `min(abs(i - j), n - abs(i - j))` without modular arithmetic — a recurring idiom across circular-array problems in this repo.
- Source: entries/2026/06/06/shortest-distance-to-target-string-in-a-circular-array-solution.md

### circular-distance-idiom-min-diff-n-minus-diff [IN] OBSERVATION
The `min(diff, N - diff)` idiom for shortest arc on a modular ring appears across multiple solutions including `minimum-time-to-type-word-using-special-typewriter`, `distance-between-bus-stops`, and (without wrap) `single-row-keyboard`.
- Source: entries/2026/06/06/minimum-time-to-type-word-using-special-typewriter-solution.md

### circular-sentence-no-split [IN] OBSERVATION
`is_circular` checks circularity by scanning for spaces as word boundaries rather than calling `str.split()`, achieving O(n) time and O(1) auxiliary space.
- Source: entries/2026/06/06/circular-sentence-solution.md

### circular-sentence-space-boundary-invariant [IN] OBSERVATION
The circular-sentence algorithm assumes spaces never appear at position 0 or `len(sentence)-1`; indexing `sentence[i-1]` and `sentence[i+1]` around spaces would produce wrong results or IndexError if this invariant is violated.
- Source: entries/2026/06/06/circular-sentence-solution.md

### circular-sentence-wrap-check-separate [IN] OBSERVATION
The wrap-around condition (`sentence[0] != sentence[-1]`) is checked as an independent early-exit before the space-boundary loop, not unified into the main scan.
- Source: entries/2026/06/06/circular-sentence-solution.md

### climbing-stairs-constant-space [IN] OBSERVATION
The climbing-stairs solution uses two rolling variables (`a`, `b`) with tuple swap instead of an O(n) DP array, achieving O(1) auxiliary space.
- Source: entries/2026/06/06/climbing-stairs-solution.md

### climbing-stairs-is-fibonacci [IN] OBSERVATION
`climbStairs(n)` computes the (n+1)th Fibonacci number — the problem is isomorphic to Fibonacci computation with base cases fib(1)=1, fib(2)=2.
- Source: entries/2026/06/06/climbing-stairs-solution.md

### climbing-stairs-no-input-validation [IN] OBSERVATION
`climbStairs` does not guard against `n <= 0`; passing 0 returns 0, and negative values return the negative input — both incorrect but outside the LeetCode contract `1 <= n <= 45`.
- Source: entries/2026/06/06/climbing-stairs-solution.md

### clock-times-enumerate-over-case-logic [IN] OBSERVATION
`count_valid_times` iterates over all 24 hours and 60 minutes (84 total iterations) and pattern-matches, rather than building conditional case tables per digit position.
- Source: entries/2026/06/06/number-of-valid-clock-times-solution.md

### clock-times-hour-minute-independence [IN] OBSERVATION
`count_valid_times` exploits the independence of hour and minute wildcards, computing `matching_hours * matching_minutes` instead of enumerating all 1440 combinations.
- Source: entries/2026/06/06/number-of-valid-clock-times-solution.md

### clockwise-rotation-formula [IN] OBSERVATION
`mat[n-1-j][i]` maps a source position to a 90° clockwise rotation of an n×n matrix; confusing this with counterclockwise (`mat[j][n-1-i]`) would produce incorrect results.
- Source: entries/2026/06/06/determine-whether-matrix-can-be-obtained-by-rotation-solution.md

### closed-form-preferred-over-simulation [IN] OBSERVATION
When a mathematical closed-form exists (e.g., triangular number formula for arranging-coins), the repo uses it with exact integer arithmetic (`math.isqrt`) rather than iterative simulation or binary search.
- Source: entries/2026/06/06/arranging-coins-solution.md

### closed-form-reduction-eliminates-iteration [IN] DERIVED
Multiple solutions reduce seemingly iterative problems to O(1) closed-form mathematical expressions — arithmetic series, algebraic identities, or combinatorial formulas — bypassing simulation or accumulation entirely.
- Depends on: max-sum-is-closed-form, leetcode-bank-closed-form, distinct-numbers-o1-mathematical-reduction, odd-subarray-count-formula

### closed-interval-overlap-formula [IN] OBSERVATION
The event conflict solution uses `a <= d and c <= b` (closed-interval overlap), meaning events sharing only a boundary moment are reported as conflicting; using `<` instead of `<=` would change this semantic.
- Source: entries/2026/06/06/determine-if-two-events-have-conflict-solution.md

### closest-to-zero-positive-tiebreak [IN] OBSERVATION
When two numbers have equal absolute value, the closest-to-zero solver returns the positive one via the `num > best` guard in the update predicate.
- Source: entries/2026/06/06/find-closest-number-to-zero-solution.md

### closest-value-bst-ordering-assumed [IN] OBSERVATION
The directional pruning (`left if target < node.val else right`) is only correct for valid BSTs; a non-BST input silently produces wrong results with no validation.
- Source: entries/2026/06/06/closest-binary-search-tree-value-solution.md

### closest-value-o-h-time-o1-space [IN] OBSERVATION
`closestValue` visits at most one node per tree level via iterative BST-directed search, making it O(h) time and O(1) space (no recursion stack).
- Source: entries/2026/06/06/closest-binary-search-tree-value-solution.md

### closest-value-requires-non-null-root [IN] OBSERVATION
`closestValue` dereferences `root.val` on the first line with no null check; passing `root=None` raises `AttributeError`.
- Source: entries/2026/06/06/closest-binary-search-tree-value-solution.md

### closest-value-self-contained-file [IN] OBSERVATION
The closest-binary-search-tree-value `solution.py` defines `TreeNode`, the solution, a level-order tree builder (`_build`), and a full `unittest` test suite in a single file.
- Source: entries/2026/06/06/closest-binary-search-tree-value-solution.md

### closest-value-tie-break-favors-smaller [IN] OBSERVATION
When two node values are equidistant from the target, `closestValue` returns the numerically smaller value, enforced by a compound condition that prefers the smaller candidate on equal distance.
- Source: entries/2026/06/06/closest-binary-search-tree-value-solution.md

### closure-dfs-pattern [IN] OBSERVATION
Tree solutions use closure-based DFS where the inner `dfs` function captures a `result` list from the enclosing scope, avoiding return-value plumbing while keeping the recursion signature clean.
- Source: entries/2026/06/06/find-all-the-lonely-nodes-solution.md

### closure-over-enclosing-scope-pattern [IN] OBSERVATION
Recursive helpers and inner functions capture variables (e.g., target values, the input string) from the enclosing method scope rather than accepting them as parameters.
- Source: entries/2026/06/06/univalued-binary-tree-solution.md

### coherence-through-elimination-not-enforcement [IN] DERIVED
The repo exhibits architectural coherence primarily through elimination of prerequisites rather than enforcement of conventions: construction-based correctness removes the need for runtime validation, and submission-optimized isolation removes the need for cross-module coordination — together these patterns explain the characteristically lean function bodies, with this convergence emerging from LeetCode's problem structure rather than top-down design.
- Depends on: construction-and-isolation-jointly-eliminate-defensive-code, convergence-without-coordination-at-every-level

### collocated-tests-pattern [IN] OBSERVATION
Some solution files contain both the implementation and a `unittest.TestCase` subclass with a `__main__` guard, in addition to the separate `test_solution.py` files used by the repo's test harness
- Source: entries/2026/06/06/count-the-digits-that-divide-a-number-solution.md

### common-chars-assumes-nonempty-input [IN] OBSERVATION
`commonChars` indexes `words[0]` unconditionally and will raise `IndexError` on an empty list, relying on LeetCode's non-empty guarantee.
- Source: entries/2026/06/06/find-common-characters-solution.md

### common-chars-space-bounded-by-alphabet [IN] OBSERVATION
The Counter in `commonChars` is bounded by at most 26 keys (lowercase English letters), making space complexity O(1) regardless of input size.
- Source: entries/2026/06/06/find-common-characters-solution.md

### common-digit-always-optimal [IN] OBSERVATION
When both digit arrays share a digit, the smallest shared digit is always the answer, because any single-digit value (1-9) is strictly less than any two-digit value (11-99).
- Source: entries/2026/06/06/form-smallest-number-from-two-digit-arrays-solution.md

### complement-count-one-pass [IN] OBSERVATION
For problems with exactly two valid target patterns (e.g., alternating binary strings), the repo counts mismatches against one pattern and derives the other as `len - count`, requiring only a single pass.
- Source: entries/2026/06/06/minimum-changes-to-make-alternating-binary-string-solution.md

### complement-mask-matches-bit-length [IN] OBSERVATION
The XOR mask is exactly `n.bit_length()` bits wide (`(1 << n.bit_length()) - 1`), so only significant bits are flipped — no fixed 32-bit or 64-bit width assumption.
- Source: entries/2026/06/06/complement-of-base-10-integer-solution.md

### complement-no-special-case-needed [IN] OBSERVATION
The XOR-with-mask algorithm handles all valid inputs (1 to 2^31 - 1) without branching; edge cases like single-bit numbers (e.g., `1 ^ 1 = 0`) resolve correctly through the general formula.
- Source: entries/2026/06/06/number-complement-solution.md

### complement-pure-bitwise [IN] OBSERVATION
`find_complement` uses only `bit_length()`, bit shift, and XOR — no `bin()` string conversion or iteration — achieving O(1) time and space.
- Source: entries/2026/06/06/number-complement-solution.md

### complement-zero-out-of-domain [IN] OBSERVATION
The `find_complement` docstring constrains `num >= 1`; passing 0 yields a degenerate result (mask is 0, output is 0) because `bit_length()` returns 0 for zero.
- Source: entries/2026/06/06/number-complement-solution.md

### complement-zero-special-case [IN] OBSERVATION
`bitwiseComplement(0)` returns 1 via an explicit early check because `int.bit_length()` returns 0 for zero, which would make the general XOR-mask formula produce `(1 << 0) - 1 = 0` instead of 1.
- Source: entries/2026/06/06/complement-of-base-10-integer-solution.md

### complete-stasis-requires-naming-invisibility [IN] DERIVED
The system's absorbing-state stasis — where orthogonal stabilization confines defects and the static equilibrium prevents displacement — holds only while naming defects remain invisible at the test harness boundary; a misnamed module export that causes import failures would breach dimensional confinement by converting an engineering defect into a runtime failure, introducing a feedback path capable of destabilizing the equilibrium.
- Source type: derived
- Depends on: system-fully-characterized-as-static-equilibrium, defect-confinement-from-orthogonal-stabilization
- Unless: misnamed-module-exports-in-test-harness

### concat-array-no-mutation [IN] OBSERVATION
The concatenation solution uses Python's `+` operator on lists, which always allocates a new list; the input `nums` is never modified.
- Source: entries/2026/06/06/concatenation-of-array-solution.md

### concat-array-wrong-method-name [IN] OBSERVATION
The concatenation-of-array solution method is named `maxValue` but should be `getConcatenation` per LeetCode 1929's expected interface — a copy-paste naming error.
- Source: entries/2026/06/06/concatenation-of-array-solution.md

### confusing-number-leading-zeros [IN] OBSERVATION
Rotated numbers with leading zeros (e.g., 10 rotates to 01) are handled correctly because integer arithmetic silently drops leading zeros — no special-case logic needed.
- Source: entries/2026/06/06/confusing-number-solution.md

### confusing-number-rotate-dict-dual-purpose [IN] OBSERVATION
The `rotate` dict serves as both a validity whitelist (membership test for rotatable digits) and a transformation function (mapping each digit to its rotation), avoiding separate validation and transformation steps.
- Source: entries/2026/06/06/confusing-number-solution.md

### confusing-number-single-pass [IN] OBSERVATION
The solution extracts digits right-to-left and rebuilds the rotated number left-to-right in one pass, simultaneously reversing digit order and applying the rotation mapping in O(d) time.
- Source: entries/2026/06/06/confusing-number-solution.md

### confusing-number-valid-digits [IN] OBSERVATION
Only digits 0, 1, 6, 8, 9 survive 180-degree rotation; any other digit in the input causes an immediate `False` return via the `rotate` dict membership check.
- Source: entries/2026/06/06/confusing-number-solution.md

### consecutive-late-reset-on-non-l [IN] OBSERVATION
Both `'A'` and `'P'` branches reset `consecutive_lates` to 0 — absences break a late streak, matching the problem's "consecutive" requirement
- Source: entries/2026/06/06/student-attendance-record-i-solution.md

### consecutive-requires-both-checks [IN] OBSERVATION
The consecutive-array check requires both a uniqueness test (`len(set) == n`) and a range test (`max - min + 1 == n`); either alone has false positives (`[1,1,3]` passes range-only, `[1,2,4]` passes uniqueness-only).
- Source: entries/2026/06/06/check-if-an-array-is-consecutive-solution.md

### consistent-string-set-lookup [IN] OBSERVATION
`countConsistentStrings` converts `allowed` to a set exactly once, ensuring O(1) per-character membership checks rather than O(k) linear scans
- Source: entries/2026/06/06/count-the-number-of-consistent-strings-solution.md

### constant-space-lowercase-constraint [IN] OBSERVATION
The first-unique-character solution is O(1) space because the problem constrains input to lowercase English letters, capping the Counter at 26 keys regardless of string length.
- Source: entries/2026/06/06/first-unique-character-in-a-string-solution.md

### construct2d-no-mutation [IN] OBSERVATION
`construct2DArray` never modifies the input list; all slices produce new list objects, so the output shares no mutable state with the input.
- Source: entries/2026/06/06/convert-1d-array-into-2d-array-solution.md

### construct2d-row-major-order [IN] OBSERVATION
Elements are placed into the 2D array in row-major order: `original[0..n-1]` becomes row 0, `original[n..2n-1]` becomes row 1, etc.
- Source: entries/2026/06/06/convert-1d-array-into-2d-array-solution.md

### construction-and-isolation-jointly-eliminate-defensive-code [IN] DERIVED
Construction-based correctness eliminates runtime validation (no defensive checks at function boundaries), while submission-optimized isolation eliminates integration safeguards (no cross-module contracts to enforce) — together they remove both categories of defensive code that engineering discipline would normally require, explaining the repo's characteristically lean function bodies.
- Depends on: correctness-by-construction-not-validation, inconsistency-is-invisible-because-submission-optimized

### construction-correctness-universal-for-valid-inputs [IN] DERIVED
The combined construction techniques (exact arithmetic, sentinel initialization, streaming invariants, ordering independence) achieve correct output for every input within LeetCode's stated constraints.
- Depends on: correctness-by-construction-not-validation, streaming-needs-no-external-ordering
- Unless: zero-input-returns-wrong-result, find-difference-reduce-no-initial-value

### contains-duplicate-greedy-update [IN] OBSERVATION
Unconditionally overwriting `last_seen[num] = i` after each check is correct because any future occurrence at index `m > i` will be closer to `i` than to any earlier index — older occurrences can never produce a shorter distance.
- Source: entries/2026/06/06/contains-duplicate-ii-solution.md

### contains-pattern-bounds-safe-loop [IN] OBSERVATION
The loop bound `n - m*k + 1` in contains_pattern guarantees all slice accesses stay within array bounds without explicit bounds checking; when m*k > n the range is empty and the function returns False.
- Source: entries/2026/06/06/detect-pattern-of-length-m-repeated-k-or-more-times-solution.md

### contains-pattern-brute-force-slicing [IN] OBSERVATION
contains_pattern uses brute-force enumeration with list slice comparison — extracting candidate patterns and checking k-1 consecutive blocks via all() — which is O(n*m*k) but acceptable for n <= 100.
- Source: entries/2026/06/06/detect-pattern-of-length-m-repeated-k-or-more-times-solution.md

### contribution-counting-replaces-enumeration [IN] OBSERVATION
`sumOddLengthSubarrays` uses per-element contribution counting — computing how many odd-length subarrays include each index — to achieve O(n) instead of O(n^2) subarray enumeration
- Source: entries/2026/06/06/sum-of-all-odd-length-subarrays-solution.md

### convergence-attractor-coincides-with-normal-form [IN] DERIVED
The normal form of the solution space (streaming, an algebraic property) coincides with its convergence attractor (the strategy with strongest uncoordinated adoption, an empirical property): abstraction cost predicts convergence strength, and the normal form has zero abstraction cost, so the algebraic minimum is also the dynamic fixed point.
- Source type: derived
- Depends on: abstraction-cost-predicts-convergence-strength, streaming-normal-form-is-minimal-strategy

### convergence-implies-individual-correctness [IN] DERIVED
Uncoordinated convergence on streaming and pipeline paradigms should produce solutions that are individually correct within their problem's input domain, because the converged-upon strategies embed correctness via construction rather than validation.
- Depends on: convergence-without-coordination-at-every-level, correctness-by-construction-not-validation
- Unless: zero-input-returns-false, remove-dupes-assumes-nonempty

### convergence-without-coordination-at-every-level [IN] DERIVED
The repo exhibits emergent convergence at both the algorithmic level (two paradigms cover the solution space) and the correctness level (construction techniques replace validation), despite zero top-down coordination — LeetCode's problem structure alone is sufficient to drive architectural convergence across independent solutions.
- Depends on: algorithmic-coherence-emerges-without-engineering, correctness-by-construction-not-validation

### convert-mutate-join-string-idiom [IN] OBSERVATION
String manipulation problems (`reverse-only-letters`, `reverse-string-ii`) use the convert-mutate-join pattern: `list(s)` for mutability, in-place modification, then `"".join()` — the standard Python workaround for string immutability.
- Source: entries/2026/06/06/reverse-string-ii-solution.md

### copy-paste-naming-bugs-in-solutions [IN] OBSERVATION
Some solution files have function names from other problems (e.g., `concatenated_binary` for the ascending subarray sum problem), indicating a systematic copy-paste issue during solution authoring.
- Source: entries/2026/06/06/maximum-ascending-subarray-sum-solution.md

### copy-paste-naming-errors-cosmetic-only [IN] DERIVED
Method name mismatches caused by copy-paste across solution files are purely cosmetic — they affect readability but not runtime correctness or test outcomes.
- Depends on: method-name-mismatches-common, function-misnaming-is-systematic
- Unless: function-name-mismatches-behavior

### correctness-and-quality-independently-dual-stabilized [IN] DERIVED
Both the correctness profile and the quality profile are independently stabilized by redundant dual mechanisms: correctness through paradigmatic convergence and construction techniques, quality through structural inseparability and self-reinforcing equilibrium — making the overall system resistant to perturbation in two orthogonal dimensions simultaneously.
- Source type: derived
- Depends on: correctness-through-dual-mechanisms, quality-profile-doubly-locked

### correctness-by-construction-not-validation [IN] DERIVED
Solutions achieve correctness through three construction techniques — exact arithmetic prevents precision errors, sentinel initialization eliminates boundary-condition branches, and LeetCode's input contract removes invalid-input scenarios — rather than through any form of runtime defensive checking.
- Depends on: exactness-over-performance-at-every-layer, sentinel-values-bootstrap-streaming-state, leetcode-judge-optimized-not-reusable

### correctness-decoupled-from-engineering-quality [IN] DERIVED
The repo achieves a structural decoupling of correctness from engineering quality: correctness is established through dual independent mechanisms (paradigmatic convergence + construction techniques) that are immune to the engineering defects (naming drift, convention inconsistency, tooling unreliability) pervading the codebase — the two dimensions vary independently.
- Source type: derived
- Depends on: correctness-through-dual-mechanisms, architecture-immune-to-own-engineering-defects

### correctness-quality-orthogonal-stability [IN] DERIVED
The system maintains stability in two fully orthogonal dimensions: correctness is locked by dual independent mechanisms (convergence + construction) regardless of engineering quality, and quality is in stasis at every granularity regardless of correctness mechanisms — the two dimensions are structurally decoupled, so perturbation in either cannot propagate to the other.
- Source type: derived
- Depends on: correctness-decoupled-from-engineering-quality, quality-stasis-at-every-granularity

### correctness-through-dual-mechanisms [IN] DERIVED
The repo achieves within-domain correctness through two independent and mutually reinforcing mechanisms: top-down paradigmatic convergence (uncoordinated adoption of sound streaming and pipeline paradigms predicts that individual solutions should be correct) and bottom-up structural completeness (sentinel initialization, early exit, and construction techniques ensure crash-free behavior for all valid inputs including edge cases) — the convergence mechanism explains WHY solutions tend to be correct, while the construction mechanism explains HOW.
- Source type: derived
- Depends on: convergence-implies-individual-correctness, within-domain-correctness-comprehensive

### count-asterisks-linear-scan [IN] OBSERVATION
`count_stars_except_between_pair` processes input in a single O(n) pass with O(1) auxiliary space using a toggle-flag state machine.
- Source: entries/2026/06/06/count-asterisks-solution.md

### count-asterisks-toggle-pairing [IN] OBSERVATION
Pipe characters in `count_stars_except_between_pair` are paired sequentially by position (1st with 2nd, 3rd with 4th) via a boolean toggle — no nesting or matching logic; the even-pipe-count precondition is trusted, not validated.
- Source: entries/2026/06/06/count-asterisks-solution.md

### count-balls-alias-is-identity [IN] OBSERVATION
`maxWidthOfVerticalArea` is a direct class-level reference to `countBalls` (same code object), not a wrapper — likely a copy-paste artifact from a different LeetCode problem's template.
- Source: entries/2026/06/06/maximum-number-of-balls-in-a-box-solution.md

### count-filter-reduce-idiom [IN] OBSERVATION
Multiple solutions use a three-step "count-filter-reduce" pattern: `Counter(nums)` → list comprehension filter → aggregation function (`max`, `sum`, etc.), each in O(n).
- Source: entries/2026/06/06/largest-unique-number-solution.md

### count-letters-linear-time [IN] OBSERVATION
`count_letters` runs in O(n) time because each character is consumed by exactly one iteration of the inner while loop across the entire execution
- Source: entries/2026/06/06/count-substrings-with-only-one-distinct-letter-solution.md

### count-prefixes-duplicates-counted [IN] OBSERVATION
`countPrefixes` counts duplicate entries in `words` independently — no deduplication is applied — matching the LeetCode problem specification that identical words each contribute separately.
- Source: entries/2026/06/06/count-prefixes-of-a-given-string-solution.md

### count-segments-uses-no-arg-split [IN] OBSERVATION
`count_segments` relies on `str.split()` without a delimiter argument, which collapses all consecutive whitespace and strips leading/trailing whitespace — distinct from `s.split(' ')` which would give wrong counts
- Source: entries/2026/06/06/number-of-segments-in-a-string-solution.md

### counter-algebra-grounds-hash-pipeline-universality [IN] DERIVED
Counter's algebraic completeness — encompassing construction from iterables, frequency measurement with zero-default, comparison via subtraction, and containment via drop-nonpositive semantics — is the specific mechanism that makes hash-based preprocessing universal: every hash-then-stream solution's preprocessing phase reduces to a composition of Counter's algebraic operations, and Counter's closure under these operations guarantees the preprocessing output is always a valid input to the streaming phase.
- Source type: derived
- Depends on: counter-is-complete-multiset-algebra, hash-preprocessing-universal-first-step

### counter-all-pattern [IN] OBSERVATION
divide-array-into-equal-pairs uses `Counter` + `all()` with a generator expression — `all()` short-circuits on the first odd count, giving O(n) time and O(k) space.
- Source: entries/2026/06/06/divide-array-into-equal-pairs-solution.md

### counter-before-scan-invariant [IN] OBSERVATION
The frequency map is fully built before the uniqueness scan begins; no character is evaluated against a partial count, ensuring "unique" means globally unique, not "unseen so far."
- Source: entries/2026/06/06/first-unique-character-in-a-string-solution.md

### counter-deadlock-detection [IN] OBSERVATION
In `countStudents`, deadlock is detected by `count[s] == 0` — no remaining student wants the current top sandwich — and the return value is the sum of all remaining counts.
- Source: entries/2026/06/06/number-of-students-unable-to-eat-lunch-solution.md

### counter-default-zero [IN] OBSERVATION
`Counter[str(i)]` returns 0 for digits not present in `num`, which is load-bearing for correctness when the expected count is also 0 — a plain `dict` would raise `KeyError`
- Source: entries/2026/06/06/check-if-number-has-equal-digit-count-and-digit-value-solution.md

### counter-default-zero-drives-correctness [IN] OBSERVATION
`max_number_of_balloons` relies on `Counter.__missing__` returning 0 for absent keys; no explicit key-existence checks are needed, and missing characters naturally yield 0.
- Source: entries/2026/06/06/maximum-number-of-balloons-solution.md

### counter-dominant-frequency-tool [IN] OBSERVATION
`Counter` from `collections` is the dominant tool across this repo for pair-counting and frequency-analysis problems, used by `max_number_of_balloons`, `countBalls`, and `count_pairs_leftovers` among others.
- Source: entries/2026/06/06/maximum-number-of-pairs-in-array-solution.md

### counter-elements-expands-by-count [IN] OBSERVATION
`Counter.elements()` yields each key repeated by its count, converting a frequency map back to a flat iterable.
- Source: entries/2026/06/06/find-common-characters-solution.md

### counter-filter-idiom [IN] OBSERVATION
Frequency-based problems use `collections.Counter` plus a generator expression to filter and aggregate, avoiding intermediate list allocation — a recurring pattern across the repo.
- Source: entries/2026/06/06/sum-of-unique-elements-solution.md

### counter-intersection-is-elementwise-min [IN] OBSERVATION
`Counter.__iand__` (`&=`) keeps the minimum count of each key present in both operands, implementing multi-set intersection.
- Source: entries/2026/06/06/find-common-characters-solution.md

### counter-is-complete-multiset-algebra [IN] DERIVED
Counter provides a complete algebraic toolkit for multiset problems: construction (from iterables), measurement (frequency queries with zero-default), comparison (subtraction as containment test), and combination (intersection as element-wise min), making it the single abstraction sufficient to cover the entire multiset problem class without supplementary data structures.
- Source type: derived
- Depends on: counter-universal-frequency-primitive, counter-subtraction-is-multiset-containment-test

### counter-max-frequency-pattern [IN] OBSERVATION
`best_poker_hand` uses `max(Counter(ranks).values())` for duplicate detection — this idiom recurs across multiple LeetCode solutions in the repo for frequency-based classification.
- Source: entries/2026/06/06/best-poker-hand-solution.md

### counter-max-keys-bounded-by-digit-sum [IN] OBSERVATION
The Counter produced by `countBalls` has at most 45 entries (max digit sum for a 5-digit number in [1, 100000]), making space O(1) regardless of input range size.
- Source: entries/2026/06/06/maximum-number-of-balls-in-a-box-solution.md

### counter-missing-key-returns-zero [IN] OBSERVATION
The `countWords` solution relies on `Counter.__missing__` returning 0 for absent keys — `c2[w] == 1` implicitly rejects words not in `words2` without an explicit membership check.
- Source: entries/2026/06/06/count-common-words-with-one-occurrence-solution.md

### counter-most-common-double-unwrap [IN] OBSERVATION
`most_common(1)[0][0]` is the standard idiom across this repo's frequency-based solutions to extract the mode element from a `Counter` — first `[0]` selects the top `(element, count)` tuple, second `[0]` extracts the element.
- Source: entries/2026/06/06/most-frequent-number-following-key-in-an-array-solution.md

### counter-outlier-pattern [IN] OBSERVATION
Using `Counter` to find a unique element among a group reduces the problem from O(n^2) pairwise comparison to O(n) frequency lookup — this pattern recurs across solutions like `majority-element` and `single-number` variants
- Source: entries/2026/06/06/odd-string-difference-solution.md

### counter-over-simulation-pattern [IN] OBSERVATION
`countStudents` replaces O(n^2) queue simulation with O(n) frequency counting via `Counter`, recognizing that queue position determines eating order but not eating possibility.
- Source: entries/2026/06/06/number-of-students-unable-to-eat-lunch-solution.md

### counter-pattern-dominates-frequency-problems [IN] OBSERVATION
Frequency-counting problems in this repo (`most-common-word`, `most-frequent-even-element`, `most-frequent-number-following-key`) consistently use `collections.Counter` with generator-based filtering rather than manual dict accumulation or `defaultdict(int)`.
- Source: entries/2026/06/06/most-common-word-solution.md

### counter-set-len-one-idiom [IN] OBSERVATION
`len(set(Counter(s).values())) == 1` is the canonical Python idiom for "all character frequencies are equal" and is used across multiple solutions in this repo for uniformity checks.
- Source: entries/2026/06/06/check-if-all-characters-have-equal-number-of-occurrences-solution.md

### counter-sub-empty-means-containment [IN] OBSERVATION
`not (A - Counter(B))` is true iff B contains at least as many of every key as A; this Counter subtraction idiom (which drops zero/negative counts) is the sole correctness mechanism for the completing-word check.
- Source: entries/2026/06/06/shortest-completing-word-solution.md

### counter-subtraction-as-subset-check [IN] OBSERVATION
`countCharacters` uses `not (Counter(word) - chars_count)` as a sub-multiset containment check — Counter subtraction drops zero/negative counts, so emptiness means every character in the word is available with sufficient multiplicity.
- Source: entries/2026/06/06/find-words-that-can-be-formed-by-characters-solution.md

### counter-subtraction-drops-nonpositive [IN] OBSERVATION
`Counter.__sub__` discards keys with zero or negative counts; an empty result after `A - B` means `A` is a sub-multiset of `B`.
- Source: entries/2026/06/06/ransom-note-solution.md

### counter-subtraction-is-multiset-containment-test [IN] DERIVED
Counter subtraction serves as a multiset containment test across the repo: the drop-nonpositive semantics of `Counter.__sub__` mean that an empty result after `A - B` is equivalent to B containing at least as many of every element as A, and `not (A - B)` is the idiomatic one-expression sub-multiset check — replacing explicit key-by-key iteration with a single algebraic operation.
- Source type: derived
- Depends on: counter-subtraction-as-subset-check, counter-sub-empty-means-containment, counter-subtraction-drops-nonpositive

### counter-then-deduplicate-idiom [IN] OBSERVATION
Frequency-based problems follow a two-step pattern: build a frequency map with `Counter`, then apply a predicate (uniqueness, equality, sorting) over the counts.
- Source: entries/2026/06/06/unique-number-of-occurrences-solution.md

### counter-two-pass-frequency-pipeline [IN] DERIVED
Frequency-based problems follow a standard two-pass pipeline: Counter construction in O(n) followed by a linear scan over the frequency map, with the scan phase specializing across three modes — uniqueness finding (first/kth element with count==1), extremal extraction (max frequency), and group counting (how many keys match a frequency predicate).
- Source type: derived
- Depends on: counter-two-pass-uniqueness-pattern, counter-two-pass-max-then-count, counter-then-deduplicate-idiom

### counter-two-pass-max-then-count [IN] OBSERVATION
`countLargestGroup` uses a two-pass pattern over Counter values — first `max()` to find the largest group size, then a second pass to count groups matching that max — rather than a single-pass or heap approach.
- Source: entries/2026/06/06/count-largest-group-solution.md

### counter-two-pass-uniqueness-pattern [IN] OBSERVATION
The Counter + linear-rescan pattern (count occurrences first, then iterate in original order to find the kth/first unique element) is a recurring idiom across this repo's uniqueness problems.
- Source: entries/2026/06/06/kth-distinct-string-in-an-array-solution.md

### counter-universal-frequency-primitive [IN] DERIVED
Counter from collections is the dominant abstraction in this repo for frequency counting, pair-counting, and multiset comparison, with its zero-default behavior, subtraction semantics, and filtering patterns consistently preferred over manual dict accumulation across the surveyed solutions.
- Depends on: counter-dominant-frequency-tool, counter-pattern-dominates-frequency-problems, counter-missing-key-returns-zero, counter-subtraction-drops-nonpositive

### counter-zero-default-for-missing-keys [IN] OBSERVATION
Frequency-comparison solutions rely on `Counter.__getitem__` returning 0 for absent keys, allowing direct subtraction (`freq1[c] - freq2[c]`) without `.get()` or `defaultdict`.
- Source: entries/2026/06/06/check-whether-two-strings-are-almost-equivalent-solution.md

### counting-beats-sorting-for-single-target [IN] OBSERVATION
When a problem asks for indices of a single target value in a sorted array, counting elements less-than and equal-to the target gives O(n) time vs O(n log n) for actually sorting, since equal elements are always contiguous in sorted order.
- Source: entries/2026/06/06/find-target-indices-after-sorting-array-solution.md

### counting-bits-dp-recurrence [IN] OBSERVATION
`countBits` computes popcount via `ans[i] = ans[i >> 1] + (i & 1)`, decomposing each value's popcount into its right-shifted prefix plus its LSB, achieving O(1) per element.
- Source: entries/2026/06/06/counting-bits-solution.md

### counting-bits-zero-init-is-base-case [IN] OBSERVATION
The `[0] * (n + 1)` initialization serves double duty: it allocates the output array and establishes the base case `ans[0] = 0` without a separate assignment.
- Source: entries/2026/06/06/counting-bits-solution.md

### counting-elements-iterates-arr-not-set [IN] OBSERVATION
`count_elements` iterates the original list (not the set) so duplicates contribute independently to the count — `[1, 1, 2]` returns 2, not 1.
- Source: entries/2026/06/06/counting-elements-solution.md

### counting-elements-successor-only [IN] OBSERVATION
`count_elements` checks strictly `x + 1 in s`; predecessor existence (`x - 1`) does not contribute to the count.
- Source: entries/2026/06/06/counting-elements-solution.md

### counting-vs-simulation-for-origin-return [IN] OBSERVATION
`judgeCircle` determines origin return by counting opposing moves (`L==R` and `U==D`) rather than simulating coordinates, exploiting the mathematical insight that horizontal and vertical axes are independent.
- Source: entries/2026/06/06/robot-return-to-origin-solution.md

### cousins-bfs-resets-per-level [IN] OBSERVATION
`isCousins` resets `x_parent` and `y_parent` to `None` at the start of each BFS level, ensuring it never falsely compares nodes found at different depths.
- Source: entries/2026/06/06/cousins-in-binary-tree-solution.md

### cousins-early-exit-on-depth-mismatch [IN] OBSERVATION
If only one of `x` or `y` is found at a BFS level, `isCousins` returns `False` immediately without visiting deeper levels, since different depths means they cannot be cousins.
- Source: entries/2026/06/06/cousins-in-binary-tree-solution.md

### cousins-parent-identity-comparison [IN] OBSERVATION
`isCousins` compares parents with `!=` (object identity) rather than value equality, which is correct because `TreeNode` has no `__eq__` override — two nodes with the same value at different positions are distinct objects.
- Source: entries/2026/06/06/cousins-in-binary-tree-solution.md

### covered-array-size-assumes-constraint [IN] OBSERVATION
The hardcoded array size 51 in the range-coverage solution relies on the problem constraint that all values are in [1, 50]; inputs outside this range cause IndexError or silent corruption.
- Source: entries/2026/06/06/check-if-all-the-integers-in-a-range-are-covered-solution.md

### crawler-log-depth-clamped-at-zero [IN] OBSERVATION
`minOperations` enforces `depth >= 0` via `max(0, depth - 1)` on `"../"` operations — navigating above root is a no-op, matching filesystem semantics.
- Source: entries/2026/06/06/crawler-log-folder-solution.md

### crawler-log-depth-is-answer [IN] OBSERVATION
`minOperations` returns the raw depth counter directly, relying on the invariant that each child entry adds exactly 1 depth and each `"../"` removes exactly 1.
- Source: entries/2026/06/06/crawler-log-folder-solution.md

### crawler-log-implicit-child-entry [IN] OBSERVATION
Any log string that isn't `"../"` or `"./"` is treated as entering a child folder — there is no validation of the folder name, so malformed strings silently increment depth.
- Source: entries/2026/06/06/crawler-log-folder-solution.md

### cross-product-avoids-division-by-zero [IN] OBSERVATION
The collinearity check in `check-if-it-is-a-straight-line` uses cross-product multiplication `(x-x0)*dy - (y-y0)*dx == 0` rather than slope division, making it correct for vertical lines and exact for integer coordinates without epsilon tolerance.
- Source: entries/2026/06/06/check-if-it-is-a-straight-line-solution.md

### cross-product-for-collinearity [IN] OBSERVATION
Collinearity checks use the cross product (`(x2-x1)*(y3-y1) - (y2-y1)*(x3-x1) != 0`) instead of slope comparison, avoiding division-by-zero edge cases and floating-point precision issues.
- Source: entries/2026/06/06/valid-boomerang-solution.md

### current-stays-after-skip [IN] OBSERVATION
When `delete_duplicates` finds a duplicate and skips it via `current.next = current.next.next`, the `current` pointer does not advance — this is required to handle runs of 3+ identical values.
- Source: entries/2026/06/06/remove-duplicates-from-sorted-list-solution.md

### cursor-streaming-unifies-input-multiplicity [IN] DERIVED
Cursor-based streaming — monotonic pointer progression with state accumulation — is a unified framework that handles arbitrary input multiplicity: two-pointer handles single-input problems (convergence, compaction, inward sweep) while merge-scan handles dual-input problems (sorted intersection, alternating merge), varying only cursor count and advancement rules while preserving the core streaming invariants of monotonic progress and O(n) termination.
- Source type: derived
- Depends on: two-pointer-is-dual-cursor-streaming, merge-scan-extends-sort-pipeline-to-dual-inputs

### cycle-detection-uses-identity-not-equality [IN] OBSERVATION
Cycle detection in linked-list-cycle uses `is` (object identity), not `==` (value equality) — two distinct nodes with the same `val` never produce a false positive.
- Source: entries/2026/06/06/linked-list-cycle-solution.md

### date-problems-mixed-stdlib-manual [IN] OBSERVATION
Date problems in the repo use inconsistent strategies: `day-of-the-week` delegates to `datetime.date.weekday()`, while `day-of-the-year` performs all calendar math manually with a lookup table and no `datetime` import.
- Source: entries/2026/06/06/day-of-the-week-solution.md, entries/2026/06/06/day-of-the-year-solution.md

### date-to-day-string-slicing [IN] OBSERVATION
`_date_to_day` uses fixed-position slicing (`[:2]`, `[3:5]`) rather than delimiter splitting, requiring strictly zero-padded `"MM-DD"` format input.
- Source: entries/2026/06/06/count-days-spent-together-solution.md

### day-of-week-trailing-space [IN] OBSERVATION
`day_of_the_week` returns day names with a trailing space (e.g., `"Monday "` not `"Monday"`), which is load-bearing for test compatibility with LeetCode's expected output format.
- Source: entries/2026/06/06/day-of-the-week-solution.md

### days-in-month-immutable-constant [IN] OBSERVATION
`DAYS_IN_MONTH` is a module-level list that is never mutated at runtime; leap-year handling uses conditional addition (`+1`) rather than modifying the table.
- Source: entries/2026/06/06/day-of-the-year-solution.md

### days-in-month-table-1-indexed [IN] OBSERVATION
The `days_in_month` lookup table in `daysBetweenDates` uses index 0 as a dummy sentinel (value 0) so months 1–12 map directly to their natural positions without offset arithmetic
- Source: entries/2026/06/06/number-of-days-between-two-dates-solution.md

### days-list-rebuilt-per-call [IN] OBSERVATION
In `number_of_days`, the 12-element month-days lookup table is a local variable allocated on every call, not a module-level constant — functionally correct but not cached
- Source: entries/2026/06/06/number-of-days-in-a-month-solution.md

### days-together-inclusive-endpoints [IN] OBSERVATION
The `+ 1` in the overlap formula `max(0, min(a1, b1) - max(a0, b0) + 1)` means both arrival and departure days count as days spent together — this is a closed-interval convention.
- Source: entries/2026/06/06/count-days-spent-together-solution.md

### de-facto-treenode-infra-efficient [IN] DERIVED
The TreeNode infrastructure (shared via inline copies across 400+ test files) provides both correct and efficient tree construction from level-order arrays.
- Depends on: treenode-shared-definition-in-preorder, build-tree-level-order-convention, build-tree-level-order
- Unless: build-helper-uses-list-pop-zero

### decode-message-first-occurrence-wins [IN] OBSERVATION
The substitution cipher is built by mapping each letter to its first occurrence position in the key; duplicate letters are skipped via a `not in table` guard, making the mapping order-dependent and deterministic.
- Source: entries/2026/06/06/decode-the-message-solution.md

### defaultdict-set-for-group-membership [IN] OBSERVATION
`countPoints` uses `defaultdict(set)` to accumulate colors per rod, which automatically deduplicates repeated color placements — a pattern also used in pangram-checking and consistent-string problems across the repo.
- Source: entries/2026/06/06/rings-and-rods-solution.md

### defaults-encode-domain-knowledge-at-every-layer [IN] DERIVED
Solutions rely on well-chosen default values at both the data-structure level (Counter's zero-default for missing keys enables implicit frequency counting) and the algorithm level (sentinel initialization for loop boundaries eliminates first-iteration special cases), using the same principle — absence of data carries semantic meaning — at different abstraction layers.
- Depends on: counter-universal-frequency-primitive, sentinel-initialization-encodes-boundary-conditions

### defect-confinement-from-orthogonal-stabilization [IN] DERIVED
Engineering defects are permanently confined to their originating dimension as a structural consequence of orthogonal stabilization: triple stabilization guarantees that no perturbation in the quality dimension can cascade into correctness or immunity failures, and the equilibrium property of harmless defect permanence confirms that this confinement is self-maintaining — defects neither propagate across dimensions nor accumulate toward a phase transition within their own dimension.
- Source type: derived
- Depends on: triple-stabilization-across-orthogonal-dimensions, harmless-defect-permanence-is-equilibrium-property

### defects-permanent-but-structurally-harmless [IN] DERIVED
Engineering defects occupy a paradoxical equilibrium: they are permanently frozen (no mechanism can remediate them under the isolation architecture) and structurally harmless (inseparable from the quality inversion that makes algorithmic quality high), so defects function as permanent features of the architecture rather than obstacles to correctness.
- Source type: derived
- Depends on: engineering-debt-permanently-frozen, quality-inversion-structurally-inseparable

### defense-investment-tracks-judge-reward-signal [IN] DERIVED
The selective defense pattern (invest in efficiency-improving conditions like early exit, skip robustness-improving conditions like input validation) is a specific instantiation of the quality equilibrium: the LeetCode judge rewards algorithmic efficiency but is indifferent to engineering robustness, so defensive investment follows the reward gradient exactly.
- Depends on: selective-defense-explained-by-judge-boundary, quality-equilibrium-self-reinforcing

### defuse-the-bomb-brute-force-complexity [IN] OBSERVATION
The defuse-the-bomb solution runs in O(n * |k|) time by re-summing the window from scratch at every position, rather than using a sliding window or prefix sum for O(n).
- Source: entries/2026/06/06/defuse-the-bomb-solution.md

### defuse-the-bomb-self-exclusion [IN] OBSERVATION
The summation loop starts at `j = 1`, ensuring `code[i]` is never included in its own replacement value — a correctness invariant of the decryption rule.
- Source: entries/2026/06/06/defuse-the-bomb-solution.md

### degree-single-pass-three-dicts [IN] OBSERVATION
The degree-of-an-array solution populates `count`, `first`, and `last` dictionaries in a single O(n) enumeration, then reduces over degree-tied elements to find the minimum span — no second scan of the input.
- Source: entries/2026/06/06/degree-of-an-array-solution.md

### degree-span-minimum-over-ties [IN] OBSERVATION
The degree-of-an-array return value considers all elements tied at the maximum frequency, not just the first one found — `min(last[n] - first[n] + 1 for n in count if count[n] == degree)`.
- Source: entries/2026/06/06/degree-of-an-array-solution.md

### delete-cols-assumes-uniform-length [IN] OBSERVATION
`minDeletionSize` uses `len(strs[0])` for the column count and indexes all other strings at the same positions — ragged input causes silent wrong results or `IndexError`.
- Source: entries/2026/06/06/delete-columns-to-make-sorted-solution.md

### delete-cols-early-exit [IN] OBSERVATION
The inner loop in `minDeletionSize` breaks on the first out-of-order pair per column, avoiding redundant comparisons after a violation is found.
- Source: entries/2026/06/06/delete-columns-to-make-sorted-solution.md

### delete-cols-native-char-compare [IN] OBSERVATION
Column sortedness is checked via Python's native `<` on single characters, which is correct only for uniform-case single-byte alphabets (the problem guarantees lowercase a-z).
- Source: entries/2026/06/06/delete-columns-to-make-sorted-solution.md

### delete-duplicates-requires-sorted-input [IN] OBSERVATION
Correctness of `delete_duplicates` depends on non-decreasing order; unsorted input produces silently wrong results since only adjacent nodes are compared.
- Source: entries/2026/06/06/remove-duplicates-from-sorted-list-solution.md

### delete-duplicates-returns-same-head [IN] OBSERVATION
`delete_duplicates` always returns the exact same `head` object it received (or `None` for empty input); it never allocates or replaces the head node.
- Source: entries/2026/06/06/remove-duplicates-from-sorted-list-solution.md

### delete-nodes-head-never-changes [IN] OBSERVATION
`deleteNodes` always returns the original `head` pointer unchanged because the first m nodes are always kept and m >= 1 is guaranteed.
- Source: entries/2026/06/06/delete-n-nodes-after-m-nodes-of-a-linked-list-solution.md

### delete-nodes-keep-loop-off-by-one [IN] OBSERVATION
The keep-phase iterates `m - 1` times (not `m`) because `current` already points to the first node being kept — an easy-to-misread boundary.
- Source: entries/2026/06/06/delete-n-nodes-after-m-nodes-of-a-linked-list-solution.md

### delete-nodes-tolerates-short-lists [IN] OBSERVATION
Both the keep and delete phases exit early via null checks if the list is exhausted before completing `m` or `n` steps — no crash on short inputs.
- Source: entries/2026/06/06/delete-n-nodes-after-m-nodes-of-a-linked-list-solution.md

### delete-nodes-zero-allocation [IN] OBSERVATION
The delete-N-after-M algorithm creates no new `ListNode` instances — it only rewires `.next` pointers on existing nodes, using O(1) extra space.
- Source: entries/2026/06/06/delete-n-nodes-after-m-nodes-of-a-linked-list-solution.md

### delta-array-off-by-one-correct [IN] OBSERVATION
In `maxAliveYear`, the death-year decrement at `delta[death - 1950]` correctly models exclusive death semantics: a person born in 1990 who dies in 2000 contributes to years 1990–1999 only.
- Source: entries/2026/06/06/maximum-population-year-solution.md

### depth-zero-marks-primitive-boundaries [IN] OBSERVATION
In `removeOuterParentheses`, the depth counter returns to exactly 0 at the end of each primitive decomposition component and nowhere else within it — this structural property is what the algorithm exploits to avoid explicit delimiter detection.
- Source: entries/2026/06/06/remove-outermost-parentheses-solution.md

### deque-never-empty-during-eviction [IN] OBSERVATION
In the recent-calls solution, the `while self.q[0] < t - 3000` loop cannot raise IndexError because the just-appended `t` always satisfies the window boundary, preventing full drain
- Source: entries/2026/06/06/number-of-recent-calls-solution.md

### deque-sliding-window-pattern [IN] OBSERVATION
Sliding window problems use `collections.deque` with front-eviction for O(1) amortized operations, relying on the invariant that inputs arrive in sorted order so stale entries are always at the front
- Source: entries/2026/06/06/number-of-recent-calls-solution.md

### destcity-empty-input-guard [IN] OBSERVATION
destCity raises ValueError on empty input; all other preconditions (valid path structure, linear chain) are trusted from the problem statement without validation.
- Source: entries/2026/06/06/destination-city-solution.md

### destcity-linear-time-and-space [IN] OBSERVATION
destCity runs in O(n) time and O(n) space with two passes over the paths list: one to build the source set, one to find the non-source destination.
- Source: entries/2026/06/06/destination-city-solution.md

### destcity-set-difference-approach [IN] OBSERVATION
destCity solves the terminal-city problem via set membership — builds a set of source cities, then finds the first destination absent from it — avoiding graph construction entirely.
- Source: entries/2026/06/06/destination-city-solution.md

### detect-capital-counting-reduction [IN] OBSERVATION
detectCapitalUse counts uppercase characters in a single O(n) pass via generator expression, then derives all three valid patterns (all-upper, all-lower, first-only-upper) from that single count.
- Source: entries/2026/06/06/detect-capital-solution.md

### detect-capital-no-empty-guard [IN] OBSERVATION
detectCapitalUse accesses word[0] without a length check and will raise IndexError on empty input, relying on LeetCode's guarantee that len(word) >= 1.
- Source: entries/2026/06/06/detect-capital-solution.md

### dfs-null-guard-at-callsite [IN] OBSERVATION
In tree DFS solutions, the inner recursive function is only called on non-None nodes — null checks happen at the call site before recursing into children, not inside the recursive function body.
- Source: entries/2026/06/06/sum-of-root-to-leaf-binary-numbers-solution.md

### dfs-short-circuits-via-and-chain [IN] OBSERVATION
Tree DFS solutions use Python's `and` short-circuit evaluation (`node.val == target and dfs(left) and dfs(right)`) to stop traversal immediately on the first failing condition.
- Source: entries/2026/06/06/univalued-binary-tree-solution.md

### di-string-match-greedy-correctness [IN] OBSERVATION
Placing the current minimum on 'I' and current maximum on 'D' always produces a valid permutation without backtracking; correctness follows from the fact that any remaining unused value is strictly greater than the current min and strictly less than the current max.
- Source: entries/2026/06/06/di-string-match-solution.md

### di-string-match-loop-postcondition [IN] OBSERVATION
After the for-loop in DI String Match, `low == high` holds unconditionally (the loop consumes n values from a pool of n+1), so the final append always places exactly the one remaining unused value.
- Source: entries/2026/06/06/di-string-match-solution.md

### diagonal-sum-linear-time [IN] OBSERVATION
The solution runs in O(n) time with a single pass over row indices, not O(n^2) over the full matrix.
- Source: entries/2026/06/06/matrix-diagonal-sum-solution.md

### diagonal-sum-n1-correctness [IN] OBSERVATION
For a 1x1 matrix, the loop adds the element twice and the odd-correction subtracts it once, yielding the correct result through the general path rather than special-case code.
- Source: entries/2026/06/06/matrix-diagonal-sum-solution.md

### diagonal-sum-no-input-validation [IN] OBSERVATION
The function assumes `mat` is a non-empty square matrix and performs no shape or type validation.
- Source: entries/2026/06/06/matrix-diagonal-sum-solution.md

### diagonal-sum-overcounting-correction [IN] OBSERVATION
The center element is double-counted by the loop when n is odd, and the post-loop subtraction is the sole mechanism that corrects this.
- Source: entries/2026/06/06/matrix-diagonal-sum-solution.md

### diameter-not-necessarily-through-root [IN] OBSERVATION
The diameter algorithm correctly finds longest paths that don't pass through the root by checking `left_height + right_height` at every node during the DFS, not just at the root.
- Source: entries/2026/06/06/diameter-of-binary-tree-solution.md

### diameter-returns-edges-not-nodes [IN] OBSERVATION
`diameter_of_binary_tree` returns the number of edges on the longest path, not the number of nodes; a single-node tree returns 0, not 1.
- Source: entries/2026/06/06/diameter-of-binary-tree-solution.md

### dict-dispatch-over-conditionals [IN] OBSERVATION
`countMatches` maps string keys to positional indices via a dictionary literal (`{"type": 0, "color": 1, "name": 2}[ruleKey]`) rather than an if/elif chain — a pattern worth checking for reuse in other key-to-index solutions.
- Source: entries/2026/06/06/count-items-matching-a-rule-solution.md

### diet-plan-no-input-validation [IN] OBSERVATION
`dietPlanPerformance` performs no validation; if `k > len(calories)` the loop never executes and produces a single (possibly incorrect) evaluation rather than raising an error.
- Source: entries/2026/06/06/diet-plan-performance-solution.md

### diet-plan-sliding-window-o-n [IN] OBSERVATION
The diet plan solution runs in O(n) time and O(1) space by computing the first window sum once, then incrementally adding the entering element and subtracting the leaving element.
- Source: entries/2026/06/06/diet-plan-performance-solution.md

### diet-plan-threshold-exclusive [IN] OBSERVATION
Scores change only when the window sum is strictly less than `lower` or strictly greater than `upper`; sums exactly equal to either threshold produce no score change.
- Source: entries/2026/06/06/diet-plan-performance-solution.md

### diff-tuple-hashable-for-counter [IN] OBSERVATION
The difference array in `odd-string-difference` is returned as a tuple (not list) specifically so it can be used as a `Counter` key — switching to list would break the frequency counting
- Source: entries/2026/06/06/odd-string-difference-solution.md

### difference-array-technique [IN] OBSERVATION
`maxAliveYear` uses the difference-array (sweep-line) pattern: record +1 at birth and -1 at death, then prefix-sum to reconstruct population, achieving O(n + R) instead of O(n * R).
- Source: entries/2026/06/06/maximum-population-year-solution.md

### digit-accumulation-is-greedy [IN] OBSERVATION
Consecutive digits in `abbr` are always parsed as a single number via a greedy inner `while` loop (e.g., `"12"` means skip 12, not skip 1 then skip 2).
- Source: entries/2026/06/06/valid-word-abbreviation-solution.md

### digit-count-alias-is-bound-method [IN] OBSERVATION
`rearrange_array` is a bound method on a throwaway `Solution()` instance, not a standalone function; this is the repo convention for exposing a uniform entry point to tests
- Source: entries/2026/06/06/check-if-number-has-equal-digit-count-and-digit-value-solution.md

### digit-count-misnamed-alias [IN] OBSERVATION
The alias `rearrange_array` has no semantic relationship to the digit-count problem; it's likely a copy-paste artifact from the project's code generation pipeline
- Source: entries/2026/06/06/check-if-number-has-equal-digit-count-and-digit-value-solution.md

### digit-extraction-modular-idiom [IN] OBSERVATION
The `n % 10` / `n //= 10` loop for digit extraction is a recurring idiom across dozens of solutions in this repo (e.g., `self-dividing-numbers`, `alternating-digit-sum`, `add-digits`, `subtract-the-product-and-sum-of-digits-of-an-integer`)
- Source: entries/2026/06/06/count-the-digits-that-divide-a-number-solution.md

### digit-extraction-prefers-mod-arithmetic [IN] OBSERVATION
Multiple solutions (`sum-of-digits-in-base-k`, `sum-of-digits-in-the-minimum-number`) extract digits via `% 10` / `// 10` loops rather than string conversion, avoiding allocation.
- Source: entries/2026/06/06/sum-of-digits-in-base-k-solution.md

### digit-extraction-uses-modular-arithmetic [IN] OBSERVATION
Digit extraction across the repo uses `% 10` / `//= 10` modular arithmetic exclusively, avoiding `str()` conversion and intermediate string allocations.
- Source: entries/2026/06/06/difference-between-element-sum-and-digit-sum-of-an-array-solution.md

### digit-remapping-greedy-targets-positional-extremes [IN] DERIVED
Digit remapping achieves both its minimum and maximum through a single greedy digit substitution targeting the most positionally impactful digit — the leading digit maps to 0 for minimum (maximum positional weight), the leftmost non-9 digit maps to 9 for maximum (highest available gain) — sharing the same structural principle (leftmost-significant substitution) despite targeting opposite extremes.
- Source type: derived
- Depends on: min-remap-always-leading-digit, max-remap-first-non-nine

### digit-sum-min-returns-binary [IN] OBSERVATION
`sum_of_digits` returns exactly 0 or 1 (even/odd parity of the minimum element's digit sum), never any other value.
- Source: entries/2026/06/06/sum-of-digits-in-the-minimum-number-solution.md

### digit-sum-no-validation [IN] OBSERVATION
`digitSum` performs no input validation; non-digit characters raise `ValueError` from `int(c)`, and `k=0` raises `ValueError` from `range(0, len(s), 0)`.
- Source: entries/2026/06/06/calculate-digit-sum-of-a-string-solution.md

### digit-sum-pure-function [IN] OBSERVATION
`digitSum` has no side effects — it rebinds `s` each iteration rather than mutating it, and does not modify `self` or external state.
- Source: entries/2026/06/06/calculate-digit-sum-of-a-string-solution.md

### digit-sum-terminates [IN] OBSERVATION
Each iteration of the `while len(s) > k` loop produces a strictly shorter string (summing `d` digits yields at most `ceil(log10(9d+1))` characters, which is less than `d` for `d >= 2`), guaranteeing termination for valid inputs.
- Source: entries/2026/06/06/calculate-digit-sum-of-a-string-solution.md

### digit-sum-via-str-conversion [IN] OBSERVATION
`countBalls` computes digit sums by casting to string and summing character values (`sum(int(d) for d in str(i))`), not by arithmetic divmod.
- Source: entries/2026/06/06/maximum-number-of-balls-in-a-box-solution.md

### digital-root-zero-special-case [IN] OBSERVATION
The digital root formula `1 + (n-1) % 9` requires an explicit `num == 0` guard because `(-1) % 9 == 8` in Python, which would return 9 instead of 0.
- Source: entries/2026/06/06/add-digits-solution.md

### digits-dividing-num-no-zero-guard [IN] OBSERVATION
`digits_dividing_num` will raise `ZeroDivisionError` if any digit of the input is zero, since there is no guard before the `num % digit` expression
- Source: entries/2026/06/06/count-the-digits-that-divide-a-number-solution.md

### digits-dividing-num-order-independent [IN] OBSERVATION
Digits are processed right-to-left but the result is order-independent since each digit's divisibility is checked against the unchanged original `num`
- Source: entries/2026/06/06/count-the-digits-that-divide-a-number-solution.md

### digits-dividing-num-preserves-input [IN] OBSERVATION
The original `num` parameter is never modified during digit extraction; a separate variable `n` is consumed by the `n % 10` / `n //= 10` loop
- Source: entries/2026/06/06/count-the-digits-that-divide-a-number-solution.md

### distance-value-empty-arr2-correct [IN] OBSERVATION
When `arr2` is empty, `findTheDistanceValue` correctly returns `len(arr1)` because `bisect_left` returns 0 and both boundary guards fail, so no element is marked too close.
- Source: entries/2026/06/06/find-the-distance-value-between-two-arrays-solution.md

### distance-value-sort-bisect-complexity [IN] OBSERVATION
`findTheDistanceValue` runs in O(m log m + n log m) time via sort + binary search, versus O(n*m) for brute-force nested loop.
- Source: entries/2026/06/06/find-the-distance-value-between-two-arrays-solution.md

### distinct-averages-mutates-input [IN] OBSERVATION
`distinctAverages` calls `nums.sort()` which mutates the caller's list in-place; no defensive copy is made.
- Source: entries/2026/06/06/number-of-distinct-averages-solution.md

### distinct-elements-enables-first-element-argmax [IN] OBSERVATION
With distinct elements, the lexicographically largest subarray of length k always starts at the position of the maximum value in `nums[0:n-k+1]` — no need to compare subsequent elements.
- Source: entries/2026/06/06/largest-subarray-length-k-solution.md

### distinct-numbers-o1-mathematical-reduction [IN] OBSERVATION
`distinct_numbers(n)` is an O(1) closed-form solution: returns 1 if `n == 1`, else `n - 1`, based on the insight that `x % (x-1) == 1` cascades from `n` down to `2`.
- Source: entries/2026/06/06/count-distinct-numbers-on-board-solution.md

### distinct-numbers-steady-state-cascade [IN] OBSERVATION
For `n >= 2`, the board stabilizes to `{2, 3, ..., n}` because each `x % (x-1) == 1` adds the next smaller number, halting at 2 since `2 % 1 == 0`.
- Source: entries/2026/06/06/count-distinct-numbers-on-board-solution.md

### distribute-candies-greedy-min [IN] OBSERVATION
The answer to "distribute candies" is always `min(n//2, len(set(candyType)))` — the tighter of two independent upper bounds (eating quota vs. distinct types available), a constraint-as-min greedy pattern.
- Source: entries/2026/06/06/distribute-candies-solution.md

### distribute-candies-to-people-index-mapping [IN] OBSERVATION
The circular person assignment `(give - 1) % num_people` depends on `give` being 1-based; changing it to 0-based would require removing the `- 1` or the mapping breaks by off-by-one.
- Source: entries/2026/06/06/distribute-candies-to-people-solution.md

### distribute-candies-to-people-no-overcounting [IN] OBSERVATION
`min(give, candies)` ensures total distributed never exceeds the original candy count, even though `candies -= give` can drive the counter negative before the loop guard catches it.
- Source: entries/2026/06/06/distribute-candies-to-people-solution.md

### distribute-candies-to-people-sqrt-time [IN] OBSERVATION
The distribution simulation runs O(sqrt(candies)) iterations because the sum 1+2+...+k reaches `candies` when k ≈ sqrt(2*candies), making it sublinear in the candy count.
- Source: entries/2026/06/06/distribute-candies-to-people-solution.md

### divisible-pairs-loop-guarantees-uniqueness [IN] OBSERVATION
The inner loop `j in range(i + 1, n)` ensures each unordered pair `(i, j)` is visited exactly once with `i < j` always satisfied, preventing duplicates by construction.
- Source: entries/2026/06/06/count-equal-and-divisible-pairs-in-an-array-solution.md

### divisible-pairs-value-check-short-circuits-modulo [IN] OBSERVATION
Python's `and` short-circuits, so the `(i * j) % k == 0` modulo is only evaluated when `nums[i] == nums[j]` — the cheaper equality check gates the arithmetic.
- Source: entries/2026/06/06/count-equal-and-divisible-pairs-in-an-array-solution.md

### divisor-game-parity-invariant [IN] OBSERVATION
Alice wins the Divisor Game if and only if n is even; the proof relies on Alice always subtracting 1 from even n to hand Bob an odd number, maintaining the invariant. The solution is O(1).
- Source: entries/2026/06/06/divisor-game-solution.md

### docstrings-capture-problem-constraints [IN] OBSERVATION
Docstrings in solution files document LeetCode problem constraints (e.g., input ranges) rather than implementation details, preserving the original problem spec alongside the code.
- Source: entries/2026/06/06/add-two-integers-solution.md

### domain-constraints-sufficient-for-algorithmic-not-engineering-convergence [IN] DERIVED
Domain constraints from the problem space are sufficient to produce algorithmic convergence (a closed three-strategy taxonomy emerges without coordination) but insufficient for engineering convergence (naming, testing, and structure all drift without enforcement) — algorithmic consistency is pulled by the domain, engineering consistency must be pushed by process.
- Depends on: taxonomy-closed-and-structurally-partitioned, quality-inversion-algorithmic-vs-engineering

### domain-is-fixed-point-of-quality-dynamics [IN] DERIVED
The LeetCode domain constitutes a fixed point of quality dynamics: the judge reward signal selects for algorithmic investment over engineering robustness, while the domain's structural constraints make this investment profile a stable attractor — the system not only converges to this quality profile but cannot leave it through any internal evolutionary pressure.
- Depends on: defense-investment-tracks-judge-reward-signal, domain-selects-stable-quality-attractor

### domain-selects-stable-quality-attractor [IN] DERIVED
The repo's quality profile (high algorithmic sophistication, low engineering discipline) is a stable attractor selected by the domain itself: LeetCode's problem structure produces a closed strategy taxonomy that converges without coordination, and only algorithmic quality is rewarded by the judge — making any perturbation toward engineering investment self-correcting back to the current equilibrium.
- Depends on: quality-equilibrium-self-reinforcing, domain-constraints-sufficient-for-algorithmic-not-engineering-convergence

### dominance-via-second-max-sufficiency [IN] OBSERVATION
Checking `max_val >= 2 * second_max` is sufficient to verify dominance over all elements, because if the max is at least twice the second-largest, it is at least twice every smaller element — used in `largest-number-at-least-twice-of-others`
- Source: entries/2026/06/06/largest-number-at-least-twice-of-others-solution.md

### dominant-pipeline-mutation-has-zero-observable-consequence [IN] DERIVED
The sort-then-two-pointer pipeline's primary side effect — in-place sort mutation of the input array — has zero observable consequence because the single-call LeetCode context ensures no caller ever inspects the mutated ordering, making the most prevalent form of input modification in the entire codebase functionally invisible.
- Source type: derived
- Depends on: sort-then-two-pointer-dominant-pair-pipeline, mutation-invisible-in-single-call-context

### double-mod-deficit-formula [IN] OBSERVATION
The expression `(k - n % k) % k` is the standard formula for "units to add to make n a multiple of k" — the outer mod collapses the already-aligned case from k to 0.
- Source: entries/2026/06/06/divide-a-string-into-groups-of-size-k-solution.md

### double-reversal-method-name-mismatch [IN] OBSERVATION
`a-number-after-a-double-reversal/solution.py` names its method `minOperations` instead of the expected `isSameAfterReversals` — a copy-paste naming error.
- Source: entries/2026/06/06/a-number-after-a-double-reversal-solution.md

### doubling-loop-always-terminates [IN] OBSERVATION
The while loop in `find_final_value` always terminates because `original` strictly increases (doubles) each iteration and the lookup set has a finite maximum value.
- Source: entries/2026/06/06/keep-multiplying-found-values-by-two-solution.md

### dp-bounded-lookback-reduces-to-streaming [IN] DERIVED
Dynamic programming with bounded lookback reduces to the streaming paradigm's dominant shape: replacing an O(n) DP table with O(1) rolling variables transforms a DP recurrence into a single-pass scan with scalar accumulators — proving that streaming's coverage extends beyond pure accumulation problems to subsume a class of dynamic programming problems.
- Source type: derived
- Depends on: dp-to-streaming-via-rolling-variable-reduction, single-pass-streaming-dominant-shape

### dp-to-streaming-via-rolling-variable-reduction [IN] DERIVED
The min-cost-climbing-stairs solution demonstrates the general DP-to-streaming reduction: an O(n) DP table with bounded lookback (each cell depends on only the previous two) collapses to O(1) rolling variables while preserving the recurrence's loop invariant, with the final answer requiring a min over the last two states because the top is reachable from either.
- Source type: derived
- Depends on: min-cost-dp-uses-constant-space, min-cost-loop-invariant, min-cost-final-answer-is-min-of-last-two

### dsu-pattern-in-sorting-solutions [IN] OBSERVATION
`sort_names_by_height` uses the decorate-sort-undecorate pattern (`zip` + `sorted` + comprehension unpacking), which is the idiomatic Python approach for sorting one list by another and recurs across sorting problems in this repo.
- Source: entries/2026/06/06/sort-the-people-solution.md

### dual-description-proves-unique-canonical-form [IN] DERIVED
The solution space possesses a provably unique canonical form: elimination and streaming independently arrive at the same extremal minimality (elimination via constructive proof through mathematical reduction, streaming via convergence-attractor coincidence with algebraic normal form), and their demonstrated duality means any alternative characterization must reduce to this one — two independent proof paths converging on the same object establishes uniqueness, not merely equivalence.
- Source type: derived
- Depends on: elimination-and-streaming-are-dual-descriptions, elimination-has-constructive-minimality-proof

### dual-impl-pattern-tree-problems [IN] OBSERVATION
Tree problems in this repo sometimes provide both recursive and iterative implementations, with tests asserting both produce identical results for all inputs.
- Source: entries/2026/06/06/symmetric-tree-solution.md

### dual-interface-pattern [IN] OBSERVATION
Some solution files provide both a `Solution` class method and a standalone function with identical logic, giving callers a choice of interface.
- Source: entries/2026/06/06/check-if-binary-string-has-at-most-one-segment-of-ones-solution.md

### dummy-head-sentinel-pattern [IN] OBSERVATION
`remove_elements` and `from_list` both use a dummy sentinel node (`ListNode(next=head)`) so that operations at the head position require no special-case branching — this pattern recurs across linked list solutions in the repo.
- Source: entries/2026/06/06/remove-linked-list-elements-solution.md

### dummy-sentinel-pattern [IN] OBSERVATION
The dummy/sentinel head pattern (allocate a throwaway node, build via `tail.next`, return `dummy.next`) is the standard linked-list construction idiom in this repo, used in both solution algorithms and test helpers like `from_list`.
- Source: entries/2026/06/06/merge-two-sorted-lists-solution.md

### duplicate-zeros-boundary-zero-special-case [IN] OBSERVATION
When the last surviving element is a zero that lands exactly at position n, it receives only one copy to avoid array overrun — this edge case is handled before the main copy loop.
- Source: entries/2026/06/06/duplicate-zeros-solution.md

### duplicate-zeros-right-to-left-prevents-overwrite [IN] OBSERVATION
duplicate-zeros uses a two-pass right-to-left copy: first pass counts surviving zeros to find the write-head start, second pass copies backward so `j >= i` always holds and writes never destroy unread source data.
- Source: entries/2026/06/06/duplicate-zeros-solution.md

### duplicates-are-irrelevant [IN] OBSERVATION
Converting `nums` to a set discards count information, which is correct because the problem only requires existence checks, not frequency — duplicate values in the input do not affect the result.
- Source: entries/2026/06/06/keep-multiplying-found-values-by-two-solution.md

### duplication-cost-free-when-implementations-correct [IN] DERIVED
Per-problem code duplication (TreeNode definitions, tree builders, test helpers) carries zero maintenance cost as long as every copy is correct — there is no shared module to fix once, but there is also nothing to break.
- Depends on: duplication-over-shared-infrastructure, self-contained-solution-with-local-treenode
- Unless: build-helper-uses-list-pop-zero

### duplication-over-shared-infrastructure [IN] DERIVED
Data structures and helpers are systematically duplicated per problem directory rather than factored into shared modules, trading DRY for zero coupling across 400+ solutions.
- Depends on: treenode-is-de-facto-shared-via-inline-copies, tree-serialization-helpers-duplicated, per-problem-data-structure-isolation, repo-no-cross-problem-imports

### early-exit-accumulator-pattern [IN] OBSERVATION
`checkRecord` returns `False` immediately upon hitting 2 absences or 3 consecutive lates, never scanning characters beyond the first disqualifying condition
- Source: entries/2026/06/06/student-attendance-record-i-solution.md

### early-exit-and-sentinel-jointly-eliminate-boundary-code [IN] DERIVED
Early-exit patterns eliminate branch code for post-violation states (computation end), while sentinel initialization eliminates branch code for first-iteration special cases (computation start) — together they remove boundary-handling logic from both ends of the computation, leaving only the core invariant-maintaining loop body.
- Depends on: early-exit-optimizations-pervasive, sentinel-initialization-encodes-boundary-conditions

### early-exit-bounds-diffs [IN] OBSERVATION
The `len(diffs) > 2` guard inside the loop guarantees that `diffs` has at most 2 elements when the post-loop branches execute, making the final match safe without bounds checking
- Source: entries/2026/06/06/check-if-one-string-swap-can-make-strings-equal-solution.md

### early-exit-correctness [IN] OBSERVATION
The `if j > min_sum: break` in `findRestaurant` is correct because all index map values are non-negative, guaranteeing `idx_sum >= j`; once `j` exceeds the current best sum, no future candidate can improve the answer.
- Source: entries/2026/06/06/minimum-index-sum-of-two-lists-solution.md

### early-exit-on-impossible-partition [IN] OBSERVATION
The decomposable-substrings solution short-circuits to `False` on the first character run with `length % 3 == 1`, since no valid tiling of 2s and 3s can cover that remainder without exceeding the exactly-one-two constraint.
- Source: entries/2026/06/06/check-if-string-is-decomposable-into-value-equal-substrings-solution.md

### early-exit-on-overshoot [IN] OBSERVATION
The length check `len(prefix) > len(s)` guarantees the prefix-building loop terminates as soon as the accumulated string exceeds the target, bounding runtime to O(len(s))
- Source: entries/2026/06/06/check-if-string-is-a-prefix-of-array-solution.md

### early-exit-optimizations-pervasive [IN] DERIVED
Solutions systematically use early-exit and short-circuit patterns to avoid unnecessary computation, returning on first-found violations, matches, or threshold crossings.
- Depends on: three-consecutive-odds-early-exit, path-crossing-early-exit, isomorphic-early-return, first-violation-sufficiency

### early-return-on-first-match [IN] OBSERVATION
`containsNearbyDuplicate` returns `True` on the first duplicate found within distance `k`, short-circuiting the rest of the scan.
- Source: entries/2026/06/06/contains-duplicate-ii-solution.md

### edge-case-inputs-crash-free [IN] DERIVED
Solutions handle degenerate inputs (empty strings, zero, single-element collections) without runtime crashes.
- Depends on: valid-palindrome-empty-is-palindrome, palindrome-perm-empty-string-true, empty-input-returns-zero-majority, crawler-log-depth-clamped-at-zero
- Unless: pillow-holder-n1-crash, circular-sentence-nonempty-assumed, zero-input-returns-false

### element-sum-gte-digit-sum [IN] OBSERVATION
For positive integers, element sum is always >= digit sum (a multi-digit number always exceeds the sum of its digits), so the `abs()` call in the solution is a no-op guard rather than a functional requirement.
- Source: entries/2026/06/06/difference-between-element-sum-and-digit-sum-of-an-array-solution.md

### elimination-and-reduction-are-isomorphic [IN] DERIVED
The three elimination axes and the three-tier reduction hierarchy are isomorphic characterizations of the same structural phenomenon: computation elimination maps to mathematical reduction (closed-form replaces iteration), validation elimination maps to streaming's self-sufficiency (no prerequisites to eliminate), and coupling elimination maps to the preprocessing adapter pattern (isolation removes inter-solution dependencies that would otherwise require coordination).
- Source type: derived
- Depends on: elimination-operates-through-three-complementary-axes, solution-reduction-forms-complete-hierarchy

### elimination-and-streaming-are-dual-descriptions [IN] DERIVED
The elimination principle (removing validation, coupling, and complexity at the architectural level) and the streaming paradigm (retaining only minimal single-pass computation at the algorithmic level) are dual descriptions of the same structural phenomenon: the three elimination axes map onto the three reduction tiers via their shared isomorphism, and streaming's universality-minimality coincidence is the computational realization of elimination's architectural minimality.
- Source type: derived
- Depends on: elimination-and-reduction-are-isomorphic, streaming-universality-and-minimality-coincide

### elimination-explains-defect-confinement-mechanism [IN] DERIVED
Defect confinement is a direct structural consequence of the elimination principle's operation through duality: elimination removes the coupling channels (validation paths, shared imports, cross-module state) through which engineering defects could propagate to runtime behavior, and since streaming — elimination's dual — requires none of these channels, the confinement is not merely observed but mechanistically explained by the same force that shapes the solution space.
- Source type: derived
- Depends on: defect-confinement-from-orthogonal-stabilization, elimination-and-streaming-are-dual-descriptions

### elimination-has-constructive-minimality-proof [IN] DERIVED
The elimination principle possesses a constructive proof of its own extremal minimality: mathematical reduction collapses streaming's scan to constant-time evaluation (proving streaming is not yet minimal), and since elimination and reduction are isomorphic, the mathematical solutions serve as constructive witnesses that the elimination framework reaches a unique minimal fixed point — the point where no further elimination is possible because the computation itself has been reduced to a single evaluation.
- Source type: derived
- Depends on: mathematical-reduction-proves-streaming-extremal-minimality, elimination-and-reduction-are-isomorphic

### elimination-is-universal-structural-explanation [IN] DERIVED
Elimination (of requirements, of coupling, of validation) is the universal structural explanation for both the repo's strengths and weaknesses: the same construction-plus-isolation pattern that creates algorithmic coherence without coordination also makes the quality inversion structurally inseparable — algorithmic sophistication and engineering neglect are not independent phenomena but two faces of requirement elimination.
- Depends on: coherence-through-elimination-not-enforcement, quality-inversion-structurally-inseparable

### elimination-operates-through-three-complementary-axes [IN] DERIVED
The elimination principle that explains the repo's character operates through three complementary axes targeting different categories of conventionally-required code: structural elimination (construction-based correctness removes validation and boundary logic), architectural elimination (per-problem isolation removes coupling and coordination), and computational elimination (mathematical reduction removes iterative simulation) — each axis is independently sufficient for its category and jointly they account for the repo's entire deviation from standard engineering practice.
- Source type: derived
- Depends on: mathematical-reduction-is-third-elimination-axis, elimination-is-universal-structural-explanation

### elimination-unifies-structural-and-quality-explanations [IN] DERIVED
Elimination operates as a single generative principle from which the system's complete character follows across both dimensions: in the quality dimension, elimination removes coupling channels through duality, explaining why defects remain permanently confined to their originating dimension; in the structural dimension, elimination's dual descriptions (streaming and reduction) independently arrive at the same extremal minimality, proving canonical form uniqueness. The system's structure and its quality profile are both consequences of the same underlying principle.
- Source type: derived
- Depends on: elimination-explains-defect-confinement-mechanism, dual-description-proves-unique-canonical-form

### else-branch-assumes-twenty [IN] OBSERVATION
In lemonade-change, any bill value that isn't 5 or 10 falls through to the else branch and is treated as a $20 with no validation.
- Source: entries/2026/06/06/lemonade-change-solution.md

### empty-broken-letters-returns-all-words [IN] OBSERVATION
When `brokenLetters` is empty, `canBeTypedWords` returns the total word count because an empty set is disjoint with every word.
- Source: entries/2026/06/06/maximum-number-of-words-you-can-type-solution.md

### empty-collection-as-error-signal [IN] OBSERVATION
Solutions return empty collections (e.g., `[]`) for invalid inputs rather than raising exceptions, following LeetCode's convention of using the return type as the error signal.
- Source: entries/2026/06/06/convert-1d-array-into-2d-array-solution.md

### empty-input-returns-zero [IN] OBSERVATION
`max_value` returns 0 for an empty operations list without error, consistent with the "start at 0" specification.
- Source: entries/2026/06/06/final-value-of-variable-after-performing-operations-solution.md

### empty-input-returns-zero-majority [IN] OBSERVATION
`majority_element([])` returns `0` without raising, because the loop never executes and `candidate` retains its initial value of `0`.
- Source: entries/2026/06/06/majority-element-solution.md

### empty-prefix-never-compared [IN] OBSERVATION
`is_prefix_string` checks equality after appending each word, so the empty string is never compared; this is safe given LeetCode's `1 <= s.length` constraint but would incorrectly return `False` for `s = ""`
- Source: entries/2026/06/06/check-if-string-is-a-prefix-of-array-solution.md

### empty-ransom-note-always-constructible [IN] OBSERVATION
`can_construct("", magazine)` returns `True` for any `magazine` (including empty string), because `Counter("") - Counter(anything)` is empty.
- Source: entries/2026/06/06/ransom-note-solution.md

### empty-string-always-matches-substring [IN] OBSERVATION
An empty string `""` in `patterns` always increments the count in `numOfStrings`, because `"" in word` is `True` for any string `word`.
- Source: entries/2026/06/06/number-of-strings-that-appear-as-substrings-in-word-solution.md

### empty-string-returns-zero [IN] OBSERVATION
`count_letters("")` returns 0 without any special-case code, handled implicitly by the outer while-loop guard
- Source: entries/2026/06/06/count-substrings-with-only-one-distinct-letter-solution.md

### empty-target-raises [IN] OBSERVATION
`maxNumberOfCopies(s, "")` raises `ValueError` because `min()` receives an empty generator when `Counter(target)` is empty.
- Source: entries/2026/06/06/rearrange-characters-to-make-target-string-solution.md

### empty-word-always-consistent [IN] OBSERVATION
An empty string `""` counts as consistent because `all()` returns `True` on an empty iterable — this is Python semantics, not special-case code
- Source: entries/2026/06/06/count-the-number-of-consistent-strings-solution.md

### endpoint-preservation-invariant [IN] OBSERVATION
The missing-number-in-AP algorithm's correctness depends on the guarantee that the removed element is never the first or last element, so `arr[0]` and `arr[-1]` are the true endpoints of the original progression.
- Source: entries/2026/06/06/missing-number-in-arithmetic-progression-solution.md

### energy-experience-independence [IN] OBSERVATION
The minimum training hours solution decomposes into two independent subproblems — energy (single sum check) and experience (sequential simulation) — and sums their training costs.
- Source: entries/2026/06/07/minimum-hours-of-training-to-win-a-competition-solution.md

### engineering-debt-permanently-frozen [IN] DERIVED
Engineering inconsistencies (naming drift, dual test conventions, style divergence) are permanently frozen because the submission-optimized architecture provides no feedback signal for engineering quality — the quality inversion is a stable equilibrium that can only be broken if naming drift causes observable runtime failures, creating a feedback channel that the current architecture lacks.
- Depends on: inconsistency-is-invisible-because-submission-optimized, algorithmic-precision-despite-engineering-neglect
- Unless: misnamed-module-exports-in-test-harness

### enumerate-and-filter-over-generate [IN] OBSERVATION
The finding-3-digit-even-numbers solution iterates the answer space (450 even 3-digit numbers) rather than generating permutations from input, avoiding combinatorial explosion and deduplication.
- Source: entries/2026/06/06/finding-3-digit-even-numbers-solution.md

### eof-detected-by-short-read [IN] OBSERVATION
In the read4 solution, EOF is detected solely by `read4` returning fewer than 4 characters; there is no separate EOF flag or sentinel.
- Source: entries/2026/06/06/read-n-characters-given-read4-solution.md

### epoch-projection-date-comparison [IN] OBSERVATION
`daysBetweenDates` projects both dates onto an absolute day count from a fixed epoch, reducing date comparison to integer subtraction — a standard technique that avoids case-splitting on month lengths and year boundaries
- Source: entries/2026/06/06/number-of-days-between-two-dates-solution.md

### equilibrium-is-absorbing-state [IN] DERIVED
The system occupies an absorbing state of its quality dynamics: orthogonal stabilization confines defects to their origin dimension (no cross-dimensional migration), while the fully characterized static equilibrium prevents any force from displacing the system along any dimension, jointly guaranteeing that no trajectory — neither improvement nor degradation — leads out of the current quality profile.
- Source type: derived
- Depends on: system-fully-characterized-as-static-equilibrium, defect-confinement-from-orthogonal-stabilization

### evaltree-and-is-fallthrough-default [IN] OBSERVATION
`evalTree` checks `val == 2` for OR and falls through to AND for any other value — there is no explicit `val == 3` check, so any non-2 internal node val is silently treated as AND.
- Source: entries/2026/06/06/evaluate-boolean-binary-tree-solution.md

### evaltree-leaf-detection-left-only [IN] OBSERVATION
`evalTree` detects leaf nodes by checking only `root.left is None`, never checking `root.right` — this is correct only under the full binary tree invariant where every non-leaf has exactly two children.
- Source: entries/2026/06/06/evaluate-boolean-binary-tree-solution.md

### evaltree-no-short-circuit-benefit [IN] OBSERVATION
`evalTree` evaluates both subtrees via recursive calls before applying OR/AND, so Python's short-circuit operators provide no performance benefit — both branches are always fully traversed.
- Source: entries/2026/06/06/evaluate-boolean-binary-tree-solution.md

### even-case-uses-two-chars [IN] OBSERVATION
When n is even, the output contains exactly two distinct characters with counts (n-1, 1), both odd
- Source: entries/2026/06/06/generate-a-string-with-characters-that-have-odd-counts-solution.md

### exact-consumption-invariant [IN] OBSERVATION
`validWordAbbreviation` returns `True` only when both pointers `i` and `j` reach exactly the end of `word` and `abbr` respectively; partial consumption of either string is always `False`.
- Source: entries/2026/06/06/valid-word-abbreviation-solution.md

### exactness-over-performance-at-every-layer [IN] DERIVED
Solutions systematically choose exact representations — integer arithmetic over floating-point, string-based digit extraction over modular arithmetic, isqrt over sqrt — prioritizing correctness guarantees over micro-optimization at every computational layer.
- Depends on: integer-arithmetic-avoids-float-precision, string-over-arithmetic-for-digit-ops

### excel-column-bijective-base-26 [IN] OBSERVATION
Excel column numbering is bijective base-26 (digits 1–26, no zero), not standard base-26 — this is why `convert_to_title` needs `columnNumber -= 1` each iteration and why `title_to_number` uses `ord(c) - ord('A') + 1`.
- Source: entries/2026/06/06/excel-sheet-column-number-solution.md

### excel-column-horner-method [IN] OBSERVATION
`title_to_number` evaluates the column string as a base-26 polynomial using Horner's method: process left-to-right, accumulating `result * 26 + digit_value` per character in a single O(n) pass.
- Source: entries/2026/06/06/excel-sheet-column-number-solution.md

### excel-column-title-lsb-first-then-reverse [IN] OBSERVATION
`convert_to_title` builds the output string least-significant-digit-first (appending to a list), then reverses at the end — this avoids O(n²) cost from repeated string prepend.
- Source: entries/2026/06/06/excel-sheet-column-title-solution.md

### exhausted-iterator-returns-space [IN] OBSERVATION
When the compressed string is fully consumed, `StringIterator.next()` returns `' '` (space) indefinitely, matching the LeetCode spec's sentinel value.
- Source: entries/2026/06/06/design-compressed-string-iterator-solution.md

### experience-requires-simulation [IN] OBSERVATION
Unlike energy (which reduces to `max(0, sum(energy) + 1 - initialEnergy)`), experience must be simulated sequentially because wins compound the player's running experience total.
- Source: entries/2026/06/07/minimum-hours-of-training-to-win-a-competition-solution.md

### extend-or-reset-canonical-consecutive-pattern [IN] DERIVED
The single-pass "extend current run or reset counter" idiom is the canonical approach for all consecutive-element problems, with in-loop max updates eliminating post-loop fixup.
- Depends on: extend-or-reset-pattern, maxpower-eager-max-update, no-post-loop-fixup-needed

### extend-or-reset-pattern [IN] OBSERVATION
Multiple solutions (`findLengthOfLCIS`, `checkZeroOnes`) use the same single-pass "extend or reset" pattern: maintain a running counter for the current window, extend when the condition holds, reset when it doesn't
- Source: entries/2026/06/06/longest-continuous-increasing-subsequence-solution.md

### fair-candy-swap-delta-formula [IN] OBSERVATION
The swap requirement `a - b = (sumA - sumB) / 2` reduces a two-variable search to a one-variable lookup; integer division is safe because the difference is always even when a valid swap exists.
- Source: entries/2026/06/06/fair-candy-swap-solution.md

### fair-candy-swap-set-complement-search [IN] OBSERVATION
Fair Candy Swap uses the same set-based complement search pattern as Two Sum: build a hash set from one collection, then scan the other checking for computed complements — O(n+m) time, O(m) space.
- Source: entries/2026/06/06/fair-candy-swap-solution.md

### fallback-removes-last-occurrence [IN] OBSERVATION
When no greedy opportunity exists (every occurrence of `digit` is followed by an equal-or-smaller digit or is terminal), the algorithm removes the rightmost occurrence to preserve the most significant larger digits.
- Source: entries/2026/06/06/remove-digit-from-number-to-maximize-result-solution.md

### fancy-string-lookback-two [IN] OBSERVATION
The make-fancy-string skip decision depends only on the last two characters of the result list, making it a fixed-window greedy algorithm with O(n) time.
- Source: entries/2026/06/06/delete-characters-to-make-fancy-string-solution.md

### fast-null-guard-sufficient-for-both-pointers [IN] OBSERVATION
The `while fast and fast.next` guard in `hasCycle` is sufficient for both pointers because `slow` never advances past `fast` in a non-cyclic list.
- Source: entries/2026/06/06/linked-list-cycle-solution.md

### faulty-sensor-indeterminate-when-suffix-trivial [IN] OBSERVATION
When the first mismatch is at or beyond index `n-1`, `badSensor` returns `-1` because both shift hypotheses are vacuously satisfiable on the empty/trivial suffix.
- Source: entries/2026/06/06/faulty-sensor-solution.md

### faulty-sensor-mutual-exclusion-decides [IN] OBSERVATION
`badSensor` returns a definitive answer (1 or 2) only when exactly one shift hypothesis matches; if both or neither hold, it returns `-1`.
- Source: entries/2026/06/06/faulty-sensor-solution.md

### faulty-sensor-slice-comparison-is-o-n [IN] OBSERVATION
The two slice equality checks in `badSensor` each copy and compare up to `n` elements, making the algorithm O(n) time and O(n) space.
- Source: entries/2026/06/06/faulty-sensor-solution.md

### fill-cups-closed-form [IN] OBSERVATION
`min_seconds` computes the answer as `max(max(amount), ceil(sum(amount)/2))` in O(1) time rather than simulating the greedy filling process, because both lower bounds are provably achievable.
- Source: entries/2026/06/06/minimum-amount-of-time-to-fill-cups-solution.md

### final-min-required [IN] OBSERVATION
The `result += min(prev, curr)` after the loop in `count_binary_substrings` is load-bearing — removing it undercounts by the contribution of the last two character groups.
- Source: entries/2026/06/06/count-binary-substrings-solution.md

### final-prices-monotone-stack-linear-time [IN] OBSERVATION
`finalPrices` achieves O(n) time via a monotone stack where each index is pushed and popped at most once.
- Source: entries/2026/06/06/final-prices-with-a-special-discount-in-a-shop-solution.md

### final-prices-no-input-mutation [IN] OBSERVATION
`finalPrices` copies the input list before modifying it, so the caller's original list is never changed.
- Source: entries/2026/06/06/final-prices-with-a-special-discount-in-a-shop-solution.md

### final-prices-stack-holds-unresolved-indices [IN] OBSERVATION
During iteration, the monotone stack contains indices of items that have not yet found a discount — items still waiting for a `prices[j] <= prices[i]` with `j > i`.
- Source: entries/2026/06/06/final-prices-with-a-special-discount-in-a-shop-solution.md

### final-prices-uses-geq-not-gt [IN] OBSERVATION
The stack pops on `>=` (not `>`), meaning equal prices qualify as discounts — matching the problem's "less than or equal" condition.
- Source: entries/2026/06/06/final-prices-with-a-special-discount-in-a-shop-solution.md

### find-center-minimum-two-edges [IN] OBSERVATION
`find_center` unconditionally indexes `edges[0]` and `edges[1]`, requiring at least two edges (3+ nodes); fewer edges raises `IndexError`.
- Source: entries/2026/06/06/find-center-of-star-graph-solution.md

### find-difference-output-always-two-lists [IN] OBSERVATION
`findDifference` always returns a list of exactly two sub-lists, each containing only distinct values, regardless of input duplicates or overlap.
- Source: entries/2026/06/06/find-the-difference-of-two-arrays-solution.md

### find-difference-output-order-undefined [IN] OBSERVATION
The order of elements within each output sub-list of `findDifference` is not deterministic — it follows set iteration order.
- Source: entries/2026/06/06/find-the-difference-of-two-arrays-solution.md

### find-difference-set-minus-idiom [IN] OBSERVATION
`findDifference` uses Python's set `-` operator for symmetric difference — converts both inputs to sets, then computes `set1 - set2` and `set2 - set1`.
- Source: entries/2026/06/06/find-the-difference-of-two-arrays-solution.md

### find-difference-xor-no-extra-space [IN] OBSERVATION
`findTheDifference` uses O(1) auxiliary space — the generator feeding `reduce` is lazy, so no list or counter is materialized.
- Source: entries/2026/06/06/find-the-difference-solution.md

### find-k-iterates-deduplicated-set [IN] OBSERVATION
`find_K` iterates over `num_set` (the deduplicated set) rather than the original `nums` list, avoiding redundant membership checks on duplicate values.
- Source: entries/2026/06/06/largest-positive-integer-that-exists-with-its-negative-solution.md

### find-special-integer-fallback-unreachable [IN] OBSERVATION
The `return arr[-1]` at the end of `find_special_integer` is dead code under valid input (the problem guarantees exactly one element exceeding 25%), but makes the function total.
- Source: entries/2026/06/06/element-appearing-more-than-25-in-sorted-array-solution.md

### find-special-integer-linear-scan [IN] OBSERVATION
`find_special_integer` uses an O(n) gap-check scan with O(1) space instead of counting or hashing — it exploits sorted order to avoid maintaining frequency state.
- Source: entries/2026/06/06/element-appearing-more-than-25-in-sorted-array-solution.md

### find-union-closure-encapsulation [IN] OBSERVATION
The Union-Find implementation defines `find` and `union` as closures over `parent` and `rank` arrays rather than using a class, keeping state local to a single invocation.
- Source: entries/2026/06/06/find-if-path-exists-in-graph-solution.md

### finding-3digit-constant-candidate-space [IN] OBSERVATION
The algorithm examines exactly 450 candidate numbers regardless of input size, making runtime O(1) in the length of `digits`.
- Source: entries/2026/06/06/finding-3-digit-even-numbers-solution.md

### finding-3digit-multiplicity-enforced [IN] OBSERVATION
The `Counter` comparison `freq[d] >= needed[d]` ensures each digit is used at most as many times as it appears in the input array.
- Source: entries/2026/06/06/finding-3-digit-even-numbers-solution.md

### finding-3digit-output-sorted-by-construction [IN] OBSERVATION
The output list is sorted without an explicit sort call, guaranteed by ascending iteration over `range(100, 999, 2)`.
- Source: entries/2026/06/06/finding-3-digit-even-numbers-solution.md

### findmode-mode-replacement-strategy [IN] OBSERVATION
When `cur_count` exceeds `max_count`, the `modes` list is replaced entirely (not appended to), ensuring only values matching the true maximum frequency survive.
- Source: entries/2026/06/06/find-mode-in-binary-search-tree-solution.md

### findmode-nonlocal-state-pattern [IN] OBSERVATION
`findMode` uses `nonlocal` to share four mutable variables (`modes`, `max_count`, `cur_count`, `prev`) between the outer function and the `inorder` closure, avoiding parameter threading.
- Source: entries/2026/06/06/find-mode-in-binary-search-tree-solution.md

### findmode-requires-valid-bst [IN] OBSERVATION
The mode-finding algorithm produces incorrect results on non-BST trees because it relies on in-order traversal yielding sorted values to group equal elements consecutively.
- Source: entries/2026/06/06/find-mode-in-binary-search-tree-solution.md

### findmode-single-pass-no-hashmap [IN] OBSERVATION
`findMode` computes all BST modes in a single in-order traversal using run-length counting on the sorted sequence — no hash map or second pass required.
- Source: entries/2026/06/06/find-mode-in-binary-search-tree-solution.md

### findtilt-single-pass-postorder [IN] OBSERVATION
`findTilt` computes total tilt in a single O(n) postorder traversal by having `subtree_sum` return the value sum upward while accumulating tilt into a `nonlocal` closure variable as a side effect.
- Source: entries/2026/06/06/binary-tree-tilt-solution.md

### first-bad-version-assumes-monotonic-input [IN] OBSERVATION
The solution produces correct results only if the predicate is monotonic (all good versions precede all bad versions); non-monotonic input causes undefined behavior, not an error.
- Source: entries/2026/06/06/first-bad-version-solution.md

### first-bad-version-injectable-predicate [IN] OBSERVATION
The `isBadVersion` predicate is passed as a parameter rather than inherited from a base class, decoupling the solution from LeetCode's `VersionControl` convention and enabling direct unit testing.
- Source: entries/2026/06/06/first-bad-version-solution.md

### first-bad-version-left-equals-right-at-exit [IN] OBSERVATION
The binary search loop exits exactly when `left == right`, so the return value is deterministic regardless of which variable is returned.
- Source: entries/2026/06/06/first-bad-version-solution.md

### first-bad-version-log-n-api-calls [IN] OBSERVATION
`first_bad_version` makes at most `ceil(log2(n))` calls to `isBadVersion`, the minimum possible for a comparison-based search.
- Source: entries/2026/06/06/first-bad-version-solution.md

### first-match-is-minimum-in-sorted-scan [IN] OBSERVATION
In the two-pointer scan of two sorted arrays, the first equality found is necessarily the smallest common value because both pointers start at index 0 and only advance forward.
- Source: entries/2026/06/06/minimum-common-value-solution.md

### first-occurrence-hashmap-pattern [IN] OBSERVATION
The first-occurrence hash map (record earliest index per key, compute distance on later hits) is a recurring O(n) pattern across the repo, used in largest-substring-between-two-equal-characters, contains-duplicate-ii, check-distances-between-same-letters, and degree-of-an-array.
- Source: entries/2026/06/06/largest-substring-between-two-equal-characters-solution.md

### first-palindrome-returns-empty-string-on-no-match [IN] OBSERVATION
`firstPalindrome` returns `""` (not `None`) when no palindromic string exists, and handles an empty input list correctly by falling through the loop.
- Source: entries/2026/06/06/find-first-palindromic-string-in-the-array-solution.md

### first-palindrome-short-circuits [IN] OBSERVATION
`firstPalindrome` returns immediately on the first palindrome found rather than scanning the entire list.
- Source: entries/2026/06/06/find-first-palindromic-string-in-the-array-solution.md

### first-seen-never-overwritten [IN] OBSERVATION
In `maxLengthBetweenEqualCharacters`, `first_seen[c]` is written exactly once per distinct character; subsequent occurrences take the `if` branch and compute the gap without updating the stored index.
- Source: entries/2026/06/06/largest-substring-between-two-equal-characters-solution.md

### first-unique-char-two-pass-frequency [IN] OBSERVATION
The first-unique-character solution uses a two-pass approach: pass 1 builds a complete `Counter` over the entire string, pass 2 scans in original order to find the first character with count exactly 1.
- Source: entries/2026/06/06/first-unique-character-in-a-string-solution.md

### first-violation-sufficiency [IN] OBSERVATION
`canBeIncreasing` only examines the first violation of strict monotonicity because any valid single removal must resolve it; if neither of the two candidate removals at that point fixes the array, no single removal anywhere can.
- Source: entries/2026/06/06/remove-one-element-to-make-the-array-strictly-increasing-solution.md

### fixed-point-correctness-requires-distinct-values [IN] OBSERVATION
The fixed-point pruning logic depends on `arr[j] - j` being strictly increasing; duplicate values break this monotonicity invariant and could cause the algorithm to miss valid fixed points.
- Source: entries/2026/06/06/fixed-point-solution.md

### fixed-point-single-branch-collapse [IN] OBSERVATION
The `arr[mid] > mid` and `arr[mid] == mid` cases share the same search direction (left), collapsed into a single `arr[mid] >= mid` branch that differs only in whether `result` is updated.
- Source: entries/2026/06/06/fixed-point-solution.md

### fixed-point-uses-leftmost-binary-search [IN] OBSERVATION
The fixed-point algorithm always continues searching left after finding a match (`hi = mid - 1` with `result` update), guaranteeing the smallest fixed point is returned rather than an arbitrary one.
- Source: entries/2026/06/06/fixed-point-solution.md

### fixed-range-assumption [IN] OBSERVATION
`maxAliveYear` hardcodes the year range [1950, 2050] as a 101-element delta array; inputs outside this range raise `IndexError`.
- Source: entries/2026/06/06/maximum-population-year-solution.md

### fizzbuzz-1-indexed [IN] OBSERVATION
FizzBuzz output is 1-indexed: `result[0]` corresponds to integer 1 and `result[n-1]` to integer `n`, enforced by `range(1, n + 1)`.
- Source: entries/2026/06/06/fizz-buzz-solution.md

### fizzbuzz-check-order [IN] OBSERVATION
The `% 15` divisibility check must precede `% 3` and `% 5` checks in fizz-buzz; reordering produces incorrect output for multiples of 15.
- Source: entries/2026/06/06/fizz-buzz-solution.md

### fizzbuzz-output-length [IN] OBSERVATION
`fizzBuzz(n)` always returns a list of exactly `n` elements for any `n >= 1`; for `n <= 0` it returns an empty list.
- Source: entries/2026/06/06/fizz-buzz-solution.md

### flip-game-length-invariant [IN] OBSERVATION
Every string returned by `generate_possible_next_moves` has the same length as the input string, since `"--"` replaces exactly two characters.
- Source: entries/2026/06/06/flip-game-solution.md

### flip-game-no-mutation [IN] OBSERVATION
`generate_possible_next_moves` never modifies the input `currentState`; all results are independent string copies built via slicing.
- Source: entries/2026/06/06/flip-game-solution.md

### flip-game-output-ordering [IN] OBSERVATION
`generate_possible_next_moves` returns results ordered by the position of the flipped `++` pair, ascending left to right, as a natural consequence of the sequential scan.
- Source: entries/2026/06/06/flip-game-solution.md

### flip-game-quadratic-worst-case [IN] OBSERVATION
`generate_possible_next_moves` is O(n) in comparisons but O(n^2) worst-case overall due to O(n) string copying per match.
- Source: entries/2026/06/06/flip-game-solution.md

### flipping-image-in-place [IN] OBSERVATION
`flipAndInvertImage` mutates and returns the same `image` object with O(1) extra space; it allocates no new lists.
- Source: entries/2026/06/06/flipping-an-image-solution.md

### flood-fill-color-as-visited [IN] OBSERVATION
Flood fill uses the color mutation itself as the visited marker instead of maintaining an explicit `visited` set — once a pixel is recolored, it no longer matches `original` and won't be revisited.
- Source: entries/2026/06/06/flood-fill-solution.md

### flood-fill-color-guard-termination [IN] OBSERVATION
The `original == color` early return in `floodFill` is necessary to prevent infinite recursion; without it, coloring a pixel to the same value it already has would never distinguish visited from unvisited neighbors.
- Source: entries/2026/06/06/flood-fill-solution.md

### flood-fill-four-directional [IN] OBSERVATION
Flood fill connectivity is 4-directional (up/down/left/right); diagonal pixels are never considered neighbors.
- Source: entries/2026/06/06/flood-fill-solution.md

### flood-fill-linear-time [IN] OBSERVATION
Each pixel is visited at most once in flood fill, giving O(m*n) time and O(m*n) worst-case stack depth for pathological grid shapes like spirals.
- Source: entries/2026/06/06/flood-fill-solution.md

### floor-division-semantics [IN] OBSERVATION
The average-even-divisible-by-three solution uses Python's `//` operator for the floor division required by the problem spec; this is correct because both `total` and `count` are non-negative.
- Source: entries/2026/06/06/average-value-of-even-numbers-that-are-divisible-by-three-solution.md

### floyd-cycle-detection-o1-space [IN] OBSERVATION
`hasCycle` uses Floyd's tortoise-and-hare algorithm with O(1) auxiliary space — only two pointer variables, no visited set.
- Source: entries/2026/06/06/linked-list-cycle-solution.md

### flush-beats-all [IN] OBSERVATION
In `best_poker_hand`, flush is checked before rank-based hands via early return, giving it top priority in the classification cascade.
- Source: entries/2026/06/06/best-poker-hand-solution.md

### following-key-no-terminal-guard [IN] OBSERVATION
`most_frequent_number_following_key_in_an_array` raises `IndexError` if `key` only appears at the terminal position — the `range(len-1)` bound correctly skips it, but if no earlier occurrence exists the `Counter` is empty and `most_common(1)[0][0]` fails.
- Source: entries/2026/06/06/most-frequent-number-following-key-in-an-array-solution.md

### format-range-single-vs-arrow [IN] OBSERVATION
`_format_range(a, b)` returns `"a"` when endpoints are equal and `"a->b"` otherwise; it is only ever called with `a <= b`, guaranteed by the gap-detection guards.
- Source: entries/2026/06/06/missing-ranges-solution.md

### four-rotations-are-exhaustive [IN] OBSERVATION
Checking 0°, 90°, 180°, 270° covers all distinct rotations of a square matrix because the rotation group is cyclic of order 4 (Z₄); 360° ≡ 0° so no further checks are needed.
- Source: entries/2026/06/06/determine-whether-matrix-can-be-obtained-by-rotation-solution.md

### frequency-map-pair-counting-avoids-quadratic [IN] OBSERVATION
Pair-counting solutions (e.g., absolute-difference-k) use `Counter` to reduce O(n^2) index enumeration to O(n) frequency multiplication — checking only `v + k` (not `v - k`) to prevent double-counting.
- Source: entries/2026/06/06/count-number-of-pairs-with-absolute-difference-k-solution.md

### frequency-ratio-bottleneck-pattern [IN] OBSERVATION
"How many X can I build from Y" problems use the pattern: count supply and demand per character, take `min(supply // demand)` across all required characters. Used by `rearrange-characters-to-make-target-string` and `maximum-number-of-balloons`.
- Source: entries/2026/06/06/rearrange-characters-to-make-target-string-solution.md

### frequency-sort-uses-composite-tuple-key [IN] OBSERVATION
The sort key `(freq[x], -x)` encodes both criteria in a single tuple, relying on Python's lexicographic tuple comparison rather than chaining separate sorts.
- Source: entries/2026/06/06/sort-array-by-increasing-frequency-solution.md

### frozenset-as-grouping-key [IN] OBSERVATION
`frozenset(word)` is used as a hashable dictionary/Counter key to group strings by their distinct character sets, enabling O(n) grouping instead of O(n^2) pairwise comparison for set-equality predicates.
- Source: entries/2026/06/06/count-pairs-of-similar-strings-solution.md

### function-misnaming-is-systematic [IN] OBSERVATION
At least two solutions (`sort_array` in chips problem, `max_difference` alias in candies problem) have names unrelated to their purpose, suggesting the repo's code generation or scaffolding pipeline systematically produces misnamed functions.
- Source: entries/2026/06/06/minimum-cost-to-move-chips-to-the-same-position-solution.md

### function-name-mismatch-min-operations-sum [IN] OBSERVATION
In the digit-splitting solution, the function is named `min_operations` (likely from a LeetCode template) but computes a minimum *sum*, not a count of operations.
- Source: entries/2026/06/06/minimum-sum-of-four-digit-number-after-splitting-digits-solution.md

### function-name-mismatches-are-systematic [IN] OBSERVATION
Solutions sometimes have function names unrelated to the problem they solve (e.g., `max_tasks` for "count even digit sum", `balanced_string` for "count negatives in matrix") — this is a recurring artifact of the code generation pipeline, not a one-off typo.
- Source: entries/2026/06/06/count-integers-with-even-digit-sum-solution.md, entries/2026/06/06/count-negative-numbers-in-a-sorted-matrix-solution.md

### function-name-mismatches-exist [IN] OBSERVATION
Some solutions have function names that don't match the LeetCode problem's expected method name (e.g., `canDistribute` instead of `minOperations`), likely from copy-paste during problem setup.
- Source: entries/2026/06/06/minimum-changes-to-make-alternating-binary-string-solution.md

### fused-reverse-invert [IN] OBSERVATION
`flipAndInvertImage` performs horizontal flip and bit inversion in a single two-pointer pass per row via simultaneous swap-and-XOR, not two separate passes.
- Source: entries/2026/06/06/flipping-an-image-solution.md

### gap-formula-excludes-endpoints [IN] OBSERVATION
The expression `i - first_seen[c] - 1` counts characters strictly between positions `first_seen[c]` and `i`, excluding both boundary characters.
- Source: entries/2026/06/06/largest-substring-between-two-equal-characters-solution.md

### gauss-sum-for-range-problems [IN] OBSERVATION
The closed-form sum `n*(n+1)//2` is a recurring idiom across this repo for problems involving missing or duplicate numbers in a 1-to-n range, avoiding a second pass to compute the expected sum.
- Source: entries/2026/06/06/set-mismatch-solution.md

### gcd-determines-valid-partition [IN] OBSERVATION
A deck of cards can be partitioned into equal-sized groups of matching values if and only if the GCD of all value frequencies is >= 2 — the solution computes this in a single `reduce(gcd, counts)` fold.
- Source: entries/2026/06/06/x-of-a-kind-in-a-deck-of-cards-solution.md

### gcd-of-extremes-not-pairwise [IN] OBSERVATION
`findGCD` computes `gcd(min(nums), max(nums))` — the GCD of only the smallest and largest elements, not a pairwise reduction across all elements.
- Source: entries/2026/06/06/find-greatest-common-divisor-of-array-solution.md

### gcd-reduces-common-factor-counting [IN] OBSERVATION
`common_factors(a, b)` converts the two-variable problem into divisor-counting on `gcd(a, b)`, since the set of common factors of (a, b) equals the set of divisors of gcd(a, b)
- Source: entries/2026/06/06/number-of-common-factors-solution.md

### gcd-strings-commutativity-check [IN] OBSERVATION
`str1 + str2 == str2 + str1` is both necessary and sufficient for the existence of a common divisor string — this is the key mathematical insight (related to the Fine and Wilf theorem)
- Source: entries/2026/06/06/greatest-common-divisor-of-strings-solution.md

### gcd-strings-length-determines-answer [IN] OBSERVATION
When a common divisor exists, its length equals `gcd(len(str1), len(str2))` and the answer is simply `str1[:that_length]`
- Source: entries/2026/06/06/greatest-common-divisor-of-strings-solution.md

### generated-array-n0-guard-required [IN] OBSERVATION
The `n == 0` early return is necessary; without it, `nums[1] = 1` raises IndexError on a length-1 list
- Source: entries/2026/06/06/get-maximum-in-generated-array-solution.md

### generated-array-recurrence-correctness [IN] OBSERVATION
For odd index `i >= 3`, `nums[i // 2 + 1]` is always in bounds because `i // 2 + 1 <= i` and the array has length `n + 1`
- Source: entries/2026/06/06/get-maximum-in-generated-array-solution.md

### generated-array-single-pass-dp [IN] OBSERVATION
The solution computes all values in one forward pass because every dependency index (`i // 2`, `i // 2 + 1`) is strictly less than the current index for `i >= 2`
- Source: entries/2026/06/06/get-maximum-in-generated-array-solution.md

### generation-errors-amplified-by-isolation [IN] DERIVED
The automated generation pipeline introduces systematic naming errors (mismatched function names, stale aliases), and the per-problem isolation architecture ensures these errors are never detected or corrected — the pipeline creates defects and the architecture hides them, forming a defect-accumulation cycle with no corrective feedback loop.
- Depends on: generation-pipeline-is-naming-error-root-cause, isolation-creates-undetectable-inconsistency

### generation-errors-remain-invisible [IN] DERIVED
Naming errors introduced by the automated generation pipeline remain invisible at runtime because the submission-optimized architecture isolates each solution — but this containment depends on the test harness correctly routing to the intended function despite the naming drift.
- Depends on: generation-pipeline-is-naming-error-root-cause, inconsistency-is-invisible-because-submission-optimized
- Unless: misnamed-module-exports-in-test-harness

### generation-pipeline-is-naming-error-root-cause [IN] DERIVED
The automated code generation pipeline is the root cause of systematic naming errors across the repo — it produces both misnamed functions (names carried from unrelated problems via copy-paste templates) and vestigial aliases (dead references from prior solution scaffolding), creating a class of defects that is structurally different from manual typos because it affects function identity rather than spelling.
- Depends on: pipeline-generates-misnamed-functions, stale-aliases-from-generation-pipeline

### generator-boolean-counting-pattern [IN] OBSERVATION
The repo uses `sum(predicate(x) for x in iterable)` as an idiom for counting matches, exploiting Python's `True == 1` / `False == 0` arithmetic to avoid materializing a filtered list.
- Source: entries/2026/06/06/determine-if-string-halves-are-alike-solution.md

### generator-inside-min-pattern [IN] OBSERVATION
Multiple solutions use generator expressions (lazy, O(1) auxiliary space) inside `min()` rather than list comprehensions — a recurring idiom across the repo for single-pass optimization problems.
- Source: entries/2026/06/06/minimum-difference-between-highest-and-lowest-of-k-scores-solution.md, entries/2026/06/06/minimum-distance-to-the-target-element-solution.md

### generator-over-list-for-aggregation [IN] OBSERVATION
`maximumWealth` uses `max(sum(row) for row in accounts)` with a generator expression (not a list comprehension), achieving O(1) auxiliary space by avoiding materialization of intermediate results.
- Source: entries/2026/06/06/richest-customer-wealth-solution.md

### generator-sum-counting-idiom [IN] OBSERVATION
Multiple solutions use `sum(1 for ... if ...)` or `sum(... for ...)` as the standard idiom for counting matches — O(1) auxiliary space, no intermediate list allocation.
- Source: entries/2026/06/06/number-of-students-doing-homework-at-a-given-time-solution.md

### generator-sum-counting-pattern [IN] OBSERVATION
Solutions use `sum(1 for x in seq if cond)` as the standard counting idiom rather than `len([...])` or manual accumulators — avoids intermediate list allocation.
- Source: entries/2026/06/06/count-integers-with-even-digit-sum-solution.md, entries/2026/06/06/count-items-matching-a-rule-solution.md

### getheight-sentinel-neg1 [IN] OBSERVATION
`getHeight` in balanced-binary-tree returns exactly `-1` as a sentinel for any unbalanced subtree and never any other negative value; non-negative returns represent actual heights.
- Source: entries/2026/06/06/balanced-binary-tree-solution.md

### getlucky-convergence-by-k3 [IN] OBSERVATION
For valid inputs (up to 1000 lowercase letters), `getLucky` stabilizes to a single digit by the third transform at most, making k > 3 effectively a no-op.
- Source: entries/2026/06/06/sum-of-digits-of-string-after-convert-solution.md

### getlucky-first-sum-on-string [IN] OBSERVATION
`getLucky` computes the first digit-sum directly from the concatenated numeric string, avoiding conversion to a potentially thousands-of-digits integer; subsequent sums operate on small integers.
- Source: entries/2026/06/06/sum-of-digits-of-string-after-convert-solution.md

### getlucky-k-minus-one-loop [IN] OBSERVATION
The transform loop in `getLucky` runs `k - 1` iterations because the initial sum on `num_str` counts as the first of `k` total transforms.
- Source: entries/2026/06/06/sum-of-digits-of-string-after-convert-solution.md

### goal-parser-num-ways-misnomer [IN] OBSERVATION
`num_ways` is named incorrectly; it returns a transformed string, not a count — the name likely comes from copy-paste from another problem template
- Source: entries/2026/06/06/goal-parser-interpretation-solution.md

### goal-parser-replace-order-safe [IN] OBSERVATION
The two `str.replace()` calls are order-independent because `"()"` and `"(al)"` are non-overlapping substrings in any valid Goal Parser input
- Source: entries/2026/06/06/goal-parser-interpretation-solution.md

### goat-latin-assumes-nonempty-words [IN] OBSERVATION
The function accesses `word[0]` without a length check, relying on the LeetCode guarantee that the input contains no empty tokens from splitting
- Source: entries/2026/06/06/goat-latin-solution.md

### goat-latin-consonant-rotation-preserves-case [IN] OBSERVATION
When moving a consonant to the end of a word, the original casing of that character is preserved — no `.lower()` or `.upper()` is applied
- Source: entries/2026/06/06/goat-latin-solution.md

### goat-latin-index-is-1-based [IN] OBSERVATION
`enumerate(sentence.split(), 1)` produces 1-based indices, meaning the first word gets exactly one trailing `"a"` — an off-by-one here would silently produce wrong answers
- Source: entries/2026/06/06/goat-latin-solution.md

### goat-latin-vowel-check-is-case-insensitive [IN] OBSERVATION
The vowel set includes both upper and lowercase variants (`"aeiouAEIOU"`), so the first-character check works regardless of word casing
- Source: entries/2026/06/06/goat-latin-solution.md

### good-triplets-empty-range-handles-small-arrays [IN] OBSERVATION
When `len(arr) < 3`, `range(n - 2)` produces an empty range, so `countGoodTriplets` returns 0 without error — no special-casing needed.
- Source: entries/2026/06/06/count-good-triplets-solution.md

### good-triplets-pruning-order-skips-innermost-loop [IN] OBSERVATION
The `a`-constraint is checked between the second and third loops: a failed `(i, j)` pair skips all `k` iterations, while `b` and `c` constraints are only checked in the innermost loop.
- Source: entries/2026/06/06/count-good-triplets-solution.md

### graph-path-exists-batch-no-early-exit [IN] OBSERVATION
All edges are processed via `union` before the single `find(source) == find(destination)` query — the algorithm does not short-circuit if source and destination merge mid-loop.
- Source: entries/2026/06/06/find-if-path-exists-in-graph-solution.md

### greedy-algorithms-provably-optimal [IN] DERIVED
Greedy strategies across the repo are accompanied by explicit correctness arguments — prefix-free code uniqueness, leftmost-digit positional weight, exchange arguments — not treated as heuristics.
- Depends on: greedy-scan-correct-for-prefix-free-codes, can-place-flowers-greedy-is-optimal, max-sum-greedy-correctness, max69-greedy-leftmost, min-time-typewriter-greedy-optimal

### greedy-consecutive-triples-sufficiency [IN] OBSERVATION
After sorting descending, only consecutive triples need checking for the largest-perimeter-triangle problem; non-adjacent triples can never produce a larger valid perimeter than the first valid consecutive triple.
- Source: entries/2026/06/06/largest-perimeter-triangle-solution.md

### greedy-early-exit-correctness [IN] OBSERVATION
In `max_number_after_remove_digit`, removing the first occurrence of `digit` that is immediately followed by a strictly larger digit always yields the lexicographically maximum result.
- Source: entries/2026/06/06/remove-digit-from-number-to-maximize-result-solution.md

### greedy-flip-negatives-first [IN] OBSERVATION
The k-negations algorithm sorts to place negatives first and greedily flips them; this is optimal because flipping a negative yields +2|x| gain versus flipping a positive which yields -2|x| loss.
- Source: entries/2026/06/06/maximize-sum-of-array-after-k-negations-solution.md

### greedy-output-stack-pattern [IN] OBSERVATION
Multiple solutions use a "greedy output stack" pattern — building output character-by-character, appending or skipping based on a bounded lookback window into the result so far (e.g., fancy-string checks last 2, decrypt-string peeks ahead 2).
- Source: entries/2026/06/06/delete-characters-to-make-fancy-string-solution.md

### greedy-scan-correct-for-prefix-free-codes [IN] OBSERVATION
The greedy left-to-right scan in the 1-bit/2-bit characters problem produces the unique valid decoding because `{0, 10, 11}` is a prefix-free code — no backtracking or DP is needed.
- Source: entries/2026/06/06/1-bit-and-2-bit-characters-solution.md

### greedy-single-fork-for-one-deletion [IN] OBSERVATION
Valid Palindrome II handles the "at most one deletion" constraint by forking exactly once on the first mismatch (try skipping left or right), with no backtracking, keeping total work at O(n).
- Source: entries/2026/06/06/valid-palindrome-ii-solution.md

### greedy-single-pass-virtual-state-pattern [IN] OBSERVATION
`min_operations` (array increasing) tracks a virtual `prev` value instead of mutating the input array, keeping the function pure while achieving O(n) time and O(1) space.
- Source: entries/2026/06/06/minimum-operations-to-make-the-array-increasing-solution.md

### greedy-skip-optimality [IN] OBSERVATION
Skipping 3 positions on each `'X'` produces the minimum move count because covering the leftmost uncovered `'X'` first maximizes coverage reach and never wastes a move.
- Source: entries/2026/06/06/minimum-moves-to-convert-string-solution.md

### greedy-sort-descending-skip-every-third [IN] OBSERVATION
`minimumCost` sorts candy prices descending and sums elements where `i % 3 != 2`, skipping every third element as the free candy — the canonical greedy for "buy 2 get 1 free" minimization.
- Source: entries/2026/06/06/minimum-cost-of-buying-candies-with-discount-solution.md

### greedy-sort-mutates-input [IN] OBSERVATION
`maximum-units-on-a-truck/solution.py` uses `boxTypes.sort()` which mutates the caller's list in-place rather than using `sorted()` for a non-destructive copy.
- Source: entries/2026/06/06/maximum-units-on-a-truck-solution.md

### greedy-sort-then-scan-pattern [IN] OBSERVATION
Multiple solutions (array-partition, assign-cookies) share the same structural pattern: sort the input, then make a single linear pass to extract the answer — a recurring idiom for greedy problems in this repo.
- Source: entries/2026/06/06/array-partition-solution.md, entries/2026/06/06/assign-cookies-solution.md

### greedy-stack-extends-streaming-to-output-construction [IN] DERIVED
The greedy output stack extends single-pass streaming from scalar accumulation to structured output construction: the stack serves as a bounded accumulator enabling per-element include/revise/skip decisions while maintaining output invariants — generalizing streaming's extend-or-reset pattern from scalar state to sequence-building state.
- Source type: derived
- Depends on: greedy-output-stack-pattern, single-pass-streaming-dominant-shape

### greedy-three-chars-always-sufficient [IN] OBSERVATION
When replacing `?` to avoid consecutive repeats, trying candidates from `'abc'` always yields a valid choice because a position has at most 2 neighbors and 3 candidates guarantees one is conflict-free (pigeonhole principle).
- Source: entries/2026/06/06/replace-all-s-to-avoid-consecutive-repeating-characters-solution.md

### greedy-with-post-hoc-correction [IN] OBSERVATION
The distribute-money solution computes an optimistic greedy answer then applies two corrections for constraint violations (surplus absorption and $4 avoidance), a pattern idiomatic for LeetCode distribution problems.
- Source: entries/2026/06/06/distribute-money-to-maximum-children-solution.md

### greedy-zero-crossing-optimal-for-balanced-splits [IN] OBSERVATION
Splitting at every zero-crossing of the balance counter provably maximizes the number of balanced substrings; deferring a split can never create more splits later.
- Source: entries/2026/06/06/split-a-string-in-balanced-strings-solution.md

### grid-as-strings-idiom [IN] OBSERVATION
String-grid problems in this repo index directly into strings with `strs[i][j]` rather than converting to a 2D array, avoiding allocation at the cost of assuming uniform string length.
- Source: entries/2026/06/06/delete-columns-to-make-sorted-solution.md

### group-contribution-sweep-pattern [IN] OBSERVATION
`countTriplets` uses a "left * current * right" sweep over Counter groups to count valid triplets in O(n) time, maintaining the invariant `left + c + right == len(nums)` at every iteration.
- Source: entries/2026/06/06/number-of-unequal-triplets-in-array-solution.md

### groupby-for-consecutive-runs [IN] OBSERVATION
Solutions involving consecutive identical characters (e.g., decomposable substrings) use `itertools.groupby` for run-length encoding rather than manual loop-and-counter approaches.
- Source: entries/2026/06/06/check-if-string-is-decomposable-into-value-equal-substrings-solution.md

### guard-clause-then-expression-pattern [IN] OBSERVATION
Easy-difficulty solutions follow a guard-clause-then-expression pattern: validate the input constraint up front, then return the entire transformation as a single expression.
- Source: entries/2026/06/06/convert-1d-array-into-2d-array-solution.md

### guess-api-inverted-semantics [IN] OBSERVATION
`guess()` returns `-1` when the guess is too high (not too low), which is the opposite of what a standard comparison function would return — the branching logic must account for this inversion.
- Source: entries/2026/06/06/guess-number-higher-or-lower-solution.md

### halves-alike-case-insensitive-via-prebuilt-set [IN] OBSERVATION
The halves-alike solution handles mixed-case vowel matching by storing all 10 case variants (`"aeiouAEIOU"`) in a set, avoiding a `.lower()` call on the input string.
- Source: entries/2026/06/06/determine-if-string-halves-are-alike-solution.md

### hamming-xor-popcount [IN] OBSERVATION
`hammingDistance` computes Hamming distance as popcount of XOR (`bin(x ^ y).count('1')`); any change to either the XOR or the popcount step would break correctness.
- Source: entries/2026/06/06/hamming-distance-solution.md

### happy-number-fast-starts-ahead [IN] OBSERVATION
The fast pointer is initialized one step ahead (`get_next(n)`) while slow starts at `n` — this offset is critical for Floyd's algorithm to detect cycles correctly when the starting value itself is part of a cycle.
- Source: entries/2026/06/06/happy-number-solution.md

### happy-number-floyds-o1-space [IN] OBSERVATION
`is_happy` uses Floyd's cycle detection (tortoise and hare) with O(1) space rather than a hash set, making it the same pattern used in `linked-list-cycle`.
- Source: entries/2026/06/06/happy-number-solution.md

### happy-number-get-next-fixed-point [IN] OBSERVATION
`get_next(1)` returns 1, making 1 a fixed point — this is what causes the fast pointer to stop when a happy number is found and is essential to the algorithm's termination condition.
- Source: entries/2026/06/06/happy-number-solution.md

### harmless-defect-permanence-is-equilibrium-property [IN] DERIVED
The permanence of structurally harmless defects is an equilibrium property, not a system failing: the same dual locking mechanisms that stabilize the quality profile (domain attractor + self-reinforcing incentive structure) also guarantee that frozen defects remain in their harmless state — preventing both remediation (which would require engineering investment the incentive structure discourages) and escalation (which would require cross-solution coupling the isolation architecture prevents).
- Source type: derived
- Depends on: defects-permanent-but-structurally-harmless, quality-profile-doubly-locked

### has-next-is-side-effect-free [IN] OBSERVATION
`StringIterator.hasNext()` only checks `_count > 0` and never modifies state or triggers parsing — verified by a dedicated test case.
- Source: entries/2026/06/06/design-compressed-string-iterator-solution.md

### hash-lookahead-greedy-correct [IN] OBSERVATION
In the decrypt-string solution, the 3-char token (`XX#`) is always checked before the 1-char token, which is the only correct parse order since `#` at position `i+2` unambiguously signals a double-digit encoding.
- Source: entries/2026/06/06/decrypt-string-from-alphabet-to-integer-mapping-solution.md

### hash-pipeline-algebraically-and-empirically-grounded [IN] DERIVED
The hash-then-stream pipeline's universality claim is both algebraically grounded (Counter provides a complete multiset algebra covering construction, measurement, comparison, and decomposition) and empirically validated by two complementary exemplar families (palindrome problems exercising Counter's full multiset operations, Two Sum problems spanning the lookup strategy space from hash maps through sorted arrays), making it the strongest-evidenced pipeline instantiation in the taxonomy.
- Source type: derived
- Depends on: counter-algebra-grounds-hash-pipeline-universality, hash-pipeline-demonstrated-by-dual-exemplar-families

### hash-pipeline-demonstrated-by-dual-exemplar-families [IN] DERIVED
The hash-then-stream pipeline's universal scope is demonstrated by two complementary exemplar families: palindrome problems exercise Counter's full multiset algebra for aggregate frequency-parity reduction, while Two Sum problems exercise point-lookup semantics through hash map complement queries — together covering both fundamental query modes (aggregate frequency and exact membership) of the hash preprocessing phase.
- Source type: derived
- Depends on: palindrome-instantiates-hash-then-stream, two-sum-family-spans-lookup-strategy-space

### hash-preprocessing-universal-first-step [IN] DERIVED
Hash-based data structures (Counter for frequencies, set for membership) serve as the universal O(n) preprocessing layer, with nearly every lookup-heavy or frequency-dependent problem beginning with one of these two constructions before a linear scan.
- Depends on: counter-universal-frequency-primitive, set-for-o1-membership-universal

### hash-set-dimension-reduction [IN] OBSERVATION
For triplet-constraint problems, precomputing a hash set of valid values for one dimension (e.g., perfect squares up to n^2) reduces an O(n^3) brute force to O(n^2) by replacing the innermost loop with an O(1) set membership check.
- Source: entries/2026/06/06/count-square-sum-triples-solution.md

### hash-structures-prime-bucket-sizing [IN] OBSERVATION
Both hash structure implementations use prime bucket counts (1009 for HashMap, 769 for HashSet) to reduce collision clustering under modular hashing compared to power-of-two sizes.
- Source: entries/2026/06/06/design-hashset-solution.md

### hash-structures-silent-remove [IN] OBSERVATION
Both MyHashMap.remove and MyHashSet.remove are silent no-ops when the key is absent — neither raises an exception nor returns an error signal.
- Source: entries/2026/06/06/design-hashmap-solution.md

### hashmap-get-returns-negative-one [IN] OBSERVATION
MyHashMap.get returns integer -1 for absent keys (LeetCode convention), not None or KeyError.
- Source: entries/2026/06/06/design-hashmap-solution.md

### hashmap-mutable-pair-lists [IN] OBSERVATION
MyHashMap stores entries as mutable `[key, value]` lists (not tuples), enabling in-place value updates via `pair[1] = value` without remove-and-reinsert.
- Source: entries/2026/06/06/design-hashmap-solution.md

### hashmap-no-duplicate-keys [IN] OBSERVATION
MyHashMap.put scans the target bucket for an existing key before appending, guaranteeing at most one entry per key across the entire map.
- Source: entries/2026/06/06/design-hashmap-solution.md

### hashmap-separate-chaining-1009-buckets [IN] OBSERVATION
MyHashMap uses separate chaining with a fixed array of 1009 buckets (a prime), giving O(n/1009) amortized cost per operation with no dynamic resizing.
- Source: entries/2026/06/06/design-hashmap-solution.md

### hashset-colocated-tests [IN] OBSERVATION
design-hashset/solution.py contains both the MyHashSet implementation and its TestMyHashSet unittest class in the same file, following the repo's co-located test convention.
- Source: entries/2026/06/06/design-hashset-solution.md

### hashset-no-duplicates-invariant [IN] OBSERVATION
MyHashSet.add checks `key not in bucket` before appending, guaranteeing each key appears exactly once across the entire structure.
- Source: entries/2026/06/06/design-hashset-solution.md

### hashset-separate-chaining-769-buckets [IN] OBSERVATION
MyHashSet uses separate chaining with 769 buckets (a prime), giving O(n/769) average-case per operation.
- Source: entries/2026/06/06/design-hashset-solution.md

### heapify-over-repeated-push [IN] OBSERVATION
Solutions prefer `heapq.heapify()` (O(n)) for initial heap construction rather than n individual `heappush` calls (O(n log n)).
- Source: entries/2026/06/06/last-stone-weight-solution.md

### height-checker-counting-sort [IN] OBSERVATION
`height_checker` uses counting sort (O(n+k), k=100) rather than comparison sort, exploiting the constraint that heights are in [1, 100].
- Source: entries/2026/06/06/height-checker-solution.md

### height-checker-j-monotonic [IN] OBSERVATION
The cursor `j` only advances forward across the outer loop, so total inner `while` iterations are O(k) amortized across all elements — the nested loop is not O(n*k).
- Source: entries/2026/06/06/height-checker-solution.md

### height-checker-no-sorted-array-materialized [IN] OBSERVATION
The sorted order is never stored as a list; comparison happens inline by walking the frequency array with a monotonically advancing cursor `j`, fusing the sort and compare steps.
- Source: entries/2026/06/06/height-checker-solution.md

### height-zero-for-none [IN] OBSERVATION
The empty tree (`None`) is defined as having height 0 in balanced-binary-tree, making `max(left, right) + 1` produce height 1 for a single leaf node — a foundational invariant the recursion depends on.
- Source: entries/2026/06/06/balanced-binary-tree-solution.md

### hexspeak-no-negative-handling [IN] OBSERVATION
`to_hexspeak` does not handle negative integers; `hex()` on a negative int produces `"-0x..."`, so the `[2:]` slice would retain the `x` and produce an invalid result rather than raising an error.
- Source: entries/2026/06/06/hexspeak-solution.md

### hexspeak-replace-order-independent [IN] OBSERVATION
The two `.replace("0","O").replace("1","I")` calls in `to_hexspeak` produce the same result regardless of order, because `hex()` output contains only `0-9a-f` — no `O` or `I` characters exist before substitution.
- Source: entries/2026/06/06/hexspeak-solution.md

### hexspeak-string-input-contract [IN] OBSERVATION
`to_hexspeak` takes `num` as a string (not int) matching the LeetCode signature, converting internally via `int(num)` with no input validation.
- Source: entries/2026/06/06/hexspeak-solution.md

### hexspeak-valid-set-complete [IN] OBSERVATION
The valid Hexspeak character set `{A,B,C,D,E,F,I,O}` is exactly the six hex letter-digits plus substitutions for `0→O` and `1→I`; digits `2-9` are the only rejection trigger.
- Source: entries/2026/06/06/hexspeak-solution.md

### highest-altitude-misnamed-function [IN] OBSERVATION
The highest-altitude solution function is named `min_operations` despite solving a prefix-sum maximum problem — a naming bug likely from the code generation pipeline.
- Source: entries/2026/06/06/find-the-highest-altitude-solution.md

### highest-altitude-single-pass [IN] OBSERVATION
The highest-altitude solution uses a running accumulator with tracking max in O(n) time and O(1) space, rather than materializing the prefix-sum array.
- Source: entries/2026/06/06/find-the-highest-altitude-solution.md

### highest-altitude-starts-at-zero [IN] OBSERVATION
`min_operations` (the highest-altitude solver) includes altitude 0 as a candidate for the maximum by initializing `max_alt = 0`, correctly accounting for the starting point.
- Source: entries/2026/06/06/find-the-highest-altitude-solution.md

### highest-island-naming-error [IN] OBSERVATION
`substrings-of-size-three-with-distinct-characters/solution.py` has its method named `highest_island` instead of `countGoodSubstrings` — a copy-paste error from a different problem
- Source: entries/2026/06/06/substrings-of-size-three-with-distinct-characters-solution.md

### hills-valleys-boundary-exclusion [IN] OBSERVATION
The counting loop iterates indices `1` through `len(deduped) - 2`, so the first and last elements are never counted as hills or valleys — they lack a second neighbor.
- Source: entries/2026/06/06/count-hills-and-valleys-in-an-array-solution.md

### hills-valleys-dedup-eliminates-plateaus [IN] OBSERVATION
After deduplication, `deduped[i] != deduped[i+1]` for all valid `i`, guaranteeing every interior element is unambiguously a hill, valley, or neither — plateau cases cannot occur.
- Source: entries/2026/06/06/count-hills-and-valleys-in-an-array-solution.md

### hills-valleys-two-pass-tradeoff [IN] OBSERVATION
`count_hills_and_valleys` uses O(n) auxiliary space for the `deduped` list (two-pass: dedup then scan); a single-pass approach tracking `prev_different` could reduce to O(1) space.
- Source: entries/2026/06/06/count-hills-and-valleys-in-an-array-solution.md

### horner-method-for-linked-list-binary [IN] OBSERVATION
Binary-to-integer conversion from linked lists uses Horner's method (`result = result * 2 + node.val`), processing MSB-first in a single pass with O(1) space.
- Source: entries/2026/06/06/convert-binary-number-in-a-linked-list-to-integer-solution.md

### identity-not-equality [IN] OBSERVATION
`getTargetCopy` uses `is` (identity) rather than `==` (equality) to locate the target node, making it correct even when the tree contains duplicate values.
- Source: entries/2026/06/06/find-a-corresponding-node-of-a-binary-tree-in-a-clone-of-that-tree-solution.md

### image-smoother-boundary-clamping [IN] OBSERVATION
Edge and corner cells are handled implicitly via `max(0, i-1)` / `min(m, i+2)` bounds rather than explicit conditional branches, allowing the window to naturally shrink at borders.
- Source: entries/2026/06/06/image-smoother-solution.md

### image-smoother-constant-work-per-cell [IN] OBSERVATION
The inner double loop iterates at most 9 times per cell (3×3 window), making overall complexity O(m·n) rather than O(m·n·k²).
- Source: entries/2026/06/06/image-smoother-solution.md

### image-smoother-floor-division-safe [IN] OBSERVATION
The window always includes cell `(i,j)` itself, so `count` is always ≥1 and the `total // count` floor division never raises `ZeroDivisionError`.
- Source: entries/2026/06/06/image-smoother-solution.md

### image-smoother-out-of-place [IN] OBSERVATION
`imageSmoother` allocates a separate result matrix and never writes to the input, so reads always reflect original pixel values and avoid read-after-write corruption.
- Source: entries/2026/06/06/image-smoother-solution.md

### immunity-complete-across-all-observed-defect-classes [IN] DERIVED
Architectural immunity covers all observed defect classes comprehensively: naming errors from the generation pipeline, convention drift from isolation, and tooling confusion from the test harness are all structurally invisible at runtime, with no observed defect class that could escalate from engineering nuisance to runtime failure.
- Source type: derived
- Depends on: architecture-immune-to-own-engineering-defects, all-nonalgorithmic-defects-invisible-at-runtime
- Unless: misnamed-module-exports-in-test-harness

### immunity-self-reinforced-by-quality-equilibrium [IN] DERIVED
The architecture's immunity to its own engineering defects is not merely passive but actively maintained by the quality equilibrium: defects are structurally harmless (isolation prevents functional impact), the judge-optimized selection dynamics provide no incentive to remediate them, and this combination means defects are positively stabilized by the system's own dynamics rather than merely tolerated.
- Source type: derived
- Depends on: architecture-immune-to-own-engineering-defects, quality-equilibrium-self-reinforcing

### immutable-string-list-copy-for-swap [IN] OBSERVATION
Python string immutability forces solutions that swap characters (e.g., `reverseVowels`) to convert to `list(s)`, perform O(1) swaps, then `"".join()` back — avoiding O(n^2) string concatenation.
- Source: entries/2026/06/06/reverse-vowels-of-a-string-solution.md

### imported-by-cross-refs-misleading [IN] OBSERVATION
The "Imported By" lists in code exploration prompts reflect shared test harness structure across the repo, not real import edges between solution modules.
- Source: entries/2026/06/06/day-of-the-week-solution.md, entries/2026/06/06/day-of-the-year-solution.md, entries/2026/06/06/decode-the-message-solution.md

### imported-by-is-test-harness-artifact [IN] OBSERVATION
The "Imported By" cross-references that appear across solution files are artifacts of the shared test runner infrastructure (likely `run_tests.py` or conftest); solutions do not actually import from each other.
- Source: entries/2026/06/06/determine-if-string-halves-are-alike-solution.md, entries/2026/06/06/determine-if-two-events-have-conflict-solution.md, entries/2026/06/06/determine-whether-matrix-can-be-obtained-by-rotation-solution.md, entries/2026/06/06/di-string-match-solution.md, entries/2026/06/06/diameter-of-binary-tree-solution.md

### imported-by-list-artifact [IN] OBSERVATION
The "Imported By" lists showing ~400+ test files across the repo are misleading artifacts of the analysis tooling — they reflect shared test harness structure (likely a conftest or re-export pattern), not actual direct imports of each solution module.
- Source: entries/2026/06/06/remove-element-solution.md

### imported-by-list-is-misleading [IN] OBSERVATION
The "Imported By" metadata on solution files lists hundreds of test files that don't actually import the solution — they share a common test harness pattern. Each solution's genuine consumer is only its own `test_solution.py`.
- Source: entries/2026/06/06/greatest-english-letter-in-upper-and-lower-case-solution.md

### imported-by-list-is-test-harness-artifact [IN] OBSERVATION
The large "Imported By" lists shown in file context across the repo are artifacts of a shared test runner/harness that indexes all solution modules; they do not represent actual cross-solution dependencies.
- Source: entries/2026/06/06/rectangle-overlap-solution.md

### imported-by-list-misleading [IN] OBSERVATION
The "Imported By" lists shown in the exploration prompt are artifacts of the repo's test infrastructure — each problem's `test_solution.py` imports its own `solution.py`, not other problems' solutions.
- Source: entries/2026/06/06/water-bottles-solution.md

### imported-by-lists-are-artifacts [IN] OBSERVATION
The "Imported By" metadata listing hundreds of test files is a repo-wide cross-reference artifact, not actual import dependencies; each solution is only directly imported by its own `test_solution.py`.
- Source: entries/2026/06/06/sort-array-by-parity-ii-solution.md

### imported-by-lists-are-misleading [IN] OBSERVATION
The "Imported By" metadata across solution files inflates actual dependency counts — most listed test files share a common `from solution import Solution` pattern and don't depend on the specific module. True importers are only the co-located `test_solution.py`.
- Source: entries/2026/06/06/concatenation-of-array-solution.md

### imported-by-lists-are-noisy [IN] OBSERVATION
The "Imported By" metadata for solution files includes hundreds of unrelated test files due to the test harness's broad import scanning; only the co-located `test_solution.py` is a real consumer.
- Source: entries/2026/06/06/final-prices-with-a-special-discount-in-a-shop-solution.md

### imported-by-lists-are-static-analysis-artifacts [IN] OBSERVATION
The "Imported By" lists showing 300+ test files are artifacts of the repo's shared test harness / test runner discovery, not real import relationships; each solution is only directly imported by its own `test_solution.py`.
- Source: entries/2026/06/06/find-subarrays-with-equal-sum-solution.md, entries/2026/06/06/find-subsequence-of-length-k-with-the-largest-sum-solution.md, entries/2026/06/06/find-target-indices-after-sorting-array-solution.md

### imported-by-lists-are-tooling-artifact [IN] OBSERVATION
The "Imported By" lists in the dependency analysis are misleading — hundreds of test files appear as importers of each solution, but each `test_solution.py` only imports from its own directory's `solution.py`; the cross-references are an artifact of shared import patterns or broken static analysis.
- Source: entries/2026/06/06/maximum-product-of-two-elements-in-an-array-solution.md

### imported-by-lists-misleading [IN] OBSERVATION
The tooling's "Imported By" lists show hundreds of test files across the repo, but these reflect shared test infrastructure naming patterns, not actual logical dependencies on the listed solution.
- Source: entries/2026/06/06/apply-operations-to-an-array-solution.md

### imported-by-metadata-is-misleading [IN] OBSERVATION
Across the repo, the "Imported By" metadata for solution files incorrectly lists hundreds of unrelated test files because they all import a local `solution.py` via the same relative path — only the test file in the same problem directory is a real consumer
- Source: entries/2026/06/06/substrings-of-size-three-with-distinct-characters-solution.md

### imported-by-metadata-is-unreliable [IN] OBSERVATION
The "Imported By" lists in the code exploration tooling are artifacts of repo-wide test infrastructure (shared conftest or runner), not real dependency relationships — only the co-located `test_solution.py` actually imports each solution.
- Source: entries/2026/06/06/count-equal-and-divisible-pairs-in-an-array-solution.md

### imported-by-metadata-systematically-unreliable [IN] DERIVED
The "Imported By" dependency metadata is a pure artifact of the test harness's broad import pattern, not indicative of actual code coupling between solutions.
- Depends on: imported-by-lists-are-misleading, imported-by-lists-are-tooling-artifact, test-harness-uniform-import-convention

### imported-by-metadata-unreliable [IN] OBSERVATION
The "Imported By" lists in code-expert analysis are artifacts of the repo's shared test harness or runner — they show every test file in the repo, not actual cross-problem imports. Each solution is only genuinely imported by its own `test_solution.py`.
- Source: entries/2026/06/06/largest-perimeter-triangle-solution.md

### in-place-grid-mutation [IN] OBSERVATION
`maxValueAfterOperations` calls `row.sort()` on each row of the input grid, destroying the original ordering — callers lose their data.
- Source: entries/2026/06/06/delete-greatest-value-in-each-row-solution.md

### in-place-mutation-return-convention [IN] OBSERVATION
Multiple solutions (flood-fill, flipping-an-image) mutate the input data structure in-place and return the same reference, following LeetCode's convention where the caller already holds the reference.
- Source: entries/2026/06/06/flipping-an-image-solution.md

### in-place-mutation-with-return-convention [IN] DERIVED
Solutions routinely mutate input data structures (arrays, linked lists, matrices) in-place and return the same reference, blending imperative mutation with functional return-value style.
- Depends on: in-place-mutation-return-convention, in-place-sort-mutation-pattern, assign-cookies-mutates-inputs, fused-reverse-invert

### in-place-sort-mutation [IN] OBSERVATION
Multiple solutions (`max_product_difference`, `maximumProduct`) mutate the caller's list via `nums.sort()` rather than using `sorted()` — callers must copy if they need the original order.
- Source: entries/2026/06/06/maximum-product-difference-between-two-pairs-solution.md

### in-place-sort-mutation-pattern [IN] OBSERVATION
Multiple solutions (`trimMean`, `can_attend_meetings`) mutate input arrays via `list.sort()` in-place; this is a recurring pattern in the repo where LeetCode's single-call contract makes input preservation unnecessary.
- Source: entries/2026/06/06/mean-of-array-after-removing-some-elements-solution.md

### inclusive-interval-output [IN] OBSERVATION
Each returned interval `[start, end]` from `largeGroupPositions` is inclusive on both ends, matching LeetCode's expected format.
- Source: entries/2026/06/06/positions-of-large-groups-solution.md

### inclusive-range-contract [IN] OBSERVATION
`countPrimeSetBits(left, right)` treats both `left` and `right` as inclusive bounds, using `range(left, right + 1)` to match the LeetCode problem specification
- Source: entries/2026/06/06/prime-number-of-set-bits-in-binary-representation-solution.md

### inconsistency-is-invisible-because-submission-optimized [IN] DERIVED
Engineering inconsistencies (naming drift, dual test conventions, style divergence) persist indefinitely because the submission-optimized architecture both causes them (isolation removes forcing functions) and hides them (each solution is tested in isolation, so cross-solution inconsistencies never surface as failures).
- Depends on: isolation-creates-undetectable-inconsistency, repo-optimized-for-submission-not-engineering

### increasing-bst-dummy-head-pattern [IN] OBSERVATION
Uses a dummy sentinel node to avoid special-casing the first insertion, the same idiom used in linked-list merge problems — build off a throwaway head and return head.right.
- Source: entries/2026/06/06/increasing-order-search-tree-solution.md

### increasing-bst-is-destructive [IN] OBSERVATION
increasingBST mutates the input tree in place; after the call, the original BST structure no longer exists — every node's .left is None and .right points to its in-order successor.
- Source: entries/2026/06/06/increasing-order-search-tree-solution.md

### increasing-bst-linear-time [IN] OBSERVATION
The algorithm visits each node exactly once via in-order traversal, giving O(n) time and O(h) stack space where h is tree height.
- Source: entries/2026/06/06/increasing-order-search-tree-solution.md

### increasing-bst-nulls-left-pointers [IN] OBSERVATION
Every visited node has .left set to None after processing; without this, the restructured tree would contain cycles or stale references.
- Source: entries/2026/06/06/increasing-order-search-tree-solution.md

### increasing-bst-uses-instance-state [IN] OBSERVATION
The mutable cursor is stored as self.current on the Solution instance, making concurrent calls on the same instance unsafe due to shared mutable state.
- Source: entries/2026/06/06/increasing-order-search-tree-solution.md

### increment-before-test-pattern [IN] OBSERVATION
The outer-parenthesis stripping algorithm increments/decrements depth *before* testing the inclusion condition, which is what makes `> 1` (for open) and `> 0` (for close) the correct thresholds — reversing the order would produce wrong results.
- Source: entries/2026/06/06/remove-outermost-parentheses-solution.md

### incremental-counting-equals-combination-sum [IN] OBSERVATION
The single-pass idiom `count += seen[num]; seen[num] += 1` used in `numIdenticalPairs` is mathematically equivalent to summing `C(freq, 2)` for each distinct value but avoids a second pass over the frequency map.
- Source: entries/2026/06/06/number-of-good-pairs-solution.md

### index-bounds-over-slicing-in-divide-and-conquer [IN] OBSERVATION
Divide-and-conquer solutions recurse on index bounds `(left, right)` rather than creating sublists, avoiding O(n log n) total copying and keeping space to O(log n) stack frames.
- Source: entries/2026/06/06/convert-sorted-array-to-binary-search-tree-solution.md

### index-pairs-brute-force-complexity [IN] OBSERVATION
indexPairs runs in O(W × N × L) time where W = len(words), N = len(text), L = max word length, due to nested loops with slice comparison. No trie or Aho-Corasick; appropriate for constraints ≤ 100.
- Source: entries/2026/06/06/index-pairs-of-a-string-solution.md

### index-pairs-duplicate-words-produce-duplicate-results [IN] OBSERVATION
If the same word appears twice in the words list, each match position is reported twice in the output — no deduplication is performed.
- Source: entries/2026/06/06/index-pairs-of-a-string-solution.md

### index-pairs-sort-guarantees-order [IN] OBSERVATION
Output ordering relies on Python's lexicographic list comparison in list.sort(), which sorts [i, j] pairs by i first then j.
- Source: entries/2026/06/06/index-pairs-of-a-string-solution.md

### index-pairs-wrapper-misnamed [IN] OBSERVATION
has_all_codes_in_range is incorrectly named; it wraps indexPairs, not the "check if all codes in range" problem (LeetCode 1461). Likely a scaffolding artifact.
- Source: entries/2026/06/06/index-pairs-of-a-string-solution.md

### inline-comparison-over-max-builtin [IN] OBSERVATION
The repo prefers inline `if depth > max_depth` comparisons over `max_depth = max(max_depth, depth)` calls in tight loops, avoiding a function-call overhead per iteration.
- Source: entries/2026/06/06/maximum-nesting-depth-of-the-parentheses-solution.md

### inline-tests-colocated [IN] OBSERVATION
Solution and unit tests are colocated in the same file, with a `unittest.TestCase` subclass defined alongside the `Solution` class.
- Source: entries/2026/06/06/check-if-an-array-is-consecutive-solution.md

### inline-tests-colocated-with-solution [IN] OBSERVATION
Some solution files (e.g., `apply-operations-to-an-array/solution.py`) bundle `unittest.TestCase` classes directly alongside the solution function, in addition to the separate `test_solution.py` file.
- Source: entries/2026/06/06/apply-operations-to-an-array-solution.md

### inline-tests-with-unittest [IN] OBSERVATION
Some solution files include a `unittest.TestCase` subclass and `__main__` block alongside the solution, making them independently runnable via `python -m unittest` or direct execution.
- Source: entries/2026/06/06/surface-area-of-3d-shapes-solution.md

### inorder-bst-yields-sorted [IN] OBSERVATION
The minimum-distance-between-bst-nodes solution relies on in-order traversal visiting BST nodes in ascending value order, reducing the problem to adjacent-pair difference comparison.
- Source: entries/2026/06/06/minimum-distance-between-bst-nodes-solution.md

### inorder-name-misnomer [IN] OBSERVATION
The function is named `inorder` but performs string rotation; this appears to be a template artifact rather than an intentional name.
- Source: entries/2026/06/06/perform-string-shifts-solution.md

### inorder-state-via-instance-vars [IN] OBSERVATION
BST inorder traversal solutions in this repo use instance variables (e.g., `self.prev`, `self.min_diff`) for running state across recursive calls rather than nonlocal closures or return-value threading.
- Source: entries/2026/06/06/minimum-absolute-difference-in-bst-solution.md

### inscribed-square-side-is-min-dimension [IN] OBSERVATION
The rectangle-to-square solution (problem 1725) relies on the geometric identity that the largest square inscribable in rectangle `[l, w]` has side `min(l, w)`
- Source: entries/2026/06/06/number-of-rectangles-that-can-form-the-largest-square-solution.md

### integer-arithmetic-avoids-float-precision [IN] DERIVED
Solutions systematically choose integer operations — math.isqrt over math.sqrt, integer division over float division, sum comparison over average comparison — to avoid floating-point precision loss that could produce incorrect results for large inputs.
- Depends on: isqrt-over-sqrt-for-large-inputs, pivot-integer-isqrt-not-sqrt, sum-substitution-avoids-float-precision, percentage-floor-integer-arithmetic

### intersect-ii-counter-decrement-streams-nums2 [IN] OBSERVATION
`intersect` builds a Counter from `nums1` only, then consumes `nums2` in a single pass — only `nums1` must fit in memory, making this suitable for streaming `nums2` from disk.
- Source: entries/2026/06/06/intersection-of-two-arrays-ii-solution.md

### intersect-ii-output-follows-nums2-order [IN] OBSERVATION
The output of `intersect` reflects the iteration order of `nums2`, not `nums1`, because elements are appended as `nums2` is walked.
- Source: entries/2026/06/06/intersection-of-two-arrays-ii-solution.md

### intersect-ii-preserves-min-frequency [IN] OBSERVATION
Each element appears in the output of `intersect` exactly `min(count_in_nums1, count_in_nums2)` times, enforced by a `> 0` guard that prevents the counter from going negative.
- Source: entries/2026/06/06/intersection-of-two-arrays-ii-solution.md

### intersection-349-set-idiom-nondeterministic-order [IN] OBSERVATION
`Solution.intersection` (problem 349) uses Python's `set & set` operator, so output element order is nondeterministic and may vary across Python versions.
- Source: entries/2026/06/06/intersection-of-two-arrays-solution.md

### intersection-assumes-nonempty-input [IN] OBSERVATION
intersection() accesses nums[0] unconditionally; passing an empty list raises IndexError. The LeetCode constraint guarantees at least one sub-array.
- Source: entries/2026/06/06/intersection-of-multiple-arrays-solution.md

### intersection-returns-sorted [IN] OBSERVATION
intersection() always returns elements in ascending order, enforced by sorted() on the final line.
- Source: entries/2026/06/06/intersection-of-multiple-arrays-solution.md

### intersection-uses-in-place-narrowing [IN] OBSERVATION
The result set only shrinks across iterations via &=; no element can appear in the output that wasn't in nums[0].
- Source: entries/2026/06/06/intersection-of-multiple-arrays-solution.md

### interval-overlap-formula [IN] OBSERVATION
The `max(0, min(end1, end2) - max(start1, start2) + 1)` idiom for closed-interval overlap length appears in `days_together` and is a cross-cutting pattern used across multiple solutions in the repo.
- Source: entries/2026/06/06/count-days-spent-together-solution.md

### invariant-based-testing-for-bst [IN] OBSERVATION
BST-related tests verify structural properties (BST ordering, height-balance, in-order traversal matching input) rather than asserting a specific tree shape, making tests robust to multiple valid constructions.
- Source: entries/2026/06/06/convert-sorted-array-to-binary-search-tree-solution.md

### invert-tree-double-application-is-identity [IN] OBSERVATION
`invert_tree` is idempotent over two calls: `invert_tree(invert_tree(root))` restores the original tree structure.
- Source: entries/2026/06/06/invert-binary-tree-solution.md

### invert-tree-mutates-in-place [IN] OBSERVATION
`invert_tree` swaps child pointers on existing nodes rather than allocating new ones; the returned root is the same object as the input root.
- Source: entries/2026/06/06/invert-binary-tree-solution.md

### invert-tree-tuple-swap-prevents-clobber [IN] OBSERVATION
The simultaneous assignment `root.left, root.right = invert_tree(root.right), invert_tree(root.left)` evaluates both recursive calls before either assignment executes, preventing the bug where overwriting `root.left` first would lose the original left subtree before the right-side recursion reads it.
- Source: entries/2026/06/06/invert-binary-tree-solution.md

### is-prime-covers-0-to-20 [IN] OBSERVATION
`is_prime` uses a hardcoded set `{2,3,5,7,11,13,17,19}` that is correct for all integers 0–20, sufficient for inputs up to `2^20 - 1` (the problem's upper bound); extending beyond 20-bit inputs would require adding primes up to the new bit width
- Source: entries/2026/06/06/prime-number-of-set-bits-in-binary-representation-solution.md

### is-prime-trial-division-bound [IN] OBSERVATION
`is_prime` in prime-arrangements checks divisors only up to `int(k**0.5) + 1`, making it O(sqrt(k)) per call — sufficient for the n<=100 constraint but would need a sieve for larger inputs.
- Source: entries/2026/06/06/prime-arrangements-solution.md

### is-same-tree-null-guards-before-value-access [IN] OBSERVATION
`is_same_tree` checks both-None and one-None cases before any `.val` access, guaranteeing no `AttributeError` on `None` nodes.
- Source: entries/2026/06/06/same-tree-solution.md

### is-same-tree-short-circuits-on-mismatch [IN] OBSERVATION
`is_same_tree` evaluates `p.val == q.val and recurse(left) and recurse(right)` with short-circuit evaluation, bailing on the first structural or value mismatch without visiting remaining nodes.
- Source: entries/2026/06/06/same-tree-solution.md

### isdigit-filters-non-numeric-tokens [IN] OBSERVATION
`areNumbersAscending` uses `str.isdigit()` to skip non-numeric words entirely; safe for ASCII-only LeetCode inputs but would accept Unicode digit characters in general Python 3
- Source: entries/2026/06/06/check-if-numbers-are-ascending-in-a-sentence-solution.md

### island-perimeter-boundary-guard [IN] OBSERVATION
The `r > 0` and `c > 0` guards are the only bounds checks needed because the algorithm only examines up and left neighbors, never down or right.
- Source: entries/2026/06/06/island-perimeter-solution.md

### island-perimeter-single-pass [IN] OBSERVATION
The island perimeter algorithm computes the result in a single row-major scan with no auxiliary data structures, running in O(rows × cols) time and O(1) extra space.
- Source: entries/2026/06/06/island-perimeter-solution.md

### island-perimeter-subtract-two [IN] OBSERVATION
Each shared edge between two land cells removes exactly 2 from the perimeter total; checking only up and left neighbors (not all four) guarantees each adjacency is counted exactly once because the scan is top-to-bottom, left-to-right.
- Source: entries/2026/06/06/island-perimeter-solution.md

### isolation-cascades-to-tooling-unreliability [IN] DERIVED
The zero-coupling isolation architecture has second-order effects beyond style inconsistency: dependency-tracking tools produce systematically misleading output because the only cross-file references are test-harness imports, not true solution dependencies.
- Depends on: isolation-enables-style-drift, imported-by-metadata-systematically-unreliable

### isolation-creates-undetectable-inconsistency [IN] DERIVED
Zero-coupling isolation both causes inconsistency (no forcing function for conventions) and makes it undetectable (dependency tools produce misleading metadata from the test harness), creating a feedback loop where style divergence accumulates silently and no automated tool can surface it.
- Depends on: no-consistency-enforcement-at-any-level, isolation-cascades-to-tooling-unreliability

### isolation-enables-style-drift [IN] DERIVED
The complete absence of cross-problem imports removes any forcing function for consistent conventions, directly enabling the class-vs-function divergence and method name mismatches observed across the repo.
- Depends on: repo-no-cross-problem-imports, solution-class-vs-standalone-function, method-name-mismatch-pattern, leetcode-repo-mixed-function-style

### isolation-side-effects-invisible-at-runtime [IN] DERIVED
The second-order effects of per-problem isolation (tooling unreliability, undetectable naming drift, convention divergence) are invisible at runtime because each solution is executed and judged independently in the LeetCode submission context.
- Depends on: isolation-creates-undetectable-inconsistency, repo-optimized-for-submission-not-engineering
- Unless: misnamed-module-exports-in-test-harness

### isomorphic-dual-map-bijection [IN] OBSERVATION
`is_isomorphic` enforces a bijection (not just a function) by maintaining two synchronized dictionaries — `s_to_t` and `t_to_s` — updated atomically for each new character pair.
- Source: entries/2026/06/06/isomorphic-strings-solution.md

### isomorphic-early-return [IN] OBSERVATION
The function returns `False` at the first conflict detected during iteration; it never scans the full input when a violation exists at position `i`.
- Source: entries/2026/06/06/isomorphic-strings-solution.md

### isomorphic-no-length-validation [IN] OBSERVATION
`is_isomorphic` assumes `len(s) == len(t)` without validation; `zip` silently truncates to the shorter string, so unequal-length inputs produce silently wrong results rather than errors.
- Source: entries/2026/06/06/isomorphic-strings-solution.md

### isqrt-over-sqrt-for-exactness [IN] OBSERVATION
`isThreeDivisors` uses `math.isqrt` instead of `int(math.sqrt(n))` to avoid floating-point rounding errors in the perfect-square test; `isqrt` returns the exact integer square root.
- Source: entries/2026/06/06/three-divisors-solution.md

### isqrt-over-sqrt-for-large-inputs [IN] OBSERVATION
Solutions needing integer square roots use `math.isqrt` instead of `int(math.sqrt(...))` to avoid floating-point precision errors, especially for inputs near 2^31-1.
- Source: entries/2026/06/06/arranging-coins-solution.md

### isqrt-preferred-over-float-sqrt [IN] OBSERVATION
`math.isqrt` is used instead of `int(math.sqrt(...))` to avoid incorrect results for large integers where float precision is insufficient (near 2^53).
- Source: entries/2026/06/06/take-gifts-from-the-richest-pile-solution.md

### iterates-only-c1-keys [IN] OBSERVATION
`countWords` only iterates over `c1`'s keys, never `c2`'s — words exclusive to `words2` are never examined, which is correct since common words must appear in both arrays.
- Source: entries/2026/06/06/count-common-words-with-one-occurrence-solution.md

### iterative-not-recursive-tree-traversal [IN] OBSERVATION
Both n-ary tree traversal solutions (preorder and postorder) use explicit stack loops rather than recursion, avoiding Python's default 1000-frame recursion limit on deep trees.
- Source: entries/2026/06/06/n-ary-tree-preorder-traversal-solution.md

### iterative-over-recursive-tree-traversal [IN] OBSERVATION
Tree traversal solutions consistently use explicit stacks rather than recursion, avoiding Python's ~1000-frame recursion limit and handling arbitrarily deep trees.
- Source: entries/2026/06/06/binary-tree-preorder-traversal-solution.md

### iterative-reversal-O1-space [IN] OBSERVATION
`reverse_list` uses exactly three local pointer variables (`prev`, `curr`, `next_node`) regardless of list length, making it O(1) auxiliary space.
- Source: entries/2026/06/06/reverse-linked-list-solution.md

### jewels-stones-case-sensitive [IN] OBSERVATION
Jewel matching is case-sensitive; `'a'` and `'A'` are treated as distinct jewel types, preserved by the set conversion.
- Source: entries/2026/06/06/jewels-and-stones-solution.md

### jewels-stones-duplicate-safe [IN] OBSERVATION
Duplicate characters in `jewels` are silently handled by set deduplication without affecting correctness, since the problem only asks about membership, not frequency.
- Source: entries/2026/06/06/jewels-and-stones-solution.md

### jewels-stones-linear-time [IN] OBSERVATION
`num_jewels_in_stones` runs in O(J + S) time and O(J) space by converting `jewels` to a set for O(1) membership testing, then iterating `stones` with a generator expression.
- Source: entries/2026/06/06/jewels-and-stones-solution.md

### judge-circle-short-circuit [IN] OBSERVATION
`judgeCircle` makes 2–4 linear passes: it checks L/R counts first and short-circuits to `False` via Python `and` before counting U/D if horizontal balance already fails.
- Source: entries/2026/06/06/robot-return-to-origin-solution.md

### k-beauty-string-sliding-window [IN] OBSERVATION
`divisor_substrings` uses string conversion and slicing (`str(num)[i:i+k]`) for digit extraction rather than modular arithmetic, which is the standard idiom for digit-substring problems in this repo.
- Source: entries/2026/06/06/find-the-k-beauty-of-a-number-solution.md

### k-beauty-window-count-formula [IN] OBSERVATION
The sliding window iterates exactly `len(str(num)) - k + 1` times, which is the complete set of contiguous length-k substrings; if `k` exceeds the digit count, the range is empty and the function safely returns 0.
- Source: entries/2026/06/06/find-the-k-beauty-of-a-number-solution.md

### k-beauty-zero-guard-before-modulo [IN] OBSERVATION
`divisor_substrings` guards `sub != 0` before computing `num % sub`, preventing `ZeroDivisionError` when substrings like `"00"` parse to zero via `int()`.
- Source: entries/2026/06/06/find-the-k-beauty-of-a-number-solution.md

### k-distant-brute-force-complexity [IN] OBSERVATION
Worst-case time is O(n*k) when every element equals `key`, acceptable for the problem's n,k <= 1000 constraints.
- Source: entries/2026/06/06/find-all-k-distant-indices-in-an-array-solution.md

### k-distant-clamping-prevents-oob [IN] OBSERVATION
`max(0, j-k)` and `min(n, j+k+1)` guarantee all generated indices stay within `[0, n)`.
- Source: entries/2026/06/06/find-all-k-distant-indices-in-an-array-solution.md

### k-distant-output-always-sorted [IN] OBSERVATION
The return value is always in ascending order because `sorted()` is applied to the set before returning.
- Source: entries/2026/06/06/find-all-k-distant-indices-in-an-array-solution.md

### k-distant-uses-set-dedup [IN] OBSERVATION
Overlapping ranges from multiple key positions are deduplicated via a Python `set`, avoiding interval-merging logic.
- Source: entries/2026/06/06/find-all-k-distant-indices-in-an-array-solution.md

### k-equals-n-returns-whole-array [IN] OBSERVATION
In `largestSubarray`, when `k == len(nums)` the scan loop range is empty and the method correctly returns the entire array without special-casing.
- Source: entries/2026/06/06/largest-subarray-length-k-solution.md

### k-length-apart-consecutive-sufficiency [IN] OBSERVATION
`kLengthApart` only checks consecutive pairs of 1s; if all consecutive pairs satisfy the minimum distance, all pairs do (transitivity of minimum spacing in a linear scan).
- Source: entries/2026/06/06/check-if-all-1s-are-at-least-length-k-places-away-solution.md

### k-length-apart-gap-is-exclusive [IN] OBSERVATION
The gap expression `i - last - 1` in `kLengthApart` counts elements strictly between two 1-positions, not including the endpoints — so 1s at indices 2 and 5 yield a gap of 2.
- Source: entries/2026/06/06/check-if-all-1s-are-at-least-length-k-places-away-solution.md

### k-length-apart-sentinel-minus-one [IN] OBSERVATION
`kLengthApart` initializes `last = -1` as a sentinel so the first 1 encountered never triggers a gap violation, avoiding a separate boolean flag.
- Source: entries/2026/06/06/check-if-all-1s-are-at-least-length-k-places-away-solution.md

### k-negations-alias-is-misnomer [IN] OBSERVATION
The `is_univalued` alias for `largest_sum_after_k_negations` has no semantic relationship to this problem; it exists solely to satisfy the repo's test harness uniform-import convention.
- Source: entries/2026/06/06/maximize-sum-of-array-after-k-negations-solution.md

### k-negations-in-place-mutation [IN] OBSERVATION
`largest_sum_after_k_negations` mutates the input list via `sort()` and element assignment; callers that need the original array must copy before calling.
- Source: entries/2026/06/06/maximize-sum-of-array-after-k-negations-solution.md

### kelvin-is-index-zero [IN] OBSERVATION
`convert_temperature` returns `[kelvin, fahrenheit]` — Kelvin at index 0, Fahrenheit at index 1; swapping breaks the LeetCode judge contract.
- Source: entries/2026/06/06/convert-the-temperature-solution.md

### kernighan-bit-clear-loop [IN] OBSERVATION
`hamming_weight` uses Brian Kernighan's `n &= n - 1` trick, iterating exactly k times for k set bits rather than a fixed 32 iterations
- Source: entries/2026/06/06/number-of-1-bits-solution.md

### keyboard-row-case-insensitive-match [IN] OBSERVATION
`find_words` lowercases each word for row lookup but returns the original-cased word — matching is case-insensitive, output is case-preserving.
- Source: entries/2026/06/06/keyboard-row-solution.md

### keyboard-row-no-input-validation [IN] OBSERVATION
Non-alphabetic characters in input words cause an unhandled `KeyError` from the `row_map` lookup; the function trusts the LeetCode constraint of alpha-only input.
- Source: entries/2026/06/06/keyboard-row-solution.md

### keyboard-row-row-map-covers-26-letters [IN] OBSERVATION
`row_map` maps exactly the 26 lowercase English letters to row indices 0, 1, or 2; any non-alphabetic character causes a `KeyError`.
- Source: entries/2026/06/06/keyboard-row-solution.md

### keyboard-row-single-pass-filtering [IN] OBSERVATION
`find_words` is O(n*m) where n is word count and m is max word length — one pass through each word with constant-time dict lookups and a set-size check.
- Source: entries/2026/06/06/keyboard-row-solution.md

### kids-candies-empty-input-crashes [IN] OBSERVATION
Passing an empty `candies` list raises `ValueError` from `max()`; the problem constraints (`n >= 2`) prevent this under valid input.
- Source: entries/2026/06/06/kids-with-the-greatest-number-of-candies-solution.md

### kids-candies-gte-not-gt [IN] OBSERVATION
The comparison uses `>=` (not `>`), so a kid already at the global max always returns `True` regardless of `extraCandies`.
- Source: entries/2026/06/06/kids-with-the-greatest-number-of-candies-solution.md

### kids-candies-linear-time [IN] OBSERVATION
`kidsWithCandies` runs in O(n) time and O(n) space, making exactly two passes over the input: one for `max`, one for the comprehension.
- Source: entries/2026/06/06/kids-with-the-greatest-number-of-candies-solution.md

### kids-candies-no-mutation [IN] OBSERVATION
`kidsWithCandies` never modifies the input `candies` list; it returns a new boolean list.
- Source: entries/2026/06/06/kids-with-the-greatest-number-of-candies-solution.md

### kmp-empty-needle-returns-zero [IN] OBSERVATION
When `needle` is empty, `strStr` returns 0 without special-case code — a natural consequence of `j == m` when both are 0.
- Source: entries/2026/06/06/find-the-index-of-the-first-occurrence-in-a-string-solution.md

### kmp-first-match-semantics [IN] OBSERVATION
`strStr` returns immediately on the first complete match (`j == m`), guaranteeing the leftmost occurrence index is returned.
- Source: entries/2026/06/06/find-the-index-of-the-first-occurrence-in-a-string-solution.md

### kmp-implemented-over-builtin [IN] OBSERVATION
`strStr` implements KMP (Knuth-Morris-Pratt) manually rather than using Python's built-in `str.find()`, making the O(n + m) algorithmic intent explicit.
- Source: entries/2026/06/06/find-the-index-of-the-first-occurrence-in-a-string-solution.md

### kmp-lps-fallback-invariant [IN] OBSERVATION
In the KMP implementation, the LPS array satisfies `0 <= lps[i] < i+1` for all `i`, and on mismatch the fallback `length = lps[length - 1]` guarantees forward progress — every search iteration either advances the haystack pointer or decreases the pattern pointer.
- Source: entries/2026/06/06/find-the-index-of-the-first-occurrence-in-a-string-solution.md

### kth-distinct-is-one-indexed [IN] OBSERVATION
The parameter `k` is 1-indexed; passing `k=1` returns the first distinct string, matching LeetCode's contract.
- Source: entries/2026/06/06/kth-distinct-string-in-an-array-solution.md

### kth-distinct-linear-time [IN] OBSERVATION
`kth_distinct` is O(n) time and O(n) space: one pass to build the Counter, one pass to scan for the kth unique element.
- Source: entries/2026/06/06/kth-distinct-string-in-an-array-solution.md

### kth-distinct-preserves-insertion-order [IN] OBSERVATION
The second pass iterates `arr` in its original order, so "kth distinct" respects the position strings first appear, not alphabetical or any other ordering.
- Source: entries/2026/06/06/kth-distinct-string-in-an-array-solution.md

### kth-distinct-returns-empty-on-insufficient-distincts [IN] OBSERVATION
`kth_distinct` returns `""` (not `None` or an exception) when fewer than `k` strings have count == 1.
- Source: entries/2026/06/06/kth-distinct-string-in-an-array-solution.md

### kth-largest-add-is-log-k [IN] OBSERVATION
Each `add` call performs at most one push and one pop on a heap of size k, giving O(log k) time regardless of total stream length.
- Source: entries/2026/06/06/kth-largest-element-in-a-stream-solution.md

### kth-largest-defensive-copy [IN] OBSERVATION
The `KthLargest` constructor copies `nums` via `nums[:]` before heapifying, so the caller's list is never modified by `heapify`'s in-place rearrangement.
- Source: entries/2026/06/06/kth-largest-element-in-a-stream-solution.md

### kth-largest-heap-size-invariant [IN] OBSERVATION
After `__init__` and every `add` call, `len(self.heap) <= self.k` holds unconditionally — the bounded min-heap never grows past k elements.
- Source: entries/2026/06/06/kth-largest-element-in-a-stream-solution.md

### kth-largest-root-is-answer [IN] OBSERVATION
`self.heap[0]` equals the kth largest element across all values ever provided (init + all add calls), assuming at least k values have been seen.
- Source: entries/2026/06/06/kth-largest-element-in-a-stream-solution.md

### kth-missing-binary-search-ologn [IN] OBSERVATION
`findKthPositive` runs in O(log n) time via binary search on the missing-count function `arr[i] - (i + 1)`, not the naive O(n) linear scan.
- Source: entries/2026/06/06/kth-missing-positive-number-solution.md

### kth-missing-formula-k-plus-left [IN] OBSERVATION
The final answer `k + left` works because `left` counts how many array elements appear before the kth missing number, each shifting the answer position up by one.
- Source: entries/2026/06/06/kth-missing-positive-number-solution.md

### kth-missing-monotonic-invariant [IN] OBSERVATION
The binary search is valid because `arr[i] - (i + 1)` (count of missing positives before index i) is monotonically non-decreasing for a strictly increasing array of positive integers.
- Source: entries/2026/06/06/kth-missing-positive-number-solution.md

### kth-missing-right-bound-len-arr [IN] OBSERVATION
The right boundary is `len(arr)` (not `len(arr) - 1`) so the search correctly handles cases where all k missing numbers fall after every element in the array.
- Source: entries/2026/06/06/kth-missing-positive-number-solution.md

### l-geq-w-by-construction [IN] OBSERVATION
`L >= W` is enforced structurally, not by a conditional: since `w <= sqrt(area)`, `area // w >= sqrt(area) >= w` always holds.
- Source: entries/2026/06/06/construct-the-rectangle-solution.md

### large-group-threshold-is-3 [IN] OBSERVATION
A group is "large" if and only if it contains 3 or more consecutive identical characters; groups of length 1 or 2 are excluded from the result.
- Source: entries/2026/06/06/positions-of-large-groups-solution.md

### largest-perimeter-triangle-mutates-input [IN] OBSERVATION
`largest_perimeter_triangle()` sorts the input list in-place via `nums.sort()`; callers who need the original order must copy before calling.
- Source: entries/2026/06/06/largest-perimeter-triangle-solution.md

### largest-squares-at-array-extremes [IN] OBSERVATION
In a sorted array with negatives, the largest-magnitude elements (and thus largest squares) are always at the two ends, which is the invariant the two-pointer approach exploits
- Source: entries/2026/06/06/squares-of-a-sorted-array-solution.md

### last-seen-stores-latest-index [IN] OBSERVATION
`last_seen[num]` always holds the most recent index where `num` appeared — the unconditional overwrite after each check maintains this invariant, which is what makes it safe to discard older indices.
- Source: entries/2026/06/06/contains-duplicate-ii-solution.md

### lazy-single-pair-parsing [IN] OBSERVATION
`StringIterator` parses at most one `(char, count)` pair at a time via a cursor — it never pre-processes the entire compressed string, keeping memory O(1) even for counts up to 10^9.
- Source: entries/2026/06/06/design-compressed-string-iterator-solution.md

### lc2099-function-misnamed-copypaste [IN] OBSERVATION
`find-subsequence-of-length-k-with-the-largest-sum/solution.py` exports a function named `count_patterns_in_word` that actually selects a max-sum subsequence — a copy-paste naming error from another solution, suggesting batch generation of solution files.
- Source: entries/2026/06/06/find-subsequence-of-length-k-with-the-largest-sum-solution.md

### lcis-assumes-nonempty [IN] OBSERVATION
`findLengthOfLCIS` initializes `max_len = 1` with no empty-array guard, returning 1 for empty input — correct only under LeetCode's `len >= 1` constraint
- Source: entries/2026/06/06/longest-continuous-increasing-subsequence-solution.md

### lcis-contiguous-not-subsequence [IN] OBSERVATION
Despite the problem title saying "subsequence," `findLengthOfLCIS` finds a contiguous subarray — the problem name is historically misleading on LeetCode
- Source: entries/2026/06/06/longest-continuous-increasing-subsequence-solution.md

### lcis-inline-max-update [IN] OBSERVATION
`findLengthOfLCIS` updates `max_len` only inside the increasing branch (when `cur_len` grows), not after every iteration, avoiding redundant comparisons
- Source: entries/2026/06/06/longest-continuous-increasing-subsequence-solution.md

### lcis-strictly-increasing [IN] OBSERVATION
`findLengthOfLCIS` breaks the streak on equal elements (uses `>`, not `>=`), so `[1, 1, 1]` returns 1
- Source: entries/2026/06/06/longest-continuous-increasing-subsequence-solution.md

### lcp-early-termination [IN] OBSERVATION
`longest_common_prefix` terminates as soon as any single string diverges or ends, never examining characters past the common prefix length
- Source: entries/2026/06/06/longest-common-prefix-solution.md

### lcp-empty-input-returns-empty [IN] OBSERVATION
An empty input list to `longest_common_prefix` returns `""` without accessing any element
- Source: entries/2026/06/06/longest-common-prefix-solution.md

### lcp-first-element-pivot [IN] OBSERVATION
`longest_common_prefix` uses `strs[0]` as the reference string and checks all remaining strings against it, avoiding an upfront `min(len(s))` computation
- Source: entries/2026/06/06/longest-common-prefix-solution.md

### lcp-inner-loop-slices [IN] OBSERVATION
`longest_common_prefix` iterates `strs[1:]` in the inner loop, allocating a new list slice on each outer iteration; a `range(1, len(strs))` index loop would avoid this
- Source: entries/2026/06/06/longest-common-prefix-solution.md

### lcp-vertical-scan [IN] OBSERVATION
`longest_common_prefix` scans characters column-by-column across all strings (vertical scanning), not by comparing pairs of strings sequentially
- Source: entries/2026/06/06/longest-common-prefix-solution.md

### leading-zero-rejection [IN] OBSERVATION
Any numeric segment in `abbr` starting with `'0'` causes `validWordAbbreviation` to immediately return `False`, including standalone `0` (semantically meaningless "skip zero characters").
- Source: entries/2026/06/06/valid-word-abbreviation-solution.md

### leap-day-count-uses-y-minus-1 [IN] OBSERVATION
`_days_from_epoch` counts leap days for completed years `1..(y-1)`, not `1..y`, because the current year's leap day is handled separately via the `month > 2` correction
- Source: entries/2026/06/06/number-of-days-between-two-dates-solution.md

### leap-year-adjustment-only-after-feb [IN] OBSERVATION
`dayOfYear` adds 1 for leap years only when `month > 2`, correctly handling that Feb 29 itself is already counted by the `day` component when the date is in February.
- Source: entries/2026/06/06/day-of-the-year-solution.md

### leetcode-bank-closed-form [IN] OBSERVATION
`totalMoney` computes the answer in O(1) time and space using arithmetic series formulas rather than simulating day-by-day deposits.
- Source: entries/2026/06/06/calculate-money-in-leetcode-bank-solution.md

### leetcode-imported-by-lists-misleading [IN] OBSERVATION
The tooling's "Imported By" cross-reference lists are misleadingly large — each problem's `test_solution.py` imports only its own directory's `solution.py`, not other problems' solutions
- Source: entries/2026/06/06/generate-a-string-with-characters-that-have-odd-counts-solution.md, entries/2026/06/06/get-maximum-in-generated-array-solution.md, entries/2026/06/06/goal-parser-interpretation-solution.md, entries/2026/06/06/goat-latin-solution.md, entries/2026/06/06/greatest-common-divisor-of-strings-solution.md

### leetcode-judge-optimized-not-reusable [IN] DERIVED
Design decisions — no input validation, in-place mutation of arguments, per-directory duplication of data structures — collectively optimize solutions for single-run correctness on LeetCode's online judge rather than for reuse, composability, or library consumption.
- Depends on: no-validation-is-deliberate-contract, in-place-mutation-with-return-convention, duplication-over-shared-infrastructure

### leetcode-no-input-validation-convention [IN] OBSERVATION
Solutions assume inputs satisfy LeetCode's stated constraints and perform zero validation or error handling — invalid inputs either raise unhandled exceptions or produce wrong output silently.
- Source: entries/2026/06/06/decrypt-string-from-alphabet-to-integer-mapping-solution.md

### leetcode-repo-mixed-function-style [IN] OBSERVATION
Solutions inconsistently use either a `Solution` class with methods or bare module-level functions — both patterns coexist in the repo
- Source: entries/2026/06/06/generate-a-string-with-characters-that-have-odd-counts-solution.md, entries/2026/06/06/goal-parser-interpretation-solution.md, entries/2026/06/06/greatest-common-divisor-of-strings-solution.md

### leetcode-solution-class-convention [IN] OBSERVATION
Every problem directory contains a `solution.py` with a `Solution` class exposing a single public method, following LeetCode's standard interface pattern.
- Source: entries/2026/06/06/a-number-after-a-double-reversal-solution.md, entries/2026/06/06/add-digits-solution.md, entries/2026/06/06/add-strings-solution.md

### leetcode-solutions-assume-valid-input [IN] OBSERVATION
Solutions throughout the repo omit input validation (bounds checking, type checks, empty-state guards), relying on LeetCode's guaranteed-valid-input contract. Invalid inputs may raise uncaught exceptions or produce silently wrong results.
- Source: entries/2026/06/06/implement-stack-using-queues-solution.md

### leetcode-solutions-no-input-validation [IN] OBSERVATION
Solutions across the repo perform no input validation — they trust LeetCode's guaranteed constraints and raise unhandled exceptions on malformed input.
- Source: entries/2026/06/06/baseball-game-solution.md

### leetcode-solutions-no-validation-convention [IN] OBSERVATION
All LeetCode solutions in this repo omit input validation, trusting the caller to satisfy the problem's stated constraints; this is a deliberate convention matching LeetCode's guaranteed-valid-input contract.
- Source: entries/2026/06/06/nim-game-solution.md

### leetcode-solutions-omit-input-validation [IN] OBSERVATION
Solutions in this repo consistently perform no input validation (no bounds checking, type checking, or constraint verification), relying entirely on LeetCode's problem guarantees enforced by the judge.
- Source: entries/2026/06/06/average-salary-excluding-the-minimum-and-maximum-salary-solution.md

### leetcode-solutions-skip-input-validation [IN] OBSERVATION
All solution functions rely on LeetCode's input constraints rather than performing their own bounds checking; invalid inputs produce undefined behavior (empty strings, IndexError, etc.)
- Source: entries/2026/06/06/generate-a-string-with-characters-that-have-odd-counts-solution.md, entries/2026/06/06/get-maximum-in-generated-array-solution.md, entries/2026/06/06/goal-parser-interpretation-solution.md, entries/2026/06/06/goat-latin-solution.md, entries/2026/06/06/greatest-common-divisor-of-strings-solution.md

### leetcode-solutions-trust-constraints [IN] OBSERVATION
Solutions in this repo perform no input validation (no bounds checks, no type checks, no empty-input guards); they rely on LeetCode's guaranteed preconditions, and invalid inputs cause raw Python exceptions (`IndexError`, `ValueError`).
- Source: entries/2026/06/06/maximum-product-difference-between-two-pairs-solution.md

### leetcode-solutions-trust-input-constraints [IN] OBSERVATION
Solutions in this repo universally omit input validation (null checks, range checks, format checks), relying on LeetCode's guarantee that inputs satisfy stated constraints. This is by design, not an oversight.
- Source: entries/2026/06/06/climbing-stairs-solution.md

### leetcode-solutions-trust-input-contracts [IN] OBSERVATION
Across all solutions in the repo, functions perform no input validation and raise no exceptions — they trust callers to satisfy LeetCode problem constraints. Invalid inputs (empty arrays, wrong types, violated invariants) produce silent wrong results or unguarded crashes.
- Source: entries/2026/06/06/element-appearing-more-than-25-in-sorted-array-solution.md

### leetcode-solutions-trust-input-convention [IN] OBSERVATION
Solutions across the repo generally perform no input validation beyond problem-specific guards (e.g., empty-input check in destCity), trusting LeetCode's constraints for type safety, value ranges, and structural guarantees.
- Source: entries/2026/06/06/design-hashmap-solution.md

### left-biased-binary-search-pattern [IN] OBSERVATION
First-bad-version uses left-biased binary search: when `isBadVersion(mid)` is true, `right = mid` (not `mid - 1`) because `mid` itself may be the answer; when false, `left = mid + 1` since `mid` is definitively excluded.
- Source: entries/2026/06/06/first-bad-version-solution.md

### left-leaf-root-never-counted [IN] OBSERVATION
A single-node tree returns 0 from `sum_of_left_leaves` because the root is seeded with `is_left=False` — the root cannot be a "left leaf" regardless of its children.
- Source: entries/2026/06/06/sum-of-left-leaves-solution.md

### left-mid-bias-on-even-length [IN] OBSERVATION
`(left + right) // 2` selects the left-middle element for even-length ranges, producing a left-leaning balanced BST; choosing `(left + right + 1) // 2` would also be valid.
- Source: entries/2026/06/06/convert-sorted-array-to-binary-search-tree-solution.md

### leftovers-equals-odd-frequency-count [IN] OBSERVATION
The `leftovers` value returned by `count_pairs_leftovers` equals the number of distinct values in `nums` that appear an odd number of times, since each contributes exactly `count % 2 == 1`.
- Source: entries/2026/06/06/maximum-number-of-pairs-in-array-solution.md

### lemonade-change-early-return [IN] OBSERVATION
The lemonade-change solution short-circuits with `False` at the first customer who can't receive correct change, skipping the rest of the queue.
- Source: entries/2026/06/06/lemonade-change-solution.md

### lemonade-greedy-order-is-critical [IN] OBSERVATION
For $20 bills, the lemonade-change solution must prefer $10+$5 over $5×3 — this ordering is required for correctness, not just an optimization.
- Source: entries/2026/06/06/lemonade-change-solution.md

### length-of-last-word-no-empty-guard [IN] OBSERVATION
`length_of_last_word` assumes `s` contains at least one word; passing an empty or all-whitespace string raises `IndexError` from `split()[-1]`.
- Source: entries/2026/06/06/length-of-last-word-solution.md

### length-of-last-word-o-n-space [IN] OBSERVATION
`length_of_last_word` runs in O(n) space because `split()` materializes the full word list, not just the last word.
- Source: entries/2026/06/06/length-of-last-word-solution.md

### length-of-last-word-uses-no-arg-split [IN] OBSERVATION
`length_of_last_word` relies on `str.split()` with no arguments, which collapses consecutive whitespace and strips leading/trailing spaces — distinct from `str.split(' ')`.
- Source: entries/2026/06/06/length-of-last-word-solution.md

### lexicographic-hhmm-is-chronological [IN] OBSERVATION
Comparing `"HH:MM"` strings with `<=` produces correct chronological ordering because the format is fixed-width and zero-padded; this breaks if the input is not zero-padded (e.g., `"9:30"` instead of `"09:30"`).
- Source: entries/2026/06/06/determine-if-two-events-have-conflict-solution.md

### lhs-counter-based-linear [IN] OBSERVATION
`findLHS` runs in O(n) time and O(n) space via a single `Counter` construction and one pass over distinct keys
- Source: entries/2026/06/06/longest-harmonious-subsequence-solution.md

### lhs-one-directional-check [IN] OBSERVATION
`findLHS` only checks `k + 1` in the counter (never `k - 1`), ensuring each valid adjacent pair is counted exactly once without double-counting
- Source: entries/2026/06/06/longest-harmonious-subsequence-solution.md

### lhs-returns-zero-for-uniform-list [IN] OBSERVATION
`findLHS` returns 0 when all elements are identical, because a harmonious subsequence requires max - min == 1, not 0
- Source: entries/2026/06/06/longest-harmonious-subsequence-solution.md

### lhs-subsequence-not-subarray [IN] OBSERVATION
`findLHS` correctly treats the input as a subsequence problem (order-independent) by using frequency counts rather than positional logic
- Source: entries/2026/06/06/longest-harmonious-subsequence-solution.md

### license-key-empty-input-safe [IN] OBSERVATION
License-key-formatting handles all-dashes or empty input without error — the loop range is empty, `parts` stays `[]`, and `"-".join([])` returns `""`.
- Source: entries/2026/06/06/license-key-formatting-solution.md

### license-key-first-group-remainder [IN] OBSERVATION
In license-key-formatting, the first group size equals `len(cleaned) % k`; all subsequent groups are exactly `k` characters.
- Source: entries/2026/06/06/license-key-formatting-solution.md

### license-key-strip-then-partition [IN] OBSERVATION
The license-key-formatting solution uses the strip-then-partition pattern: destroy all existing structure (`replace` + `upper`), then rebuild from scratch — avoiding edge cases around existing group boundaries.
- Source: entries/2026/06/06/license-key-formatting-solution.md

### line-break-before-overflow [IN] OBSERVATION
In the line-writing solution (problem 806), a new line starts *before* the character that would exceed 100 pixels; a character landing exactly at 100 does not trigger a break
- Source: entries/2026/06/06/number-of-lines-to-write-string-solution.md

### linear-time-no-simulation [IN] OBSERVATION
`count_pairs_leftovers` avoids the O(n^2) pair-removal simulation described in the problem and instead uses O(n) frequency counting with `Counter` plus integer division.
- Source: entries/2026/06/06/maximum-number-of-pairs-in-array-solution.md

### linear-time-two-scan [IN] OBSERVATION
`maxDistance` achieves O(n) time and O(1) space via two linear scans with early termination, anchoring at opposite endpoints.
- Source: entries/2026/06/06/two-furthest-houses-with-different-colors-solution.md

### linked-list-cycle-read-only [IN] OBSERVATION
`hasCycle` never modifies the list — it is a purely read-only traversal, preserving the original structure.
- Source: entries/2026/06/06/linked-list-cycle-solution.md

### linked-list-intersection-identity-not-equality [IN] OBSERVATION
`getIntersectionNode` uses `a is not b` (identity comparison), not value equality — two nodes with the same `val` at different addresses are not considered an intersection.
- Source: entries/2026/06/06/intersection-of-two-linked-lists-solution.md

### linked-list-two-pointer-redirect-convergence [IN] OBSERVATION
The two-pointer redirect trick guarantees convergence: each pointer traverses both lists (total `len(A) + len(B)` nodes), so they align at the intersection node or both reach `None` simultaneously if lists don't intersect.
- Source: entries/2026/06/06/intersection-of-two-linked-lists-solution.md

### listnode-defined-locally-per-problem [IN] OBSERVATION
`ListNode` is defined locally in each linked-list problem's `solution.py` rather than imported from a shared module — keeps solutions self-contained but means the class is duplicated across every linked-list problem in the repo.
- Source: entries/2026/06/06/reverse-linked-list-solution.md

### listnode-defined-per-solution [IN] OBSERVATION
`ListNode` is redefined locally in each linked-list solution file rather than imported from a shared module, keeping each problem directory self-contained.
- Source: entries/2026/06/06/convert-binary-number-in-a-linked-list-to-integer-solution.md

### listnode-shared-dependency [IN] OBSERVATION
`ListNode`, `from_list`, and `to_list` defined in `remove-linked-list-elements/solution.py` are imported by hundreds of other problem directories as the repo's de facto shared linked list utilities, despite living under a single problem's directory.
- Source: entries/2026/06/06/remove-linked-list-elements-solution.md

### logger-10s-boundary-inclusive [IN] OBSERVATION
A message printed at timestamp `t` can be printed again at exactly `t + 10` — the comparison is `>=`, making the blocked window `[t, t+10)`.
- Source: entries/2026/06/06/logger-rate-limiter-solution.md

### logger-no-state-change-on-reject [IN] OBSERVATION
When `shouldPrintMessage` returns `False`, the `next_allowed` dict is not modified — only accepted messages update state.
- Source: entries/2026/06/06/logger-rate-limiter-solution.md

### logger-stores-next-allowed-not-last-seen [IN] OBSERVATION
The logger stores `timestamp + 10` (next-allowed time) rather than the last-seen timestamp, collapsing the acceptance check to a single `>=` comparison.
- Source: entries/2026/06/06/logger-rate-limiter-solution.md

### logger-unbounded-memory [IN] OBSERVATION
The logger's `next_allowed` dict is never pruned; memory grows monotonically with the number of distinct messages over the logger's lifetime.
- Source: entries/2026/06/06/logger-rate-limiter-solution.md

### logger-unseen-message-always-prints [IN] OBSERVATION
A never-seen message always returns `True` because `dict.get(message, 0)` returns `0`, which any non-negative timestamp satisfies.
- Source: entries/2026/06/06/logger-rate-limiter-solution.md

### lonely-detection-parent-perspective [IN] OBSERVATION
Lonely-node detection operates from the parent's perspective (checking if exactly one child exists), which structurally excludes the root from results without special-casing.
- Source: entries/2026/06/06/find-all-the-lonely-nodes-solution.md

### lonely-detection-xor-logic [IN] OBSERVATION
A child is appended to lonely-node results if and only if exactly one of `(left, right)` exists at the parent — a logical XOR on child presence, implemented via `if`/`elif` branches.
- Source: entries/2026/06/06/find-all-the-lonely-nodes-solution.md

### long-press-full-consumption [IN] OBSERVATION
`isLongPressedName` returns `i == len(name)` to reject cases where `typed` is a valid long-press prefix of `name` but doesn't cover all characters
- Source: entries/2026/06/06/long-pressed-name-solution.md

### long-press-greedy-order [IN] OBSERVATION
The `isLongPressedName` algorithm never backtracks pointer `i`; each character in `name` is matched at most once, left to right, using a greedy two-pointer approach
- Source: entries/2026/06/06/long-pressed-name-solution.md

### long-press-j0-guard [IN] OBSERVATION
The `j > 0` guard in `isLongPressedName` prevents `typed[j-1]` from wrapping to the last character when `j == 0`, ensuring the first character must match `name[0]` or fail
- Source: entries/2026/06/06/long-pressed-name-solution.md

### long-press-three-case-dispatch [IN] OBSERVATION
Each character in `typed` is handled by exactly one of three cases: match (advance `i`), long-press repeat (skip), or mismatch (return False immediately)
- Source: entries/2026/06/06/long-pressed-name-solution.md

### long-press-time-complexity [IN] OBSERVATION
`isLongPressedName` runs in O(len(typed)) time with O(1) extra space since pointer `i` only moves forward and the loop visits each `typed` character exactly once
- Source: entries/2026/06/06/long-pressed-name-solution.md

### longest-task-first-starts-at-zero [IN] OBSERVATION
The employee-longest-task solution treats the first task as starting at time 0, capturing its duration as `logs[0][1]` directly without explicit subtraction.
- Source: entries/2026/06/06/the-employee-that-worked-on-the-longest-task-solution.md

### longest-task-parameter-n-unused [IN] OBSERVATION
The `n` parameter in `worker_with_longest_task` exists solely to match the LeetCode signature and has no effect on the algorithm or output.
- Source: entries/2026/06/06/the-employee-that-worked-on-the-longest-task-solution.md

### longest-task-single-pass-o1-space [IN] OBSERVATION
`worker_with_longest_task` makes exactly one pass over `logs` using three scalar variables — O(n) time, O(1) space.
- Source: entries/2026/06/06/the-employee-that-worked-on-the-longest-task-solution.md

### longest-task-tie-break-smallest-id [IN] OBSERVATION
When two tasks have equal duration, `worker_with_longest_task` retains the employee with the strictly smaller ID, not the one encountered first.
- Source: entries/2026/06/06/the-employee-that-worked-on-the-longest-task-solution.md

### lookup-abstraction-trio-covers-all-queries [IN] DERIVED
Three lookup abstractions recur across the repo's solution patterns: Counter for frequency, multiset, and pair-counting queries; set conversion for O(1) membership and dedup checks; and binary search for convergence-based positional queries. Together these cover a broad range of query patterns encountered in the codebase, each providing efficient time complexity for its query type.
- Depends on: counter-universal-frequency-primitive, set-for-o1-membership-universal, binary-search-variants-share-convergence-structure

### lookup-abstractions-enable-linear-time-across-paradigms [IN] DERIVED
The three lookup abstractions (Counter, set, binary search) are the mechanism that converts preprocessing investment into linear-time scans across both paradigms: hash preprocessing enables O(1) per-query lookups while sort preprocessing enables O(log n) binary search, and both reduce what would be O(n²) nested iteration to O(n) or O(n log n) single-pass scans.
- Depends on: lookup-abstraction-trio-covers-all-queries, sorted-order-enables-all-efficient-search

### lookup-abstractions-instantiate-pipeline-phases [IN] DERIVED
The lookup abstraction trio (Counter, set, binary search) is the load-bearing joint between the pipeline's preprocessing and scanning phases — each preprocessing paradigm (hash or sort) establishes exactly the data structure one of these abstractions queries, making the lookup the mechanism that converts preprocessing investment into linear-time scan payoff across both pipeline instantiations.
- Depends on: lookup-abstractions-enable-linear-time-across-paradigms, canonical-pipeline-has-exactly-two-instantiations

### lookup-string-as-digit-map [IN] OBSERVATION
`hex_chars = "0123456789abcdef"` uses string indexing as a lightweight digit-to-character mapping, avoiding dictionaries or conditional chains.
- Source: entries/2026/06/06/convert-a-number-to-hexadecimal-solution.md

### loop-terminates-at-one [IN] OBSERVATION
The width search loop always terminates because `w = 1` divides every positive integer, serving as a universal fallback.
- Source: entries/2026/06/06/construct-the-rectangle-solution.md

### lstrip-zero-fallback-prevents-empty-key [IN] OBSERVATION
The `or '0'` guard after `lstrip('0')` in `num_different_integers` ensures all-zero strings like `"000"` canonicalize to `"0"` rather than the empty string, which would silently miscount distinct integers.
- Source: entries/2026/06/06/number-of-different-integers-in-a-string-solution.md

### lucky-numbers-distinct-values-required [IN] OBSERVATION
The lucky numbers solution uses `row.index(min_val)` which returns the first occurrence; correctness depends on all matrix values being distinct, as duplicates could cause incorrect column selection.
- Source: entries/2026/06/06/lucky-numbers-in-a-matrix-solution.md

### lucky-numbers-row-min-then-col-max [IN] OBSERVATION
The algorithm finds row minimums first, then validates each candidate as a column maximum via a linear scan; it never independently scans columns to find maximums.
- Source: entries/2026/06/06/lucky-numbers-in-a-matrix-solution.md

### lus-mathematical-reduction [IN] OBSERVATION
Longest Uncommon Subsequence I collapses to a string equality check: if strings differ, return `max(len(a), len(b))`; if equal, return `-1` — no subsequence enumeration needed.
- Source: entries/2026/06/06/longest-uncommon-subsequence-i-solution.md

### majority-check-bounds-safe [IN] OBSERVATION
The short-circuit `and` in `is_majority_element` guarantees `nums[first + n // 2]` is never accessed out of bounds — the left operand `first + n // 2 < n` must be true before the right operand is evaluated.
- Source: entries/2026/06/06/check-if-a-number-is-majority-element-in-a-sorted-array-solution.md

### majority-check-single-bisect [IN] OBSERVATION
`is_majority_element` uses exactly one `bisect_left` call to achieve O(log n) majority checking — it avoids a second binary search by checking `nums[first + n//2] == target` directly.
- Source: entries/2026/06/06/check-if-a-number-is-majority-element-in-a-sorted-array-solution.md

### majority-threshold-floor-division [IN] OBSERVATION
The majority threshold is `n // 2` (floor division), so the target must appear at least `n // 2 + 1` times; for n=5 that means ≥3 occurrences.
- Source: entries/2026/06/06/check-if-a-number-is-majority-element-in-a-sorted-array-solution.md

### make-string-great-method-name-mismatch [IN] OBSERVATION
The method in `make-the-string-great/solution.py` is named `goodNodes` but implements LeetCode 1544's `makeGood`; this is a copy-paste artifact from a tree problem.
- Source: entries/2026/06/06/make-the-string-great-solution.md

### make-string-sorted-is-misnomer [IN] OBSERVATION
The module-level alias `make_string_sorted` in the equal-occurrences solution does not match the problem name or the method it wraps (`areOccurrencesEqual`) — likely a copy-paste artifact from code generation tooling.
- Source: entries/2026/06/06/check-if-all-characters-have-equal-number-of-occurrences-solution.md

### mass-import-is-test-scaffolding [IN] OBSERVATION
The hundreds of "Imported By" entries shown for solution files are artifacts of the repo's test harness structure — the test runner imports all solution modules uniformly, not because solutions depend on each other
- Source: entries/2026/06/06/number-of-1-bits-solution.md

### mathematical-insight-replaces-brute-computation [IN] DERIVED
Solutions leverage mathematical reasoning — closed-form formulas for arithmetic series, greedy optimality proofs for prefix-free codes and assignment problems, algebraic reductions — to replace iterative or exhaustive computation with provably correct O(1) or O(n) alternatives.
- Depends on: closed-form-reduction-eliminates-iteration, greedy-algorithms-provably-optimal

### mathematical-reduction-eliminates-all-runtime-state [IN] DERIVED
Mathematical reduction achieves the logical extreme of the space minimization strategy: by replacing iteration with closed-form computation, it eliminates both the algorithmic state (running accumulators that streaming requires) and structural state (preprocessed data structures that pipeline solutions require), collapsing the entire scan-accumulate loop to a single constant-time evaluation with zero auxiliary memory.
- Source type: derived
- Depends on: mathematical-reduction-unifies-simulation-elimination, space-minimization-dual-strategy

### mathematical-reduction-is-degenerate-streaming [IN] DERIVED
Closed-form mathematical solutions are degenerate instances of the streaming paradigm: they reduce the "scan" to a single constant-time evaluation, eliminating not just preprocessing but iteration itself — the logical extreme of streaming's progressive elimination of computational prerequisites.
- Source type: derived
- Depends on: mathematical-insight-replaces-brute-computation, all-solutions-reduce-to-adapted-streaming

### mathematical-reduction-is-third-elimination-axis [IN] DERIVED
Mathematical reduction (closed-form formulas, modular arithmetic) constitutes a third axis of the elimination principle alongside construction-based validation elimination and isolation-based coupling elimination: where construction eliminates runtime checks and isolation eliminates inter-module dependencies, mathematical reduction eliminates computational phases entirely.
- Source type: derived
- Depends on: mathematical-insight-replaces-brute-computation, coherence-through-elimination-not-enforcement

### mathematical-reduction-proves-streaming-extremal-minimality [IN] DERIVED
Closed-form mathematical solutions serve as constructive proofs of streaming's extremal minimality: by collapsing the streaming scan to a single constant-time evaluation while remaining within the paradigm (as degenerate instances), they demonstrate that the normal form admits reduction all the way to zero iteration — the theoretical minimum of the minimal strategy.
- Source type: derived
- Depends on: mathematical-reduction-is-degenerate-streaming, streaming-normal-form-is-minimal-strategy

### mathematical-reduction-unifies-simulation-elimination [IN] DERIVED
Closed-form algebraic formulas and modular arithmetic are two instances of the same strategy: replacing iterative simulation with direct mathematical computation, eliminating entire computational phases rather than optimizing them.
- Source type: derived
- Depends on: closed-form-reduction-eliminates-iteration, modular-arithmetic-eliminates-simulation

### max-avg-no-input-validation [IN] OBSERVATION
`findMaxAverage` performs no validation on inputs; it will divide by zero if `k == 0` and may return incorrect results if `k > len(nums)`.
- Source: entries/2026/06/06/maximum-average-subarray-i-solution.md

### max-avg-sliding-window-o-n [IN] OBSERVATION
The maximum average subarray solution runs in O(n) time and O(1) extra space by maintaining a running sum and sliding a fixed-size window.
- Source: entries/2026/06/06/maximum-average-subarray-i-solution.md

### max-avg-tracks-sum-not-average [IN] OBSERVATION
`findMaxAverage` tracks the maximum window sum during iteration and only divides by `k` once at the end, avoiding repeated floating-point division and accumulation errors.
- Source: entries/2026/06/06/maximum-average-subarray-i-solution.md

### max-captured-forts-anchor-greedy [IN] OBSERVATION
`last_non_zero` is updated on every non-zero element, not just on successful captures, ensuring the closest valid anchor is always used for future candidates.
- Source: entries/2026/06/06/maximum-enemy-forts-that-can-be-captured-solution.md

### max-captured-forts-bidirectional [IN] OBSERVATION
`max_captured_forts` captures both 1→(-1) and (-1)→1 movements in a single pass via a `!=` sign check between the current non-zero and the last-seen non-zero anchor.
- Source: entries/2026/06/06/maximum-enemy-forts-that-can-be-captured-solution.md

### max-captured-forts-linear-time [IN] OBSERVATION
`max_captured_forts` runs in O(n) time with a single pass and O(1) auxiliary space, using an anchor-tracking scan over non-zero elements.
- Source: entries/2026/06/06/maximum-enemy-forts-that-can-be-captured-solution.md

### max-captured-forts-no-validation [IN] OBSERVATION
`max_captured_forts` performs no input validation; it assumes all elements are in {-1, 0, 1} per the LeetCode contract and relies on only 0s existing between non-zero indices.
- Source: entries/2026/06/06/maximum-enemy-forts-that-can-be-captured-solution.md

### max-consecutive-ones-eager-update [IN] OBSERVATION
The maximum is updated inside the `n == 1` branch only, eliminating the need for a post-loop `max()` call and avoiding a redundant comparison on every 0-element.
- Source: entries/2026/06/06/max-consecutive-ones-solution.md

### max-consecutive-ones-non1-as-terminator [IN] OBSERVATION
The function does not validate that elements are 0 or 1; any non-1 value (including 2, -1, etc.) silently acts as a streak terminator.
- Source: entries/2026/06/06/max-consecutive-ones-solution.md

### max-consecutive-ones-pure-streaming-exemplar [IN] DERIVED
Max consecutive ones is a pure streaming exemplar demonstrating all three structural properties of the paradigm in minimal form: single-pass O(n) scan with O(1) space (paradigm shape), eager in-loop max update eliminating post-loop fixup (extend-or-reset pattern), and correct empty-input handling via zero-initialization (sentinel boundary handling).
- Source type: derived
- Depends on: max-consecutive-ones-single-pass, max-consecutive-ones-eager-update, max-consecutive-ones-zero-on-empty

### max-consecutive-ones-single-pass [IN] OBSERVATION
`findMaxConsecutiveOnes` runs in O(n) time and O(1) space with exactly one pass over the input using a streaming accumulator with reset-on-mismatch.
- Source: entries/2026/06/06/max-consecutive-ones-solution.md

### max-consecutive-ones-zero-on-empty [IN] OBSERVATION
The function returns 0 for empty input and for arrays containing no 1s, without special-casing either scenario.
- Source: entries/2026/06/06/max-consecutive-ones-solution.md

### max-depth-assumes-valid-input [IN] OBSERVATION
`maxDepth` does not validate that parentheses are balanced; `depth` could go negative on malformed input, producing silently wrong results.
- Source: entries/2026/06/06/maximum-nesting-depth-of-the-parentheses-solution.md

### max-depth-nary-depth-convention [IN] OBSERVATION
Depth is 1-indexed across tree problems: a single-node tree returns 1, an empty tree returns 0.
- Source: entries/2026/06/06/maximum-depth-of-n-ary-tree-solution.md

### max-depth-nary-leaf-guard [IN] OBSERVATION
The `if not root.children: return 1` check prevents `ValueError` from calling `max()` on an empty generator; removing it breaks leaf nodes.
- Source: entries/2026/06/06/maximum-depth-of-n-ary-tree-solution.md

### max-depth-nary-node-children-default [IN] OBSERVATION
`Node.__init__` normalizes `children=None` to `[]`, avoiding the mutable default argument pitfall and ensuring callers can omit the argument.
- Source: entries/2026/06/06/maximum-depth-of-n-ary-tree-solution.md

### max-depth-o1-space [IN] OBSERVATION
`maxDepth` uses O(1) space with two integer counters (`depth` and `max_depth`), avoiding the O(n) stack that a structural parenthesis solution would require.
- Source: entries/2026/06/06/maximum-nesting-depth-of-the-parentheses-solution.md

### max-depth-single-pass [IN] OBSERVATION
`maxDepth` makes exactly one character-by-character pass over the input string in O(n) time.
- Source: entries/2026/06/06/maximum-nesting-depth-of-the-parentheses-solution.md

### max-difference-alias-is-vestigial [IN] OBSERVATION
The `max_difference` class-level alias on the candies-with-discount Solution has no semantic connection to the problem and appears to be a scaffolding artifact from the code generation pipeline.
- Source: entries/2026/06/06/minimum-cost-of-buying-candies-with-discount-solution.md

### max-distance-endpoint-invariant [IN] OBSERVATION
In `maxDistance`, the optimal pair always includes index 0 or index n-1; the proof is that any interior-only pair can be extended to an endpoint for a strictly larger distance.
- Source: entries/2026/06/06/two-furthest-houses-with-different-colors-solution.md

### max-heap-via-negation-idiom [IN] OBSERVATION
Solutions needing max-heap behavior negate values on insert and negate again on extract, since Python's `heapq` only provides a min-heap.
- Source: entries/2026/06/06/last-stone-weight-solution.md

### max-product-three-o-nlogn [IN] OBSERVATION
`maximumProduct` uses O(n log n) sort when an O(n) single-pass tracking five extremes (min1, min2, max1, max2, max3) is possible — a deliberate simplicity-over-performance tradeoff.
- Source: entries/2026/06/06/maximum-product-of-three-numbers-solution.md

### max-product-two-candidates [IN] OBSERVATION
The maximum product of three numbers from a sorted array is always `max(top3_product, bottom2_times_top1)` — no other combination of three indices can produce a larger value.
- Source: entries/2026/06/06/maximum-product-of-three-numbers-solution.md

### max-remap-first-non-nine [IN] OBSERVATION
The max value in digit-remapping is always achieved by remapping the leftmost non-9 digit to 9, because that digit has the highest positional weight among improvable digits.
- Source: entries/2026/06/06/maximum-difference-by-remapping-a-digit-solution.md

### max-repeating-no-empty-word-guard [IN] OBSERVATION
`longestAwesomeSubstring` (the maximum repeating substring solver) has no guard against empty `word` input — `"" in sequence` is always `True`, causing an infinite loop. Correctness depends on the LeetCode constraint `len(word) >= 1`.
- Source: entries/2026/06/06/maximum-repeating-substring-solution.md

### max-sum-greedy-correctness [IN] OBSERVATION
The closed-form formula is equivalent to greedily picking all 1s, then all 0s, then -1s, which is provably optimal because item values are strictly ordered (1 > 0 > -1).
- Source: entries/2026/06/06/k-items-with-the-maximum-sum-solution.md

### max-sum-is-closed-form [IN] OBSERVATION
`max_sum` computes the answer in O(1) time with no loops or data structures, reducing the greedy pick strategy to `min(k, numOnes) - max(0, k - numOnes - numZeros)`.
- Source: entries/2026/06/06/k-items-with-the-maximum-sum-solution.md

### max-sum-no-input-validation [IN] OBSERVATION
`max_sum` does not validate that `k <= numOnes + numZeros + numNegOnes`; violating this precondition produces a mathematically valid but semantically meaningless result where the implied -1 count exceeds `numNegOnes`.
- Source: entries/2026/06/06/k-items-with-the-maximum-sum-solution.md

### max69-greedy-leftmost [IN] OBSERVATION
Replacing the leftmost 6 with 9 is provably optimal because higher-order digit positions have exponentially greater value; `str.replace` with count=1 naturally targets this position.
- Source: entries/2026/06/06/maximum-69-number-solution.md

### max69-no-op-on-all-nines [IN] OBSERVATION
When `num` contains no 6s, the function returns the input unchanged because `str.replace` is a no-op when the target substring is absent — no special-case code needed.
- Source: entries/2026/06/06/maximum-69-number-solution.md

### max69-single-expression [IN] OBSERVATION
The entire solution is a single return expression (`int(str(num).replace("6", "9", 1))`) with no control flow, leveraging `str.replace` count parameter for the "at most one change" constraint.
- Source: entries/2026/06/06/maximum-69-number-solution.md

### maxdepth-is-pure-recursive [IN] OBSERVATION
`maxDepth` uses no auxiliary data structures; space complexity is O(h) from the call stack alone, where h is tree height.
- Source: entries/2026/06/06/maximum-depth-of-binary-tree-solution.md

### maxdepth-none-returns-zero [IN] OBSERVATION
`maxDepth(None)` returns `0`, establishing that depth counts nodes on the path, not edges (a single node has depth 1).
- Source: entries/2026/06/06/maximum-depth-of-binary-tree-solution.md

### maxpower-eager-max-update [IN] OBSERVATION
`max_count` is updated only inside the run-extension branch (`s[i] == s[i-1]`), never on run breaks; correctness depends on the initial value of 1 covering all length-1 runs.
- Source: entries/2026/06/06/consecutive-characters-solution.md

### maxpower-empty-string-bug [IN] OBSERVATION
`maxPower` returns 1 for an empty string (loop is skipped, `max_count` stays at its initial value of 1) rather than 0 or raising — safe only because LeetCode guarantees `len(s) >= 1`.
- Source: entries/2026/06/06/consecutive-characters-solution.md

### maxpower-linear-time [IN] OBSERVATION
`maxPower` runs in O(n) time and O(1) space using a single-pass "current vs. previous" scan — the canonical pattern for run-length problems.
- Source: entries/2026/06/06/consecutive-characters-solution.md

### meeting-rooms-mutates-input [IN] OBSERVATION
`can_attend_meetings` sorts the `intervals` list in-place, modifying the caller's data.
- Source: entries/2026/06/06/meeting-rooms-solution.md

### meeting-rooms-no-imports [IN] OBSERVATION
The meeting-rooms solution uses no imports — it is pure Python with no standard library or external dependencies.
- Source: entries/2026/06/06/meeting-rooms-solution.md

### meeting-rooms-sort-then-scan [IN] OBSERVATION
`can_attend_meetings` uses O(n log n) sort + O(n) adjacent-pair scan; correctness relies on the invariant that after sorting by start time, overlap can only occur between adjacent intervals.
- Source: entries/2026/06/06/meeting-rooms-solution.md

### meeting-rooms-strict-boundary [IN] OBSERVATION
Meetings sharing an endpoint (e.g., `[0,10]` and `[10,20]`) are not considered overlapping; the overlap check uses `>`, not `>=`.
- Source: entries/2026/06/06/meeting-rooms-solution.md

### merge-alternately-linear-complexity [IN] OBSERVATION
`mergeAlternately` runs in O(n + m) time and space via a single pass with list accumulation and join.
- Source: entries/2026/06/06/merge-strings-alternately-solution.md

### merge-alternately-output-length [IN] OBSERVATION
Output length of `mergeAlternately` is always exactly `len(word1) + len(word2)` — no characters are dropped or duplicated.
- Source: entries/2026/06/06/merge-strings-alternately-solution.md

### merge-alternately-word1-first [IN] OBSERVATION
At each index position, `mergeAlternately` appends `word1`'s character before `word2`'s, guaranteeing `word1` leads at every shared index.
- Source: entries/2026/06/06/merge-strings-alternately-solution.md

### merge-no-allocation [IN] OBSERVATION
`merge_two_lists` allocates exactly one `ListNode` (the dummy sentinel); all output nodes are reused from the inputs via pointer rewiring.
- Source: entries/2026/06/06/merge-two-sorted-lists-solution.md

### merge-nums-aliases-unmatched [IN] OBSERVATION
For IDs appearing in only one input, `merge_nums` appends a reference to the original `[id, value]` sublist rather than a copy — callers mutating the output can inadvertently modify the input.
- Source: entries/2026/06/06/merge-two-2d-arrays-by-summing-values-solution.md

### merge-nums-no-input-mutation [IN] OBSERVATION
`merge_nums` never modifies `nums1` or `nums2`; matched entries produce new `[id, sum]` lists, while unmatched entries are appended by reference.
- Source: entries/2026/06/06/merge-two-2d-arrays-by-summing-values-solution.md

### merge-nums-sorted-precondition [IN] OBSERVATION
`merge_nums` correctness depends on both inputs being sorted by ID; unsorted inputs produce incorrect results silently with no validation or error.
- Source: entries/2026/06/06/merge-two-2d-arrays-by-summing-values-solution.md

### merge-nums-two-pointer-linear-time [IN] OBSERVATION
`merge_nums` uses a two-pointer merge pattern, visiting each element exactly once for O(n + m) time complexity — exploiting the sorted precondition rather than using a hash map.
- Source: entries/2026/06/06/merge-two-2d-arrays-by-summing-values-solution.md

### merge-paradigm-linear-via-pointer-advancement [IN] DERIVED
The merge problem family (merge-alternately, merge-nums, merge-two-lists) collectively demonstrates that pointer-per-input advancement achieves O(n+m) time with minimal allocation: each pointer advances monotonically, the merge is stable (equal-value ties broken by input ordering), and the output reuses existing nodes rather than allocating fresh ones.
- Source type: derived
- Depends on: merge-alternately-linear-complexity, merge-nums-two-pointer-linear-time, merge-no-allocation, merge-stable-ordering

### merge-scan-extends-sort-pipeline-to-dual-inputs [IN] DERIVED
The merge-scan pattern is the canonical extension of the sort-then-two-pointer pipeline to problems with two pre-sorted input sequences: instead of sorting a single array then scanning with converging pointers, it interleaves two already-sorted inputs using advancing pointers, preserving the pipeline's structure while accepting dual inputs.
- Source type: derived
- Depends on: merge-scan-pattern-for-sorted-pair-processing, sort-then-two-pointer-dominant-pair-pipeline

### merge-scan-pattern-for-sorted-pair-processing [IN] DERIVED
The two-pointer merge-scan pattern (maintain a pointer into each sorted sequence, advance the pointer on the smaller value, act on equality or exhaustion) is a recurring O(n+m) technique for processing paired elements from two sorted inputs — instantiated in merge-alternately (interleave by index), merge-nums (sum by matching ID), and min-common-number (return on first match).
- Source type: derived
- Depends on: merge-alternately-linear-complexity, merge-nums-two-pointer-linear-time, two-pointer-merge-scan-for-sorted-intersection

### merge-similar-items-output-sorted-by-value [IN] OBSERVATION
The return value of `sum_weights` is always sorted ascending by the first element (value) of each pair, enforced by `sorted()` on the final list comprehension.
- Source: entries/2026/06/06/merge-similar-items-solution.md

### merge-similar-items-self-contained-tests [IN] OBSERVATION
`merge-similar-items/solution.py` includes both the solution and a `unittest.TestCase` with 7 test methods, runnable standalone via `__main__`.
- Source: entries/2026/06/06/merge-similar-items-solution.md

### merge-similar-items-uses-defaultdict-accumulation [IN] OBSERVATION
`sum_weights` uses `defaultdict(int)` to merge both lists in O(n) time before a single O(n log n) sort, rather than a two-pointer merge on pre-sorted input.
- Source: entries/2026/06/06/merge-similar-items-solution.md

### merge-stable-ordering [IN] OBSERVATION
`merge_two_lists` is a stable merge: when both lists contain equal values, `list1`'s node appears first in the output due to the `<=` comparison.
- Source: entries/2026/06/06/merge-two-sorted-lists-solution.md

### merge-trees-creates-new-nodes-for-overlaps [IN] OBSERVATION
`merge_trees` allocates a new `TreeNode` for every position where both input trees have a node; it never mutates either input at overlapping positions.
- Source: entries/2026/06/06/merge-two-binary-trees-solution.md

### merge-trees-hybrid-ownership-semantics [IN] DERIVED
The merge-trees algorithm produces a hybrid ownership structure: overlapping positions get newly allocated nodes (independent of inputs), while non-overlapping subtrees are shared by reference with the original trees — the output's lifetime is entangled with both inputs, making it unsafe to mutate either input tree after merging.
- Source type: derived
- Depends on: merge-trees-creates-new-nodes-for-overlaps, merge-trees-shares-subtrees-for-non-overlaps

### merge-trees-recursion-depth-equals-max-height [IN] OBSERVATION
`merge_trees` recursion depth is bounded by the height of the taller input tree — O(log n) for balanced trees, O(n) worst case for skewed trees.
- Source: entries/2026/06/06/merge-two-binary-trees-solution.md

### merge-trees-shares-subtrees-for-non-overlaps [IN] OBSERVATION
When one input tree is `None` at a position, `merge_trees` returns the other tree's subtree by reference — the output shares structure with the inputs for non-overlapping regions.
- Source: entries/2026/06/06/merge-two-binary-trees-solution.md

### method-alias-for-test-harness [IN] OBSERVATION
Solution classes alias the main method to a second name (e.g., `find_latest_step = countConsistentStrings`) with no semantic relationship to the algorithm — this exists purely to satisfy test infrastructure expectations
- Source: entries/2026/06/06/count-the-number-of-consistent-strings-solution.md

### method-alias-is-test-harness-artifact [IN] OBSERVATION
`mincostTickets = divisorGame` in divisor-game/solution.py creates a class-level alias so the module satisfies generic `Solution` attribute lookups from other problems' test files — it has no semantic relationship to LeetCode 983.
- Source: entries/2026/06/06/divisor-game-solution.md

### method-alias-pattern-for-leetcode-names [IN] OBSERVATION
The repo uses class-level aliasing (`correctName = wrongName`) to expose LeetCode-expected method names without wrapping overhead, as seen in `numberOfSteps = queensAttacktheKing`
- Source: entries/2026/06/06/number-of-steps-to-reduce-a-number-to-zero-solution.md

### method-name-mismatch-minimum-moves [IN] OBSERVATION
`Solution.maximumRemovals` in `minimum-moves-to-convert-string/solution.py` is misnamed; it solves LeetCode 2027 (minimum moves to convert string), not LeetCode 1898 (maximum removals).
- Source: entries/2026/06/06/minimum-moves-to-convert-string-solution.md

### method-name-mismatch-pattern [IN] OBSERVATION
Multiple solutions in the repo have method names from a different LeetCode problem due to copy-paste from templates (`maxSideLength` for 1413, `mctFromLeafValues` for 1228); tests likely bind to the wrong name to match.
- Source: entries/2026/06/06/minimum-value-to-get-positive-step-by-step-sum-solution.md

### method-name-mismatches-common [IN] OBSERVATION
Multiple solutions use method names that don't match LeetCode's canonical names (e.g., `numberOfWays` for problem 806, `numberOfSets` for problem 1725, `queensAttacktheKing` for problem 1342) — a recurring pattern across the repo, not isolated typos
- Source: entries/2026/06/06/number-of-lines-to-write-string-solution.md, entries/2026/06/06/number-of-rectangles-that-can-form-the-largest-square-solution.md, entries/2026/06/06/number-of-steps-to-reduce-a-number-to-zero-solution.md

### method-name-mismatches-exist [IN] OBSERVATION
Multiple solutions use incorrect method names that don't match LeetCode's canonical names (e.g., `sortItems` instead of `freqAlphabets` for #1309, `minOperations` instead of `decrypt` for #1652) — likely copy-paste artifacts from scaffolding.
- Source: entries/2026/06/06/decrypt-string-from-alphabet-to-integer-mapping-solution.md

### method-naming-inconsistencies [IN] OBSERVATION
Multiple solutions have method names that don't match LeetCode canonical names (`possible_bipartition` for sortArrayByParityII, `maxValue` for sortEvenOdd), likely artifacts from the code generation pipeline.
- Source: entries/2026/06/06/sort-even-and-odd-indices-independently-solution.md

### middle-element-lo-le-hi [IN] OBSERVATION
The `lo <= hi` condition (not `lo < hi`) in `flipAndInvertImage` is critical: it ensures the center element of odd-length rows is inverted exactly once when `lo == hi`.
- Source: entries/2026/06/06/flipping-an-image-solution.md

### min-abs-diff-mutates-input [IN] OBSERVATION
`minimumAbsDifference` mutates the caller's list via `arr.sort()` rather than working on a copy — standard for LeetCode solutions in this repo but relevant if the caller retains the list.
- Source: entries/2026/06/06/minimum-absolute-difference-solution.md

### min-cost-assumes-length-ge-2 [IN] OBSERVATION
`minCostClimbingStairs` will raise `IndexError` if `cost` has fewer than 2 elements; it relies on the LeetCode constraint `len(cost) >= 2` without validation.
- Source: entries/2026/06/06/min-cost-climbing-stairs-solution.md

### min-cost-dp-uses-constant-space [IN] OBSERVATION
`minCostClimbingStairs` uses O(1) auxiliary space via two rolling variables (`prev1`, `prev2`) instead of an O(n) DP array.
- Source: entries/2026/06/06/min-cost-climbing-stairs-solution.md

### min-cost-final-answer-is-min-of-last-two [IN] OBSERVATION
The final `min(prev1, prev2)` is necessary because you can reach the top (one past the last index) from either of the last two steps.
- Source: entries/2026/06/06/min-cost-climbing-stairs-solution.md

### min-cost-loop-invariant [IN] OBSERVATION
After processing index `i`, `prev1` holds the minimum cost to reach and pay step `i`, and `prev2` holds the same for step `i-1`.
- Source: entries/2026/06/06/min-cost-climbing-stairs-solution.md

### min-cuts-colocated-tests [IN] OBSERVATION
`minimum-cuts-to-divide-a-circle/solution.py` contains both the solution function and its `unittest.TestCase` in the same file, in addition to the separate `test_solution.py` — following a pattern of colocated tests for some solutions.
- Source: entries/2026/06/06/minimum-cuts-to-divide-a-circle-solution.md

### min-cuts-even-half-odd-full [IN] OBSERVATION
`min_cuts(n)` returns 0 for n=1, n//2 for even n, and n for odd n > 1 — even-numbered slices allow diameter reuse (each cut creates two boundaries) while odd-numbered slices cannot.
- Source: entries/2026/06/06/minimum-cuts-to-divide-a-circle-solution.md

### min-distance-generator-not-list [IN] OBSERVATION
`get_min_distance` uses a generator expression (lazy) inside `min()`, not a list comprehension, avoiding allocation of an intermediate list — O(1) auxiliary space.
- Source: entries/2026/06/06/minimum-distance-to-the-target-element-solution.md

### min-distance-precondition-target-exists [IN] OBSERVATION
`get_min_distance` raises `ValueError` if `target` is absent from `nums` because `min()` receives an empty generator; no internal guard exists.
- Source: entries/2026/06/06/minimum-distance-to-the-target-element-solution.md

### min-max-alternation-resets-per-round [IN] OBSERVATION
The min/max alternation resets each round — pair index `i` starts at 0, so the first pair always uses `min` regardless of which operation ended the previous round.
- Source: entries/2026/06/06/min-max-game-solution.md

### min-max-game-linear-total-work [IN] OBSERVATION
Total comparisons across all rounds is O(n) due to geometric halving (n/2 + n/4 + ... = n - 1).
- Source: entries/2026/06/06/min-max-game-solution.md

### min-max-game-returns-value-not-count [IN] OBSERVATION
`min_steps` returns the last surviving element value, not the number of reduction rounds — the function name is misleading.
- Source: entries/2026/06/06/min-max-game-solution.md

### min-moves-no-empty-guard [IN] OBSERVATION
`min_moves` calls `min()` and `max()` without guarding for empty input; an empty list raises `ValueError` — this is by design, relying on LeetCode's guarantee of non-empty input.
- Source: entries/2026/06/06/count-elements-with-strictly-smaller-and-greater-elements-solution.md

### min-moves-strict-inequality-excludes-boundaries [IN] OBSERVATION
`min_moves` uses strict `<` comparisons, so elements equal to `min(nums)` or `max(nums)` are never counted — only interior values qualify.
- Source: entries/2026/06/06/count-elements-with-strictly-smaller-and-greater-elements-solution.md

### min-moves-three-pass-linear [IN] OBSERVATION
`min_moves` makes three O(n) passes (min, max, count) using a generator inside `sum()`, achieving O(n) time and O(1) auxiliary space.
- Source: entries/2026/06/06/count-elements-with-strictly-smaller-and-greater-elements-solution.md

### min-moves-uniform-list-returns-zero [IN] OBSERVATION
When all elements are identical, `min_val == max_val` makes the condition `min_val < x < max_val` unsatisfiable, correctly returning 0 without special-casing.
- Source: entries/2026/06/06/count-elements-with-strictly-smaller-and-greater-elements-solution.md

### min-of-adjacent-groups [IN] OBSERVATION
In `count_binary_substrings`, the number of valid binary substrings spanning two adjacent groups of sizes a and b is exactly `min(a, b)` — this is the mathematical invariant the O(1)-space algorithm relies on.
- Source: entries/2026/06/06/count-binary-substrings-solution.md

### min-on-empty-is-unguarded [IN] OBSERVATION
`max_distance` crashes with `ValueError` from `min()` on an empty generator if `k > len(nums)`; no explicit validation exists.
- Source: entries/2026/06/06/minimum-difference-between-highest-and-lowest-of-k-scores-solution.md

### min-operations-is-misnamed [IN] OBSERVATION
The function `min_operations` in `convert-binary-number-in-a-linked-list-to-integer/solution.py` performs binary-to-integer conversion, not any "minimum operations" computation; the name doesn't match the problem.
- Source: entries/2026/06/06/convert-binary-number-in-a-linked-list-to-integer-solution.md

### min-ops-equals-distinct-positives [IN] OBSERVATION
`minOperations` in `make-array-zero-by-subtracting-equal-amounts/solution.py` returns `len(set(nums) - {0})` — the count of distinct positive values — because each subtraction operation eliminates exactly one distinct positive value.
- Source: entries/2026/06/06/make-array-zero-by-subtracting-equal-amounts-solution.md

### min-ops-increasing-empty-input-crashes [IN] OBSERVATION
`min_operations` (array increasing) accesses `nums[0]` unconditionally — passing an empty list raises an unhandled `IndexError`.
- Source: entries/2026/06/06/minimum-operations-to-make-the-array-increasing-solution.md

### min-remap-always-leading-digit [IN] OBSERVATION
The min value in digit-remapping is always achieved by remapping `s[0]` to `'0'`, regardless of what `s[0]` is — leading zeros collapse naturally via `int()`.
- Source: entries/2026/06/06/maximum-difference-by-remapping-a-digit-solution.md

### min-subarray-alias-is-generic [IN] OBSERVATION
The `min_subarray` alias at module level is a project-wide test harness convention, not semantically related to the individual solution.
- Source: entries/2026/06/06/reformat-phone-number-solution.md

### min-subsequence-integer-only-threshold [IN] OBSERVATION
The threshold check `subseq_sum > total - subseq_sum` uses only integer arithmetic, avoiding floating-point precision issues that would arise from `subseq_sum > total / 2`.
- Source: entries/2026/06/06/minimum-subsequence-in-non-increasing-order-solution.md

### min-subsequence-mutates-input [IN] OBSERVATION
`min_subsequence` calls `nums.sort(reverse=True)` in-place, reordering the caller's list as a side effect.
- Source: entries/2026/06/06/minimum-subsequence-in-non-increasing-order-solution.md

### min-sum-init-zero-is-intentional [IN] OBSERVATION
In the min-start-value solution, `min_sum` is initialized to 0 (not `-inf`) so that when all prefix sums are non-negative, the result is correctly `max(1, 1 - 0) = 1` without a special case.
- Source: entries/2026/06/06/minimum-value-to-get-positive-step-by-step-sum-solution.md

### min-time-typewriter-greedy-optimal [IN] OBSERVATION
Processing characters left-to-right with shortest-arc moves is provably optimal for the typewriter problem; no lookahead or reordering can reduce total time because the pointer must visit each character in sequence.
- Source: entries/2026/06/06/minimum-time-to-type-word-using-special-typewriter-solution.md

### min-time-typewriter-per-char-bound [IN] OBSERVATION
Each character in the typewriter problem contributes exactly `min(|target - curr|, 26 - |target - curr|) + 1` seconds, bounded to `[1, 14]`.
- Source: entries/2026/06/06/minimum-time-to-type-word-using-special-typewriter-solution.md

### min-tracking-pattern-shared [IN] OBSERVATION
`maxProfit` and `maximum-difference-between-increasing-elements/solution.py` share the same min-so-far tracking pattern: maintain a running minimum, compute max delta at each position.
- Source: entries/2026/06/06/best-time-to-buy-and-sell-stock-solution.md

### mindepth-bfs-over-dfs [IN] OBSERVATION
`minDepth` uses BFS (level-order traversal) rather than DFS so it can return immediately at the first leaf encountered, avoiding full-tree traversal on unbalanced trees.
- Source: entries/2026/06/06/minimum-depth-of-binary-tree-solution.md

### mindepth-depth-one-indexed [IN] OBSERVATION
`minDepth` uses 1-indexed depth (root = 1), so a single-node tree returns 1 and an empty tree returns 0.
- Source: entries/2026/06/06/minimum-depth-of-binary-tree-solution.md

### mindepth-single-child-not-leaf [IN] OBSERVATION
A node with exactly one child is never treated as a leaf in `minDepth`; the algorithm descends into the existing subtree — the key correctness property that distinguishes minimum depth from maximum depth.
- Source: entries/2026/06/06/minimum-depth-of-binary-tree-solution.md

### minimumcost-mutates-input-list [IN] OBSERVATION
`minimumCost` calls `cost.sort(reverse=True)` in place, reordering the caller's list as a side effect.
- Source: entries/2026/06/06/minimum-cost-of-buying-candies-with-discount-solution.md

### minus-one-means-infeasible [IN] OBSERVATION
distribute-money returns -1 if and only if `money < children`, the sole condition where giving every child at least $1 is impossible.
- Source: entries/2026/06/06/distribute-money-to-maximum-children-solution.md

### misleading-function-names-from-generation [IN] OBSERVATION
At least two solutions have wrapper/function names unrelated to their problem (`minimizeTheDifference` for palindrome finding, `mem_sticks_crash` for graph connectivity), indicating a systematic naming issue in the code generation pipeline.
- Source: entries/2026/06/06/find-if-path-exists-in-graph-solution.md

### misleading-method-names-exist [IN] OBSERVATION
Some solution methods have names that do not reflect their algorithm — `countStrings` counts removal steps not strings, and `dfs` performs a greedy linear scan with no recursion or backtracking.
- Source: entries/2026/06/06/replace-all-s-to-avoid-consecutive-repeating-characters-solution.md

### misnamed-method-split-and-minimize [IN] OBSERVATION
`largest-3-same-digit-number-in-string/solution.py` defines `split_and_minimize` but the correct LeetCode signature is `largestGoodInteger` — likely a code generation pipeline bug
- Source: entries/2026/06/06/largest-3-same-digit-number-in-string-solution.md

### missing-char-returns-zero [IN] OBSERVATION
If any character in `target` is absent from `s`, `maxNumberOfCopies` returns 0 because `Counter.__getitem__` returns 0 for missing keys, making `0 // demand` yield 0.
- Source: entries/2026/06/06/rearrange-characters-to-make-target-string-solution.md

### missing-number-gauss-sum [IN] OBSERVATION
`missing-number/solution.py` uses Gauss's formula `n*(n+1)//2 - sum(nums)` for O(n) time and O(1) space, rather than XOR, hash set, or sorting approaches.
- Source: entries/2026/06/06/missing-number-solution.md

### missing-ranges-cursor-not-sentinel [IN] OBSERVATION
`find_missing_ranges` uses a `next_expected` cursor to detect gaps rather than mutating the input by prepending `lower-1` / appending `upper+1` — the input list is never modified or copied.
- Source: entries/2026/06/06/missing-ranges-solution.md

### missing-ranges-empty-input-returns-full-range [IN] OBSERVATION
When `nums` is empty, `find_missing_ranges` returns the single formatted range `[lower, upper]` — the loop body never executes and the post-loop residual check captures the entire bound.
- Source: entries/2026/06/06/missing-ranges-solution.md

### missing-ranges-precondition-sorted-unique-in-bounds [IN] OBSERVATION
`find_missing_ranges` assumes `nums` is sorted, contains unique values, and all elements fall within `[lower, upper]` — none of these preconditions are validated at runtime.
- Source: entries/2026/06/06/missing-ranges-solution.md

### missing-target-returns-neg-one [IN] OBSERVATION
`shortest_distance` returns `-1` when the target string is absent from the array, not 0 or an exception — the sentinel check `result < n` distinguishes found from not-found.
- Source: entries/2026/06/06/shortest-distance-to-target-string-in-a-circular-array-solution.md

### mixed-api-style-class-and-function [IN] OBSERVATION
Solutions inconsistently use either a `Solution` class with instance methods (matching LeetCode's expected interface) or standalone module-level functions — both styles coexist in the repo.
- Source: entries/2026/06/06/count-of-matches-in-tournament-solution.md, entries/2026/06/06/count-pairs-of-similar-strings-solution.md

### mixed-solution-export-conventions [IN] OBSERVATION
Some solutions export a `Solution` class with a method (e.g., `largestInteger`, `largestNumberAtLeastTwiceOfOthers`), while others export a bare function (e.g., `largest_matrix`, `largest_odd_number`) — the repo has no single enforced convention
- Source: entries/2026/06/06/largest-local-values-in-a-matrix-solution.md

### mod-6-equivalence [IN] OBSERVATION
The average-even-divisible-by-three solution collapses `n % 2 == 0 and n % 3 == 0` into `n % 6 == 0` using the fact that lcm(2, 3) = 6, a number-theory simplification that recurs across solutions with coprime divisibility checks.
- Source: entries/2026/06/06/average-value-of-even-numbers-that-are-divisible-by-three-solution.md

### mod-applied-per-multiply [IN] OBSERVATION
In prime-arrangements, modular reduction (`% MOD`) is applied at each multiplication step rather than once at the end, keeping intermediate values bounded — a pattern used across competitive-programming solutions in this repo.
- Source: entries/2026/06/06/prime-arrangements-solution.md

### modular-arithmetic-avoids-large-integers [IN] OBSERVATION
The binary-prefix-divisible-by-5 solution tracks only the remainder modulo 5 at each step (`remainder = (remainder * 2 + bit) % 5`), never constructing the actual binary number — a pattern for constant-space streaming over unbounded numeric sequences.
- Source: entries/2026/06/06/binary-prefix-divisible-by-5-solution.md

### modular-arithmetic-eliminates-simulation [IN] DERIVED
Solutions for problems with circular, periodic, or wrap-around structure uniformly reduce to O(1) closed-form expressions via modular arithmetic (min-of-diff-and-complement for shortest arc, mod-then-truncate for cyclic shifts, division-and-modulo for periodic bouncing), eliminating iterative simulation entirely.
- Depends on: circular-distance-idiom-min-diff-n-minus-diff, shift-grid-k-mod-optimization, pillow-holder-o1-time

### modular-digit-extraction-pattern [IN] OBSERVATION
`subtract-the-product-and-sum-of-digits` extracts digits via `n % 10` / `n //= 10` loop rather than string conversion, achieving O(1) space with no string allocation
- Source: entries/2026/06/06/subtract-the-product-and-sum-of-digits-of-an-integer-solution.md

### module-alias-instantiates-at-import [IN] OBSERVATION
The module-level alias pattern (e.g., `sort_integers_by_the_number_of_1_bits = Solution().sortByBits`) creates a `Solution()` instance at import time and binds its method, providing a uniform snake_case entry point for the test harness.
- Source: entries/2026/06/06/sort-integers-by-the-number-of-1-bits-solution.md

### modulo-for-circular-wraparound [IN] OBSERVATION
`idx % len(array)` is the standard idiom for circular wrap-around in sorted/search problems — it handles target-greater-than-all, target-equals-last, and target-equals-interior cases without explicit conditionals.
- Source: entries/2026/06/06/find-smallest-letter-greater-than-target-solution.md

### monotonic-constant-array-is-monotonic [IN] OBSERVATION
A constant array (all elements equal) returns `True` from `isMonotonic` because neither the `>` nor `<` comparisons fire, leaving both flags `True`.
- Source: entries/2026/06/06/monotonic-array-solution.md

### monotonic-dual-flag-no-early-exit [IN] OBSERVATION
`isMonotonic` tracks `increasing` and `decreasing` flags simultaneously but never short-circuits — the loop runs to completion even if both flags are `False` mid-scan, making worst-case and best-case both O(n).
- Source: entries/2026/06/06/monotonic-array-solution.md

### monotonic-vacuous-truth-short-arrays [IN] OBSERVATION
Arrays of length 0 or 1 return `True` from `isMonotonic` without entering the loop — `range(0)` produces no iterations, so both flags remain `True`.
- Source: entries/2026/06/06/monotonic-array-solution.md

### month-dict-completeness [IN] OBSERVATION
The `months` dictionary maps exactly the 12 three-letter English month abbreviations to zero-padded two-digit strings `"01"` through `"12"`.
- Source: entries/2026/06/06/reformat-date-solution.md

### month-zero-silent-wrong-answer [IN] OBSERVATION
`number_of_days` performs no input validation; passing month=0 silently returns 31 (December) via Python's negative list indexing rather than raising an error
- Source: entries/2026/06/06/number-of-days-in-a-month-solution.md

### morse-gin-zen-collision-tested [IN] OBSERVATION
The test suite explicitly verifies that distinct words (`"gig"` and `"msg"`) produce identical Morse strings, confirming the deduplication behavior is non-trivial
- Source: entries/2026/06/06/unique-morse-code-words-solution.md

### morse-ord-indexing-pattern [IN] OBSERVATION
Character-to-Morse lookup uses `ord(c) - ord('a')` to index into a 26-element list, requiring input to be strictly lowercase a-z
- Source: entries/2026/06/06/unique-morse-code-words-solution.md

### morse-set-comprehension-dedup [IN] OBSERVATION
Uniqueness counting is done via set comprehension, making the solution O(S) time where S is total characters across all words
- Source: entries/2026/06/06/unique-morse-code-words-solution.md

### morse-table-is-itu-standard [IN] OBSERVATION
The 26-element `morse` list in `unique-morse-code-words/solution.py` matches the ITU International Morse Code alphabet in a-z order
- Source: entries/2026/06/06/unique-morse-code-words-solution.md

### most-common-word-no-empty-guard [IN] OBSERVATION
`mostCommonWord` raises `IndexError` if every word is banned or the paragraph has no alphabetic characters — there is no guard on an empty `Counter`, relying on LeetCode's guarantee of a valid answer.
- Source: entries/2026/06/06/most-common-word-solution.md

### most-common-word-regex-tokenization [IN] OBSERVATION
`mostCommonWord` tokenizes via `re.findall(r'[a-z]+', paragraph.lower())`, which strips all punctuation and whitespace implicitly — no explicit delimiter character class is needed.
- Source: entries/2026/06/06/most-common-word-solution.md

### most-frequent-even-inline-tests [IN] OBSERVATION
`most-frequent-even-element/solution.py` contains both the solution function and a `TestMostFrequentEven` unittest class in the same file, unlike the repo's typical pattern of separate `test_solution.py` files.
- Source: entries/2026/06/06/most-frequent-even-element-solution.md

### most-frequent-even-negative-one-sentinel [IN] OBSERVATION
`most_frequent_even` returns `-1` (not `None` or an exception) when the input contains no even numbers — this is the sentinel convention for this problem.
- Source: entries/2026/06/06/most-frequent-even-element-solution.md

### most-frequent-even-tiebreak-smallest [IN] OBSERVATION
When multiple even elements share the highest frequency, `most_frequent_even` returns the numerically smallest via `min(counts, key=lambda x: (-counts[x], x))` — a composite sort key that maximizes count then minimizes value.
- Source: entries/2026/06/06/most-frequent-even-element-solution.md

### most-visited-only-depends-on-endpoints [IN] OBSERVATION
The most-visited-sector solution's correctness relies on intermediate rounds contributing uniform visits to all sectors, so only `rounds[0]` and `rounds[-1]` determine the answer.
- Source: entries/2026/06/06/most-visited-sector-in-a-circular-track-solution.md

### mostWordsFound-empty-list-raises [IN] OBSERVATION
Passing an empty `sentences` list to `mostWordsFound` raises `ValueError` from `max()` because no fallback default is provided.
- Source: entries/2026/06/06/maximum-number-of-words-found-in-sentences-solution.md

### mostWordsFound-single-pass [IN] OBSERVATION
The generator-based `mostWordsFound` iterates through sentences exactly once with O(1) auxiliary space beyond each individual split.
- Source: entries/2026/06/06/maximum-number-of-words-found-in-sentences-solution.md

### mostWordsFound-uses-split-no-args [IN] OBSERVATION
`mostWordsFound` calls `str.split()` without a delimiter, splitting on any whitespace and stripping leading/trailing spaces — not just single spaces.
- Source: entries/2026/06/06/maximum-number-of-words-found-in-sentences-solution.md

### mountain-peak-must-be-interior [IN] OBSERVATION
The valid-mountain-array solution requires the peak index to satisfy `0 < peak < n-1`, rejecting purely monotonic sequences even when both pointers converge.
- Source: entries/2026/06/06/valid-mountain-array-solution.md

### move-zeroes-no-return-value [IN] OBSERVATION
`moveZeroes` returns `None` and mutates the input list in-place; callers must inspect the modified list to observe results.
- Source: entries/2026/06/06/move-zeroes-solution.md

### move-zeroes-stable-ordering [IN] OBSERVATION
Non-zero elements maintain their original relative order after `moveZeroes` completes — the swap-based two-pointer advances the slow pointer only on non-zero encounters, preserving sequence.
- Source: entries/2026/06/06/move-zeroes-solution.md

### move-zeroes-swap-not-overwrite [IN] OBSERVATION
`moveZeroes` uses element swaps (slow/fast pointer) rather than overwriting non-zeros to front and filling zeros after, performing at most n swaps in a single pass with no second fill phase.
- Source: entries/2026/06/06/move-zeroes-solution.md

### moving-avg-eviction-order [IN] OBSERVATION
In `MovingAverage.next()`, the subtraction of the evicted element must happen before `deque.append()` because `append` on a full `maxlen` deque silently discards `_queue[0]`.
- Source: entries/2026/06/06/moving-average-from-data-stream-solution.md

### moving-avg-o1-next [IN] OBSERVATION
`MovingAverage.next()` runs in O(1) time by maintaining a running sum incrementally, avoiding O(k) re-summation of the deque on each call.
- Source: entries/2026/06/06/moving-average-from-data-stream-solution.md

### moving-avg-sum-invariant [IN] OBSERVATION
`self._sum == sum(self._queue)` holds after every `next()` call in `MovingAverage`; if this invariant breaks, all subsequent averages silently return wrong values.
- Source: entries/2026/06/06/moving-average-from-data-stream-solution.md

### multi-digit-counts-supported [IN] OBSERVATION
The digit-scanning loop in `_extract_next` handles arbitrarily large multi-digit counts (e.g., `1000000000`) by scanning consecutive digit characters until a non-digit or end-of-string.
- Source: entries/2026/06/06/design-compressed-string-iterator-solution.md

### multiplication-before-division-ordering [IN] OBSERVATION
In `percentageLetter`, the `count * 100` multiplication happens before the `// len(s)` division — reversing the order would produce 0 for any `count < len(s)` due to integer floor division.
- Source: entries/2026/06/06/percentage-of-letter-in-string-solution.md

### mutable-list-for-string-manipulation [IN] OBSERVATION
Solutions that need character-level string mutation convert to `list()`, mutate in place, then `''.join()` back — the standard Python idiom since strings are immutable.
- Source: entries/2026/06/06/latest-time-by-replacing-hidden-digits-solution.md

### mutable-list-for-string-mutation [IN] OBSERVATION
Solutions that need in-place character modification convert the input string to a `list` via `list(s)`, mutate it, then rejoin with `''.join(chars)` — this avoids O(n²) repeated string concatenation.
- Source: entries/2026/06/06/replace-all-digits-with-characters-solution.md

### mutation-invisible-in-single-call-context [IN] DERIVED
In-place mutation of input arguments (sorting, element swaps, pointer reassignment) has no observable effect beyond the current call because LeetCode's judge invokes each solution exactly once per test case, making aliasing and input reuse irrelevant under the submission model.
- Depends on: in-place-mutation-with-return-convention, no-validation-is-deliberate-contract
- Unless: max-distance-mutates-input, distance-value-mutates-arr2

### n-choose-2-for-pair-counting [IN] OBSERVATION
When counting unordered pairs within groups, solutions apply the combinatorial formula `n*(n-1)//2` per group rather than enumerating pairs, relying on the integer-division-is-exact invariant (one of n, n-1 is always even).
- Source: entries/2026/06/06/count-pairs-of-similar-strings-solution.md

### n-choose-2-pair-counting-formula [IN] OBSERVATION
Pair-counting solutions use `n*(n-1)//2` per frequency group (or the incremental equivalent `count += seen[x]; seen[x] += 1`) rather than enumerating all pairs; integer division is exact because one of two consecutive integers is always even.
- Source: entries/2026/06/06/number-of-equivalent-domino-pairs-solution.md

### n100-yields-682289015 [IN] OBSERVATION
For n=100 (25 primes, 75 non-primes), Prime Arrangements returns 682289015, serving as a regression anchor for the full computation chain including primality counting and modular factorial.
- Source: entries/2026/06/06/prime-arrangements-solution.md

### names-serve-no-functional-role [IN] DERIVED
Function and method names are entirely non-functional in this architecture: naming errors introduced by the generation pipeline remain permanently invisible at runtime, and naming drift across solutions never affects execution — making names purely documentary artifacts with no load-bearing role.
- Source type: derived
- Depends on: generation-errors-remain-invisible, naming-drift-does-not-affect-execution

### naming-drift-does-not-affect-execution [IN] DERIVED
Method name mismatches from copy-paste are invisible at runtime because the test harness imports via module-level aliases bound at the top of each solution file, not via method names on the Solution class.
- Depends on: solution-module-level-alias-convention, isolation-enables-style-drift
- Unless: misnamed-module-exports-in-test-harness

### naming-drift-evidences-co-adaptation-lock [IN] DERIVED
Naming drift serves as empirical evidence that the streaming-isolation co-adaptation lock is actively operating: drift accumulates precisely because streaming's self-sufficiency eliminates functional dependency on correct names, while isolation's zero-coupling eliminates detection mechanisms — the canonical instance of permanently frozen debt is a directly observable trace of the dynamically locked co-adaptation between the dominant paradigm and the architectural pattern.
- Source type: derived
- Depends on: streaming-isolation-co-adaptation-dynamically-locked, naming-drift-is-canonical-frozen-debt

### naming-drift-is-canonical-frozen-debt [IN] DERIVED
Naming drift is the canonical instance of permanently frozen engineering debt: names serve no functional role at any layer of the architecture (neither runtime execution nor test harness depend on semantic correctness of names), while the isolation mechanism that freezes all engineering debt simultaneously ensures naming errors are undetectable without manual inspection — making naming the purest case of a defect that is simultaneously consequenceless and uncorrectable.
- Source type: derived
- Depends on: names-serve-no-functional-role, engineering-debt-permanently-frozen

### naming-drift-is-definitive-immunity-proof [IN] DERIVED
Naming drift serves as the definitive proof of architectural immunity: it is simultaneously the most pervasive engineering defect (affecting multiple solutions systematically via the generation pipeline) and the most completely harmless (names serve zero functional role at any architectural layer), demonstrating that immunity handles even the worst-case defect class — maximum surface area, zero impact.
- Source type: derived
- Depends on: naming-drift-is-canonical-frozen-debt, architecture-immune-to-own-engineering-defects

### naming-drift-is-domain-selection-signature [IN] DERIVED
Naming drift is the empirically observable signature of domain-level quality selection: the domain's fixed-point dynamics select for algorithmic investment over engineering discipline (no force pushes toward fixing names), and naming drift — simultaneously the most pervasive engineering defect and the most harmless (definitive immunity proof) — is the visible residue of that selection, making it the canonical diagnostic for identifying LeetCode-domain quality dynamics in any codebase.
- Source type: derived
- Depends on: naming-drift-is-definitive-immunity-proof, domain-is-fixed-point-of-quality-dynamics

### naming-drift-structurally-inevitable-at-fixed-point [IN] DERIVED
Naming drift is not merely tolerated but structurally inevitable at the streaming fixed point: because the fixed point's four-fold optimality (convergence attractor, algebraic normal form, self-sufficient paradigm, constructive minimal strategy) eliminates all naming infrastructure from the solution space (no imports, no shared interfaces, no cross-module references), naming precision has exactly zero selection pressure at the convergence attractor, guaranteeing drift accumulates monotonically.
- Source type: derived
- Depends on: streaming-fixed-point-of-solution-space, naming-drift-is-domain-selection-signature

### nearest-valid-point-fused-filter-reduce [IN] OBSERVATION
`nearestValidPoint` fuses the validity filter and argmin reduction into a single O(n) pass with O(1) space — no intermediate filtered list, no sorting.
- Source: entries/2026/06/06/find-nearest-point-that-has-the-same-x-or-y-coordinate-solution.md

### nearest-valid-point-no-imports [IN] OBSERVATION
`nearestValidPoint` has zero imports — it uses only Python builtins (`float`, `abs`, `enumerate`), making it fully self-contained.
- Source: entries/2026/06/06/find-nearest-point-that-has-the-same-x-or-y-coordinate-solution.md

### nearest-valid-point-or-means-either-axis [IN] OBSERVATION
A point is valid in `nearestValidPoint` if it shares the x-coordinate OR the y-coordinate with the query (not necessarily both) — an easy-to-misread detail of the problem contract.
- Source: entries/2026/06/06/find-nearest-point-that-has-the-same-x-or-y-coordinate-solution.md

### nearest-valid-point-returns-first-index-on-tie [IN] OBSERVATION
When multiple valid points share the minimum Manhattan distance, `nearestValidPoint` returns the smallest index because it uses strict `<` comparison (first occurrence is kept).
- Source: entries/2026/06/06/find-nearest-point-that-has-the-same-x-or-y-coordinate-solution.md

### negated-max-heap-idiom [IN] OBSERVATION
Max-heap behavior is emulated by negating all values on insertion and negating again on extraction, since Python's `heapq` only provides a min-heap — a standard idiom used across heap-based solutions in this repo.
- Source: entries/2026/06/06/take-gifts-from-the-richest-pile-solution.md

### negation-marking-abs-required [IN] OBSERVATION
In the negation-marking pattern, `abs()` is required when reading a cell's value (as opposed to its sign) because earlier iterations may have negated it; omitting `abs()` would produce negative indices and raise `IndexError`.
- Source: entries/2026/06/06/find-all-numbers-disappeared-in-an-array-solution.md

### negation-marking-idempotent-guard [IN] OBSERVATION
The `if nums[idx] > 0` guard in `find_disappeared_numbers` ensures each index is negated at most once, preventing double-negation by duplicates from restoring a positive sign and producing false "missing" results.
- Source: entries/2026/06/06/find-all-numbers-disappeared-in-an-array-solution.md

### negation-marking-mutates-input [IN] OBSERVATION
`find_disappeared_numbers` destructively modifies the input array via in-place sign flipping; callers cannot reuse `nums` after the call.
- Source: entries/2026/06/06/find-all-numbers-disappeared-in-an-array-solution.md

### negation-marking-requires-1-to-n-range [IN] OBSERVATION
The in-place negation-marking technique only works when values are guaranteed in `[1, n]`, since each value `v` maps to index `v - 1`; values outside this range would cause out-of-bounds access.
- Source: entries/2026/06/06/find-all-numbers-disappeared-in-an-array-solution.md

### negation-trick-requires-integers [IN] OBSERVATION
The tiebreaker `-x` only produces correct descending order for numeric types; applying this pattern to strings or other non-numeric types would fail.
- Source: entries/2026/06/06/sort-array-by-increasing-frequency-solution.md

### negative-one-sentinel-for-max-tracking [IN] OBSERVATION
`largest-number-at-least-twice-of-others/solution.py` initializes `max_val` and `second_max` to -1, which is safe only because the problem constrains values to [0, 1000] — this sentinel would break for problems allowing negative inputs
- Source: entries/2026/06/06/largest-number-at-least-twice-of-others-solution.md

### nested-helpers-are-pure-closures [IN] OBSERVATION
Helper functions nested inside solution methods (e.g., `is_valid` in `countValidWords`, `diff` in `stringWithDifferentDifference`) don't capture mutable state from the enclosing scope — they are pure functions co-located for readability
- Source: entries/2026/06/06/number-of-valid-words-in-a-sentence-solution.md, entries/2026/06/06/odd-string-difference-solution.md

### net-shift-collapse [IN] OBSERVATION
All individual shift operations are collapsed into a single net displacement before any string manipulation, making the solution O(n + k) rather than O(n * total_shift_amount).
- Source: entries/2026/06/06/perform-string-shifts-solution.md

### next-valid-terminates [IN] OBSERVATION
`_next_valid` in backspace-string-compare always terminates because the `index` variable strictly decreases on every iteration of its while loop, and the loop exits when `index < 0`.
- Source: entries/2026/06/06/backspace-string-compare-solution.md

### nge-linear-time [IN] OBSERVATION
`next_greater_element` runs in O(n + m) time where n = len(nums2) and m = len(nums1), because each element of nums2 is pushed and popped from the stack at most once (amortized analysis).
- Source: entries/2026/06/06/next-greater-element-i-solution.md

### nge-precompute-then-query [IN] OBSERVATION
`next_greater_element` separates into two phases: a single O(n) pass over nums2 using a monotonic stack to build the full next-greater mapping, then O(1)-per-element dict lookups for each query in nums1.
- Source: entries/2026/06/06/next-greater-element-i-solution.md

### nge-stack-monotonic-decreasing [IN] OBSERVATION
The stack invariant in the Next Greater Element solution is strictly decreasing from bottom to top; the while loop pops all values smaller than the incoming element before pushing, enforcing this at every step.
- Source: entries/2026/06/06/next-greater-element-i-solution.md

### nge-unique-elements-assumed [IN] OBSERVATION
The dict-keyed-by-value approach in `next_greater_element` is correct only because the problem guarantees all elements are unique; duplicate values would cause silent overwrites of earlier mappings.
- Source: entries/2026/06/06/next-greater-element-i-solution.md

### nibble-extraction-produces-lsb-first [IN] OBSERVATION
The hex conversion loop extracts digits from least-significant to most-significant nibble, collecting them in reverse order and requiring a final `reversed()` call.
- Source: entries/2026/06/06/convert-a-number-to-hexadecimal-solution.md

### nice-substring-divide-conquer-split-correctness [IN] OBSERVATION
Splitting on a character whose case-counterpart is absent is sound: that character cannot appear in any nice substring, so the answer lies entirely in one of the two halves.
- Source: entries/2026/06/06/longest-nice-substring-solution.md

### nice-substring-left-bias-on-tie [IN] OBSERVATION
`longestNiceSubstring` uses `>=` when comparing left vs right result lengths, ensuring the earliest (leftmost) substring wins on equal length, matching LeetCode's tie-breaking requirement.
- Source: entries/2026/06/06/longest-nice-substring-solution.md

### nice-substring-worst-case-quadratic [IN] OBSERVATION
The divide-and-conquer approach is O(n^2) worst case when every split produces one empty and one n-1 partition (analogous to quicksort's worst case); best case is O(n log n) with balanced splits.
- Source: entries/2026/06/06/longest-nice-substring-solution.md

### nim-game-constant-complexity [IN] OBSERVATION
`canWinNim` is O(1) time and O(1) space — a single modulo operation — which is necessary because n can be up to 2^31 - 1, making DP infeasible.
- Source: entries/2026/06/06/nim-game-solution.md

### nim-game-mod4-characterization [IN] OBSERVATION
The first player wins Nim (1–3 stones per turn) if and only if `n % 4 != 0`; this is a complete characterization derived from the Sprague-Grundy theorem, not heuristic.
- Source: entries/2026/06/06/nim-game-solution.md

### no-bounds-violation-on-overshoot [IN] OBSERVATION
When a number in `abbr` exceeds the remaining length of `word`, `i` overshoots `len(word)` and the final `i == len(word)` check catches it without raising an `IndexError`.
- Source: entries/2026/06/06/valid-word-abbreviation-solution.md

### no-child-gets-four-dollars [IN] OBSERVATION
The `others == 1 and leftover == 3` branch in distribute-money specifically prevents the remaining child from receiving exactly $4, which the problem forbids.
- Source: entries/2026/06/06/distribute-money-to-maximum-children-solution.md

### no-consistency-enforcement-at-any-level [IN] DERIVED
The repo lacks any mechanism — shared imports, linters, templates, or conventions — for enforcing consistency in naming, testing, or structure across problem directories, making style drift an inevitable structural property rather than an oversight.
- Depends on: isolation-enables-style-drift, test-colocation-dual-mode-inconsistent, duplication-over-shared-infrastructure

### no-cross-problem-dependencies [IN] OBSERVATION
Each solution directory is fully self-contained; despite tooling artifacts showing large "Imported By" lists, no solution module imports from another problem's directory.
- Source: entries/2026/06/06/number-of-strings-that-appear-as-substrings-in-word-solution.md

### no-cross-problem-imports [IN] OBSERVATION
Each problem's `test_solution.py` imports only its own `solution.py`; the large "Imported By" lists in code-expert output are artifacts of the tooling, not real Python import edges
- Source: entries/2026/06/06/check-if-string-is-a-prefix-of-array-solution.md

### no-external-dependencies-in-solutions [IN] OBSERVATION
Solution files import only from the Python standard library (`unittest`, `typing`). No external packages are used anywhere in the solution code.
- Source: entries/2026/06/06/minimum-recolors-to-get-k-consecutive-black-blocks-solution.md

### no-full-house-distinction [IN] OBSERVATION
`best_poker_hand` uses `max_freq >= 3` which collapses Full House and Three of a Kind into the same classification, matching the problem's simplified hand ranking.
- Source: entries/2026/06/06/best-poker-hand-solution.md

### no-input-validation-convention [IN] OBSERVATION
Solutions trust their callers to provide valid inputs within problem constraints; no range checking, type validation, or defensive error handling is performed beyond what the algorithm structurally requires.
- Source: entries/2026/06/06/convert-integer-to-the-sum-of-two-no-zero-integers-solution.md

### no-input-validation-in-solutions [IN] OBSERVATION
Solution methods perform no input validation or bounds checking, relying entirely on LeetCode's guaranteed constraints; invalid inputs propagate standard Python exceptions.
- Source: entries/2026/06/06/check-if-word-equals-summation-of-two-words-solution.md, entries/2026/06/06/check-whether-two-strings-are-almost-equivalent-solution.md

### no-input-validation-pattern [IN] OBSERVATION
Solution functions consistently omit input validation (bounds checking, type checking, error handling), relying on the LeetCode harness to satisfy problem constraints — this is deliberate, not an oversight
- Source: entries/2026/06/06/number-of-common-factors-solution.md

### no-input-validation-trusts-leetcode-contract [IN] OBSERVATION
Solutions do not validate input preconditions (sorted arrays, valid tree nodes, binary values) — they rely on LeetCode's guarantee that inputs conform to the problem statement.
- Source: entries/2026/06/06/binary-search-solution.md

### no-post-loop-fixup-needed [IN] OBSERVATION
Because `checkZeroOnes` updates the max inside the loop on every iteration (not only at run transitions), the final run's length is always reflected in the result without a trailing adjustment
- Source: entries/2026/06/06/longer-contiguous-segments-of-ones-than-zeros-solution.md

### no-runtime-input-validation [IN] OBSERVATION
Solutions do not validate input at runtime — they trust LeetCode's guaranteed constraints, and invalid input propagates native Python exceptions (`ValueError`, `TypeError`).
- Source: entries/2026/06/06/alternating-digit-sum-solution.md

### no-shared-node-class [IN] OBSERVATION
Each solution directory defines its own `Node`/`TreeNode` class rather than importing from a shared module — tree structure definitions are duplicated per problem.
- Source: entries/2026/06/06/n-ary-tree-postorder-traversal-solution.md

### no-simulation-needed [IN] OBSERVATION
The most-visited-sector function never iterates through the `rounds` array beyond reading the first and last elements, making it O(n) in sectors rather than O(len(rounds) * n).
- Source: entries/2026/06/06/most-visited-sector-in-a-circular-track-solution.md

### no-sqrt-dependency [IN] OBSERVATION
`is_perfect_square` satisfies the LeetCode constraint of not using any built-in square root or exponentiation function; it relies only on integer multiplication and comparison.
- Source: entries/2026/06/06/valid-perfect-square-solution.md

### no-stdlib-date-in-date-problems [IN] OBSERVATION
Date-related solutions (days-between-dates, days-in-a-month) implement Gregorian calendar arithmetic from scratch without importing `datetime` or `calendar`, since hand-rolling the math is the intended constraint
- Source: entries/2026/06/06/number-of-days-between-two-dates-solution.md

### no-stdlib-date-parsing [IN] OBSERVATION
The reformat-date solution avoids `datetime` entirely, relying on manual string splitting and dictionary lookup.
- Source: entries/2026/06/06/reformat-date-solution.md

### no-two-pair-distinction [IN] OBSERVATION
`best_poker_hand` checks only `max_freq == 2`, so Two Pair and One Pair both return `"Pair "` — the problem defines no Two Pair category.
- Source: entries/2026/06/06/best-poker-hand-solution.md

### no-validation-is-deliberate-contract [IN] DERIVED
The universal absence of input validation is a deliberate architectural choice — solutions define their correctness boundary at LeetCode's stated constraints and are not intended to handle inputs outside that boundary.
- Depends on: solutions-no-input-validation, no-input-validation-convention, solutions-trust-leetcode-preconditions, leetcode-solutions-no-validation-convention

### no-zero-integers-returns-smallest-a [IN] OBSERVATION
`no_zero_integers` returns the pair with the smallest possible first element, scanning `a` upward from 1 and returning on first match, making the output deterministic.
- Source: entries/2026/06/06/convert-integer-to-the-sum-of-two-no-zero-integers-solution.md

### no-zero-invariant [IN] OBSERVATION
The `min(a,b)*10 + max(a,b)` formula in `smallest_number_with_at_least_one_digit_from_each_array` assumes digits are 1-9; a zero in either array would produce an incorrect single-digit result instead of a two-digit number.
- Source: entries/2026/06/06/form-smallest-number-from-two-digit-arrays-solution.md

### node-children-default-empty-list [IN] OBSERVATION
`Node.__init__` in n-ary tree solutions avoids Python's mutable default argument pitfall by using `None` as the default parameter and replacing with `[]` inside the constructor body.
- Source: entries/2026/06/06/n-ary-tree-postorder-traversal-solution.md

### non-alpha-positional-invariant [IN] OBSERVATION
In the Reverse Only Letters solution, non-alphabetic characters are guaranteed to remain at their original indices — the two-pointer loop only swaps when both pointers point at `isalpha()` characters.
- Source: entries/2026/06/06/reverse-only-letters-solution.md

### non-binary-input-silent-miscount [IN] OBSERVATION
In `checkZeroOnes`, characters other than `"1"` are silently counted toward `max_zeros`, since the only branch check is `c == "1"`
- Source: entries/2026/06/06/longer-contiguous-segments-of-ones-than-zeros-solution.md

### nonlocal-accumulator-pattern [IN] OBSERVATION
The diameter solution uses a nested `height` closure that captures and mutates an outer `diameter` variable via `nonlocal`, computing height as the return value while accumulating the diameter as a side effect — a pattern that also appears in other tree problems like binary-tree-tilt.
- Source: entries/2026/06/06/diameter-of-binary-tree-solution.md

### null-root-returns-empty-list [IN] OBSERVATION
All tree traversal solutions return `[]` (not `None` or an error) when given a null/None root, enforced by early guard clauses or loop conditions that short-circuit naturally.
- Source: entries/2026/06/06/binary-tree-preorder-traversal-solution.md

### null-subroot-is-always-subtree [IN] OBSERVATION
`isSubtree(any_root, None)` returns `True`, matching the LeetCode contract that an empty tree is a subtree of any tree
- Source: entries/2026/06/06/subtree-of-another-tree-solution.md

### numofstrings-pure-function [IN] OBSERVATION
`numOfStrings` is a pure function: no side effects, no mutation of inputs, deterministic output for any given input.
- Source: entries/2026/06/06/number-of-strings-that-appear-as-substrings-in-word-solution.md

### o1-space-via-running-accumulators [IN] DERIVED
Multiple solutions achieve O(1) auxiliary space by maintaining scalar running-state variables (min-so-far, running-sum, running-max) instead of materializing intermediate arrays or sorted copies.
- Depends on: highest-altitude-single-pass, longest-task-single-pass-o1-space, iterative-reversal-O1-space, min-tracking-pattern-shared

### odd-cells-counting-over-simulation [IN] OBSERVATION
`oddCells` uses the counting-not-simulation pattern: since each cell's value equals `row_count[r] + col_count[c]`, it computes frequencies then uses combinatorics instead of applying increments to a matrix.
- Source: entries/2026/06/06/cells-with-odd-values-in-a-matrix-solution.md

### odd-cells-linear-time [IN] OBSERVATION
`oddCells` runs in O(|indices| + m + n) time — one pass to count frequencies, one pass to count parities — independent of the matrix area m*n.
- Source: entries/2026/06/06/cells-with-odd-values-in-a-matrix-solution.md

### odd-cells-no-matrix-materialization [IN] OBSERVATION
`oddCells` never allocates an m-by-n matrix; it uses O(m+n) row/column frequency arrays, reducing space from O(m*n) to O(m+n).
- Source: entries/2026/06/06/cells-with-odd-values-in-a-matrix-solution.md

### odd-cells-xor-parity-formula [IN] OBSERVATION
A cell (r,c) has an odd value iff exactly one of `row_count[r]` and `col_count[c]` is odd; the return formula `odd_rows*(n-odd_cols) + (m-odd_rows)*odd_cols` computes this via two disjoint terms with no overlap.
- Source: entries/2026/06/06/cells-with-odd-values-in-a-matrix-solution.md

### odd-count-two-branch [IN] OBSERVATION
The odd-counts solution uses exactly two code paths: all-same-char for odd n, two-char split for even n
- Source: entries/2026/06/06/generate-a-string-with-characters-that-have-odd-counts-solution.md

### odd-index-reads-even-no-write-hazard [IN] OBSERVATION
In `replaceDigits`, each odd-index replacement reads from the preceding even index, which is never modified by the loop — so iteration order cannot affect correctness.
- Source: entries/2026/06/06/replace-all-digits-with-characters-solution.md

### odd-k-residual-cost [IN] OBSERVATION
When leftover k is odd after flipping all negatives, the sum penalty is exactly `2 * min(nums)` applied to the already-mutated (all-non-negative) array.
- Source: entries/2026/06/06/maximize-sum-of-array-after-k-negations-solution.md

### odd-string-exactly-one-outlier-assumed [IN] OBSERVATION
`stringWithDifferentDifference` assumes exactly one word has a unique difference array; if zero are unique it returns `""`, if multiple are unique it returns only the first — the problem guarantees this won't happen
- Source: entries/2026/06/06/odd-string-difference-solution.md

### odd-subarray-count-formula [IN] OBSERVATION
Element at index `i` in an array of length `n` appears in exactly `((i+1)*(n-i)+1)//2` odd-length subarrays, derived from total subarray count `(i+1)*(n-i)` with ceiling division by 2
- Source: entries/2026/06/06/sum-of-all-odd-length-subarrays-solution.md

### one-liner-pipeline-pattern [IN] OBSERVATION
Easy-level solutions frequently use a composable pipeline of built-in string/list operations in a single return statement (e.g., split → transform → join) with no intermediate variables.
- Source: entries/2026/06/06/reverse-words-in-a-string-iii-solution.md

### one-mismatch-always-false [IN] OBSERVATION
Exactly one positional mismatch between two strings is never fixable by a single swap because a swap always changes two positions simultaneously
- Source: entries/2026/06/06/check-if-one-string-swap-can-make-strings-equal-solution.md

### one-problem-per-directory [IN] OBSERVATION
Each problem gets its own directory containing at minimum a `solution.py` and `test_solution.py`, with optional `plan.md` and `review.md` files.
- Source: entries/2026/06/06/count-days-spent-together-solution.md

### op1-discriminates-all-operations [IN] OBSERVATION
In `max_value`, the character at index 1 is `"+"` for both increment forms (`"++X"`, `"X++"`) and `"-"` for both decrement forms, making `op[1]` a sufficient discriminator without string matching.
- Source: entries/2026/06/06/final-value-of-variable-after-performing-operations-solution.md

### ord-offset-letter-to-digit-pattern [IN] OBSERVATION
The `ord(c) - ord('a')` idiom for mapping lowercase letters to integer positions recurs across multiple solutions (summation-of-two-words, decode-the-message, replace-all-digits).
- Source: entries/2026/06/06/check-if-word-equals-summation-of-two-words-solution.md

### ord-offset-produces-multichar-strings [IN] OBSERVATION
The mapping `ord(c) - ord('a') + 1` produces values 10–26 for letters j–z, which concatenate as multi-character substrings — this is why the first phase builds a string rather than extracting digits per character.
- Source: entries/2026/06/06/sum-of-digits-of-string-after-convert-solution.md

### ordered-stream-amortized-linear [IN] OBSERVATION
Total pointer movement across all n `insert` calls on `OrderedStream` is O(n), making each insert O(1) amortized despite the inner while loop.
- Source: entries/2026/06/06/design-an-ordered-stream-solution.md

### ordered-stream-none-sentinel [IN] OBSERVATION
`OrderedStream` uses `None` as the sentinel for unfilled slots — inserting `None` as a value would break the contiguity scan, causing it to stop prematurely.
- Source: entries/2026/06/06/design-an-ordered-stream-solution.md

### ordered-stream-pointer-monotonic [IN] OBSERVATION
`OrderedStream.ptr` only increases; once a value is returned from an `insert` call it is never returned again, and slots below the pointer are logically consumed.
- Source: entries/2026/06/06/design-an-ordered-stream-solution.md

### ordinal-arithmetic-for-letter-indexing [IN] OBSERVATION
Solutions use `ord(ch) - ord('a')` to map lowercase letters to indices 0–25 rather than using a dictionary, a standard LeetCode idiom used across the repo
- Source: entries/2026/06/06/number-of-lines-to-write-string-solution.md

### overflow-safe-midpoint-convention [IN] OBSERVATION
Binary search solutions use `left + (right - left) // 2` instead of `(left + right) // 2` as a consistent idiom across the repo, borrowed from C/Java overflow safety even though Python has arbitrary-precision integers.
- Source: entries/2026/06/06/binary-search-solution.md

### overflow-safe-midpoint-idiom [IN] OBSERVATION
`guessNumber` computes midpoint as `low + (high - low) // 2` rather than `(low + high) // 2` — unnecessary in Python but signals awareness of the integer overflow pitfall and is used idiomatically across the repo.
- Source: entries/2026/06/06/guess-number-higher-or-lower-solution.md

### overlap-is-conjunction-of-axis-projections [IN] OBSERVATION
2D rectangle overlap is decomposed into the conjunction of independent 1D overlap checks on the x-axis and y-axis — a reusable geometric pattern.
- Source: entries/2026/06/06/rectangle-overlap-solution.md

### overlapping-ranges-idempotent-marking [IN] OBSERVATION
In the range-coverage solution, overlapping intervals simply re-mark already-True positions in the boolean array — no deduplication or merging step is needed because marking is idempotent.
- Source: entries/2026/06/06/check-if-all-the-integers-in-a-range-are-covered-solution.md

### pad-then-slice-idiom [IN] OBSERVATION
divide-a-string normalizes input length before slicing rather than special-casing the last group — `(k - len(s) % k) % k` computes minimal padding, and uniform stride-k slicing produces all groups.
- Source: entries/2026/06/06/divide-a-string-into-groups-of-size-k-solution.md

### pairs-iff-even-counts [IN] OBSERVATION
An array can be divided into equal pairs if and only if every distinct element has an even frequency — the divide-array-into-equal-pairs solution checks `count % 2 == 0` for all Counter values.
- Source: entries/2026/06/06/divide-array-into-equal-pairs-solution.md

### pairs-leftovers-conservation [IN] OBSERVATION
`count_pairs_leftovers` guarantees the invariant `pairs * 2 + leftovers == len(nums)` — every element is accounted for exactly once as either paired or left over.
- Source: entries/2026/06/06/maximum-number-of-pairs-in-array-solution.md

### pairwise-inequality-for-fixed-window [IN] OBSERVATION
For the size-3 sliding window, three explicit pairwise `!=` checks are used instead of `len(set(window)) == 3` — a micro-optimization that avoids set construction
- Source: entries/2026/06/06/substrings-of-size-three-with-distinct-characters-solution.md

### palindrome-case-sensitive [IN] OBSERVATION
`longestPalindrome` treats uppercase and lowercase as distinct characters — `'A'` and `'a'` do not form pairs — matching the LeetCode problem spec.
- Source: entries/2026/06/06/longest-palindrome-solution.md

### palindrome-center-bonus-at-most-once [IN] OBSERVATION
`longestPalindrome` adds at most one center character regardless of how many characters have odd frequencies, using a boolean flag converted to int via Python's `bool` subclassing `int`.
- Source: entries/2026/06/06/longest-palindrome-solution.md

### palindrome-check-uses-slice-reversal [IN] OBSERVATION
Palindrome detection uses `word == word[::-1]`, creating a full reversed copy (O(m) space) rather than a two-pointer in-place comparison.
- Source: entries/2026/06/06/find-first-palindromic-string-in-the-array-solution.md

### palindrome-construction-reduces-to-frequency-parity [IN] DERIVED
Palindrome construction and permutation problems in the repo uniformly reduce to frequency-parity analysis: a string can form a palindrome iff at most one character has odd frequency, the longest constructible palindrome sums even portions of each frequency plus at most one center character, and the actual count values are discarded in favor of their parity — the palindrome property is entirely determined by the parity signature of the character frequency distribution.
- Source type: derived
- Depends on: palindrome-perm-at-most-one-odd, palindrome-greedy-even-portions, palindrome-center-bonus-at-most-once, palindrome-perm-parity-reduction

### palindrome-greedy-even-portions [IN] OBSERVATION
`longestPalindrome` computes the result by summing `count // 2 * 2` for each character frequency, extracting the largest even number ≤ count, plus 1 if any odd count exists.
- Source: entries/2026/06/06/longest-palindrome-solution.md

### palindrome-instantiates-hash-then-stream [IN] DERIVED
Palindrome construction and permutation problems are specific instantiations of the hash-then-stream pipeline: Counter builds the frequency map in O(n) preprocessing, then a single-pass parity check over frequencies determines constructibility — the same two-phase structure that governs the broader pipeline taxonomy.
- Source type: derived
- Depends on: palindrome-construction-reduces-to-frequency-parity, hash-preprocessing-universal-first-step

### palindrome-is-canonical-counter-pipeline-exemplar [IN] DERIVED
Palindrome problems serve as the canonical exemplar of the full Counter-to-pipeline reduction chain: Counter construction from string (algebraic construction), frequency extraction (algebraic measurement), parity reduction (algebraic projection), and threshold aggregation (streaming accumulation) — exercising every layer of the hash-then-stream pipeline within a single problem class and demonstrating how Counter's algebraic completeness flows through the pipeline architecture.
- Source type: derived
- Depends on: palindrome-instantiates-hash-then-stream, counter-is-complete-multiset-algebra

### palindrome-ll-mutates-input [IN] OBSERVATION
`isPalindrome` reverses the second half of the linked list in-place and does not restore it — after the call returns, the original list structure is permanently altered
- Source: entries/2026/06/06/palindrome-linked-list-solution.md

### palindrome-ll-o1-space-via-mutation [IN] OBSERVATION
`isPalindrome` achieves O(1) extra space by mutating the list in-place (fast/slow pointer to find midpoint, then in-place reversal) rather than copying values to an array
- Source: entries/2026/06/06/palindrome-linked-list-solution.md

### palindrome-ll-p2-terminates-comparison [IN] OBSERVATION
The comparison loop iterates until `p2` (reversed second half) is `None`, not `p1`, because the reversed half is always <= the first half in length (middle node stays with first half for odd-length lists)
- Source: entries/2026/06/06/palindrome-linked-list-solution.md

### palindrome-ll-slow-pointer-guard [IN] OBSERVATION
The `while fast.next and fast.next.next` guard places `slow` at the last node of the first half — using the alternative `while fast and fast.next` would overshoot by one node and break the split
- Source: entries/2026/06/06/palindrome-linked-list-solution.md

### palindrome-num-half-reversal-technique [IN] OBSERVATION
`is_palindrome` reverses only the second half of the digits and compares to the first half — the loop `while x > reversed_half` naturally stops at the midpoint, avoiding full reversal and potential overflow
- Source: entries/2026/06/06/palindrome-number-solution.md

### palindrome-num-no-string-conversion [IN] OBSERVATION
The palindrome number solution uses only integer arithmetic (`%`, `//`, `*`) — no `str()`, slicing, or string comparison, satisfying the problem's implicit constraint
- Source: entries/2026/06/06/palindrome-number-solution.md

### palindrome-num-trailing-zero-early-exit [IN] OBSERVATION
Non-zero integers ending in 0 are rejected in O(1) before the reversal loop — a palindrome with trailing zeros would require leading zeros, which is impossible
- Source: entries/2026/06/06/palindrome-number-solution.md

### palindrome-num-zero-is-palindrome [IN] OBSERVATION
The input `0` correctly returns `True` — the trailing-zero guard has an explicit carve-out (`x != 0`) so zero is not falsely rejected
- Source: entries/2026/06/06/palindrome-number-solution.md

### palindrome-perm-at-most-one-odd [IN] OBSERVATION
`canPermutePalindrome` returns `True` iff at most one character in `s` has an odd frequency count
- Source: entries/2026/06/06/palindrome-permutation-solution.md

### palindrome-perm-empty-string-true [IN] OBSERVATION
An empty string input returns `True` (zero odd counts <= 1)
- Source: entries/2026/06/06/palindrome-permutation-solution.md

### palindrome-perm-linear-time [IN] OBSERVATION
The solution runs in O(n) time and O(k) space where k is the alphabet size, dominated by `Counter` construction
- Source: entries/2026/06/06/palindrome-permutation-solution.md

### palindrome-perm-parity-reduction [IN] OBSERVATION
The solution reduces character frequencies to their parity (odd/even) via `c % 2`, discarding actual counts — a common idiom in palindrome problems
- Source: entries/2026/06/06/palindrome-permutation-solution.md

### palindrome-reversal-adapts-across-data-domains [IN] DERIVED
Palindrome detection implements the same core insight — reverse and compare — across three data domains, each adapting the reversal mechanism to its representation: string slice reversal creates a full copy (O(n) space), integer half-reversal compares digits without string conversion (O(1) space), and linked list in-place reversal reuses existing nodes (O(1) space via mutation).
- Source type: derived
- Depends on: palindrome-check-uses-slice-reversal, palindrome-num-half-reversal-technique, palindrome-ll-o1-space-via-mutation

### pancakeSort-is-test-harness-alias [IN] OBSERVATION
`pancakeSort = bitwiseComplement` is a class-level alias, not a separate implementation; it exists so the repo's test harness can call a consistent method name across all solution files regardless of the actual LeetCode method signature.
- Source: entries/2026/06/06/complement-of-base-10-integer-solution.md

### pangram-method-name-mismatch [IN] OBSERVATION
The pangram solution (`check-if-the-sentence-is-pangram/solution.py`) names its method `min_operations` instead of `checkIfPangram` — a copy-paste artifact that doesn't break tests because the harness calls whatever method is defined on `Solution`.
- Source: entries/2026/06/06/check-if-the-sentence-is-pangram-solution.md

### parent-context-threading-via-parameter [IN] OBSERVATION
`sum_of_left_leaves` passes an `is_left` boolean down the recursion so each node knows its relationship to its parent, rather than using the parent-look-ahead pattern where the parent checks `node.left.left is None`.
- Source: entries/2026/06/06/sum-of-left-leaves-solution.md

### parity-ii-in-place-mutation [IN] OBSERVATION
The `possible_bipartition` method mutates and returns the input list; callers holding a reference to the original list see the changes.
- Source: entries/2026/06/06/sort-array-by-parity-ii-solution.md

### parity-ii-linear-time [IN] OBSERVATION
The parity-II algorithm runs in O(n) time and O(1) extra space via two stride-2 pointers that each traverse at most n/2 elements.
- Source: entries/2026/06/06/sort-array-by-parity-ii-solution.md

### parity-ii-method-name-mismatch [IN] OBSERVATION
The parity-II solution method is named `possible_bipartition` rather than the LeetCode canonical `sortArrayByParityII`, likely a naming artifact from generation tooling.
- Source: entries/2026/06/06/sort-array-by-parity-ii-solution.md

### parity-ii-swap-correctness [IN] OBSERVATION
A swap only occurs when `nums[i]` is odd and `nums[j]` is even, guaranteeing both positions are fixed simultaneously.
- Source: entries/2026/06/06/sort-array-by-parity-ii-solution.md

### parity-slot-preservation-invariant [IN] OBSERVATION
In `largest-number-after-digit-swaps-by-parity/solution.py`, the output digit at every position has the same odd/even parity as the input digit at that position — enforced by dual-pointer reconstruction from separate sorted pools
- Source: entries/2026/06/06/largest-number-after-digit-swaps-by-parity-solution.md

### partial-week-starts-at-full-weeks-plus-1 [IN] OBSERVATION
The first day of the leftover partial week deposits `full_weeks + 1` (the 1-indexed week number), not `full_weeks`.
- Source: entries/2026/06/06/calculate-money-in-leetcode-bank-solution.md

### pascal-boundary-by-prefill [IN] OBSERVATION
Boundary values (first and last element of each row = 1) are set by pre-filling with `[1] * (i + 1)`, not by conditional logic
- Source: entries/2026/06/06/pascals-triangle-solution.md

### pascal-generate-pure [IN] OBSERVATION
`generate` is a pure function with no side effects, no imports, and no mutation of external state
- Source: entries/2026/06/06/pascals-triangle-solution.md

### pascal-inner-loop-safe [IN] OBSERVATION
The inner loop `range(1, i)` guarantees all `triangle[i-1]` lookups are in-bounds without explicit bounds checking
- Source: entries/2026/06/06/pascals-triangle-solution.md

### pascal-zero-rows-returns-empty [IN] OBSERVATION
Calling `generate(0)` returns `[]` since the outer loop range is empty, even though this is outside the stated LeetCode constraints
- Source: entries/2026/06/06/pascals-triangle-solution.md

### pascals-triangle-ii-inplace-dp-pattern [IN] OBSERVATION
The reverse-traversal in-place mutation is the same space-optimization pattern used in 0/1 knapsack and other DP problems that reduce 2D state to 1D
- Source: entries/2026/06/06/pascals-triangle-ii-solution.md

### pascals-triangle-ii-reverse-traversal [IN] OBSERVATION
The inner loop must traverse right-to-left; left-to-right would use already-updated values and produce incorrect results
- Source: entries/2026/06/06/pascals-triangle-ii-solution.md

### pascals-triangle-ii-row-zero-correct [IN] OBSERVATION
For `row_index=0`, the loop body never executes and `[1]` is returned, which is correct
- Source: entries/2026/06/06/pascals-triangle-ii-solution.md

### pascals-triangle-ii-space-linear [IN] OBSERVATION
The solution uses O(row_index) space by mutating a single list in place rather than building all prior rows
- Source: entries/2026/06/06/pascals-triangle-ii-solution.md

### password-checker-no-short-circuit-on-flags [IN] OBSERVATION
The validation loop cannot short-circuit even after all four category flags are `True`, because every adjacent pair must still be checked for duplicate characters
- Source: entries/2026/06/06/strong-password-checker-ii-solution.md

### password-checker-special-char-independent-if [IN] OBSERVATION
The special-character membership test is a standalone `if` (not part of the `elif` chain for lower/upper/digit), ensuring characters like space that fail all three category tests are still recognized as special
- Source: entries/2026/06/06/strong-password-checker-ii-solution.md

### password-checker-specials-include-space [IN] OBSERVATION
The special characters set is `"!@#$%^&*()-+ "` which includes the space character, matching the LeetCode problem specification
- Source: entries/2026/06/06/strong-password-checker-ii-solution.md

### path-crossing-directions-rebuilt-per-call [IN] OBSERVATION
The directions dict mapping characters to displacement vectors is a local variable inside `path_crossing`, rebuilt on every invocation rather than hoisted to module scope.
- Source: entries/2026/06/06/path-crossing-solution.md

### path-crossing-early-exit [IN] OBSERVATION
`path_crossing` returns `True` on the first revisited coordinate via early return, skipping the rest of the path.
- Source: entries/2026/06/06/path-crossing-solution.md

### path-crossing-no-validation [IN] OBSERVATION
Invalid direction characters (anything not in N/S/E/W) raise an uncaught `KeyError` from the directions dict lookup — no input validation exists.
- Source: entries/2026/06/06/path-crossing-solution.md

### path-crossing-origin-seeded [IN] OBSERVATION
The visited set is seeded with (0,0) before any steps, so returning to the origin counts as a path crossing.
- Source: entries/2026/06/06/path-crossing-solution.md

### path-crossing-set-based-visited [IN] OBSERVATION
Revisit detection uses a set of coordinate tuples for O(1) membership checks — the standard pattern for cycle/revisit detection on grids in this repo.
- Source: entries/2026/06/06/path-crossing-solution.md

### path-sum-leaf-only-matching [IN] OBSERVATION
`hasPathSum` only returns `True` when the matching path ends at a leaf node (both children `None`); internal nodes whose cumulative sum equals the target are explicitly rejected.
- Source: entries/2026/06/06/path-sum-solution.md

### path-sum-null-always-false [IN] OBSERVATION
`hasPathSum(None, targetSum)` returns `False` for any `targetSum` including 0 — an empty tree has no paths.
- Source: entries/2026/06/06/path-sum-solution.md

### path-sum-self-contained-module [IN] OBSERVATION
`path-sum/solution.py` defines `TreeNode`, the solution function, and the full test suite (`TestPathSum` with 9 cases) in a single file.
- Source: entries/2026/06/06/path-sum-solution.md

### path-sum-short-circuit-or [IN] OBSERVATION
The `or` in the recursive return skips exploration of the right subtree entirely if the left subtree already found a valid path.
- Source: entries/2026/06/06/path-sum-solution.md

### path-sum-subtraction-pattern [IN] OBSERVATION
The algorithm subtracts each node's value from the remaining target rather than accumulating a running sum, avoiding an extra accumulator parameter.
- Source: entries/2026/06/06/path-sum-solution.md

### per-problem-data-structure-isolation [IN] OBSERVATION
Each problem directory defines its own data structures (e.g., `TreeNode` in `sum-of-left-leaves`) rather than importing from a shared utility module, maintaining per-problem self-containment.
- Source: entries/2026/06/06/sum-of-left-leaves-solution.md

### per-problem-directory-layout [IN] OBSERVATION
Each LeetCode problem lives in its own directory containing `solution.py`, `test_solution.py`, `plan.md`, and `review.md` as the standard file set.
- Source: entries/2026/06/06/largest-unique-number-solution.md

### percentage-floor-integer-arithmetic [IN] OBSERVATION
`percentageLetter` computes floor percentage using `count * 100 // len(s)`, avoiding floating-point entirely to prevent rounding artifacts.
- Source: entries/2026/06/06/percentage-of-letter-in-string-solution.md

### percentage-no-empty-string-guard [IN] OBSERVATION
`percentageLetter` has no guard against empty-string input and will raise `ZeroDivisionError` — it relies on LeetCode's constraint that `len(s) >= 1`.
- Source: entries/2026/06/06/percentage-of-letter-in-string-solution.md

### perfect-number-dedup-guard [IN] OBSERVATION
The `i != num // i` check prevents double-counting the square root divisor when `num` is a perfect square.
- Source: entries/2026/06/06/perfect-number-solution.md

### perfect-number-seed-one [IN] OBSERVATION
The divisor sum is seeded at 1 (since 1 is always a proper divisor for `num > 1`), and the loop starts at 2, avoiding a special case inside the loop.
- Source: entries/2026/06/06/perfect-number-solution.md

### perfect-number-sqrt-complexity [IN] OBSERVATION
`checkPerfectNumber` runs in O(sqrt(n)) time and O(1) space by harvesting paired divisors from a loop up to `isqrt(num)`.
- Source: entries/2026/06/06/perfect-number-solution.md

### perfect-number-uses-isqrt [IN] OBSERVATION
`checkPerfectNumber` uses `math.isqrt` instead of `int(math.sqrt(n))` to avoid floating-point precision loss for large integers near 2^53.
- Source: entries/2026/06/06/perfect-number-solution.md

### perform-string-shifts-empty-crash [IN] OBSERVATION
Passing an empty string to `inorder` raises `ZeroDivisionError` at `net %= len(s)` — no guard exists.
- Source: entries/2026/06/06/perform-string-shifts-solution.md

### pigeonhole-26-letter-bound [IN] OBSERVATION
The first-letter-to-appear-twice loop executes at most 27 iterations regardless of string length, since 26 lowercase letters force a collision by the 27th character via the pigeonhole principle.
- Source: entries/2026/06/06/first-letter-to-appear-twice-solution.md

### pillow-holder-o1-time [IN] OBSERVATION
`pillowHolder` runs in O(1) time and space regardless of the `time` input, using division and modulo instead of simulation
- Source: entries/2026/06/06/pass-the-pillow-solution.md

### pillow-holder-parity-direction [IN] OBSERVATION
Even `full_passes` means forward direction (returns `1 + remainder`), odd means backward (returns `n - remainder`)
- Source: entries/2026/06/06/pass-the-pillow-solution.md

### pillow-holder-zero-indexed-cycle [IN] OBSERVATION
The cycle length is `n - 1` (not `n`), representing the number of hand-offs per pass, not the number of people
- Source: entries/2026/06/06/pass-the-pillow-solution.md

### ping-window-boundary-inclusive [IN] OBSERVATION
In the recent-calls solution (problem 933), the eviction condition `self.q[0] < t - 3000` keeps timestamps equal to `t - 3000` in the window, making both endpoints of `[t-3000, t]` inclusive
- Source: entries/2026/06/06/number-of-recent-calls-solution.md

### pipeline-generates-misnamed-functions [IN] OBSERVATION
At least two solutions have function names from unrelated LeetCode problems due to copy-paste errors in the code generation pipeline: `longestAwesomeSubstring` solves problem 1668 (not 1542), and `busiest_servers` solves problem 1710 (not 1606).
- Source: entries/2026/06/06/maximum-repeating-substring-solution.md

### pivot-index-accumulate-after-check [IN] OBSERVATION
In `pivotIndex`, `left_sum += num` occurs *after* the equality check — this ordering is a critical invariant ensuring the pivot element is excluded from both the left and right sums.
- Source: entries/2026/06/06/find-pivot-index-solution.md

### pivot-index-boundary-no-special-case [IN] OBSERVATION
Index 0 and index n-1 are valid pivot positions without special-case code because `left_sum` starts at 0 and the right sum is computed algebraically — empty-side sums are implicitly zero.
- Source: entries/2026/06/06/find-pivot-index-solution.md

### pivot-index-leftmost-guarantee [IN] OBSERVATION
`pivotIndex` returns the leftmost valid pivot index via early return on first match, not just any valid pivot.
- Source: entries/2026/06/06/find-pivot-index-solution.md

### pivot-index-right-sum-derived-algebraically [IN] OBSERVATION
`pivotIndex` never computes the right sum directly; it derives it as `total - left_sum - nums[i]`, enabling O(n) time and O(1) space with a single pass after the initial `sum()`.
- Source: entries/2026/06/06/find-pivot-index-solution.md

### pivot-integer-closed-form-o1 [IN] OBSERVATION
`find_pivot` reduces the problem to checking whether `n*(n+1)/2` is a perfect square, yielding O(1) time and space with no loops or recursion.
- Source: entries/2026/06/06/find-the-pivot-integer-solution.md

### pivot-integer-isqrt-not-sqrt [IN] OBSERVATION
`find_pivot` uses `math.isqrt` (integer square root) instead of `math.sqrt` to avoid floating-point precision bugs that surface with `int(math.sqrt(n))` for large perfect squares.
- Source: entries/2026/06/06/find-the-pivot-integer-solution.md

### plate-parsing-ignores-non-alpha [IN] OBSERVATION
Only alphabetic characters from `licensePlate` contribute to the required letter counts; digits and spaces are filtered by `isalpha()` and letters are lowercased at parse time, while `words` are assumed already lowercase.
- Source: entries/2026/06/06/shortest-completing-word-solution.md

### popcount-via-bin-count [IN] OBSERVATION
The codebase uses `bin(n).count('1')` as its standard popcount idiom rather than Kernighan's bit-clearing loop or Python 3.10+'s `int.bit_count()`.
- Source: entries/2026/06/06/minimum-bit-flips-to-convert-number-solution.md

### postorder-accumulator-pattern [IN] OBSERVATION
Tree problems in this repo use a recurring idiom: a postorder DFS function returns one value (e.g., subtree sum, height) while accumulating a second aggregate (e.g., tilt, diameter) into a `nonlocal` closure variable.
- Source: entries/2026/06/06/binary-tree-tilt-solution.md

### postorder-uses-reverse-preorder [IN] OBSERVATION
The n-ary postorder traversal computes a modified preorder (root-right-left via stack) and reverses the result, rather than using recursion or visited-node tracking.
- Source: entries/2026/06/06/n-ary-tree-postorder-traversal-solution.md

### power-of-four-constant-time [IN] OBSERVATION
`isPowerOfFour` runs in O(1) time and O(1) space with no loops, recursion, or library calls.
- Source: entries/2026/06/06/power-of-four-solution.md

### power-of-four-mask-32bit [IN] OBSERVATION
The mask `0x55555555` only covers bit positions 0–30, so the power-of-four solution assumes n fits in a 32-bit signed integer (matching the LeetCode constraint).
- Source: entries/2026/06/06/power-of-four-solution.md

### power-of-four-subset-of-power-of-two [IN] OBSERVATION
The first two conditions in `isPowerOfFour` (`n > 0` and `n & (n-1) == 0`) are exactly the power-of-two check; the third condition (`n & 0x55555555 != 0`) narrows from powers-of-two to powers-of-four by requiring the set bit at an even position.
- Source: entries/2026/06/06/power-of-four-solution.md

### power-of-three-32bit-assumption [IN] OBSERVATION
The power-of-three solution is only correct for inputs in [-2^31, 2^31-1]; any power of 3 exceeding 3^19 (e.g., 3^20) would incorrectly return `False`.
- Source: entries/2026/06/06/power-of-three-solution.md

### power-of-three-magic-constant [IN] OBSERVATION
The constant 1162261467 equals 3^19, the largest power of 3 below 2^31, and is load-bearing for correctness — if the input domain expanded beyond 32-bit signed integers, this constant would need to change.
- Source: entries/2026/06/06/power-of-three-solution.md

### power-of-three-prime-dependency [IN] OBSERVATION
The divisibility trick (`3^19 % n == 0` implies n is a power of 3) is valid only because 3 is prime; applying the same pattern to a composite base would produce false positives since composite powers have non-power divisors.
- Source: entries/2026/06/06/power-of-three-solution.md

### power-of-two-bit-trick [IN] OBSERVATION
`n & (n - 1) == 0` detects positive integers with exactly one set bit (powers of two); this is a foundational kernel reused in power-of-four and referenced by number-of-1-bits (Brian Kernighan's algorithm) across the repo.
- Source: entries/2026/06/06/power-of-two-solution.md

### power-of-two-rejects-zero [IN] OBSERVATION
The `n > 0` guard in `is_power_of_two` is necessary because `0 & (0 - 1)` equals `0`, which would incorrectly pass the single-set-bit test.
- Source: entries/2026/06/06/power-of-two-solution.md

### power-of-x-positivity-guard [IN] OBSERVATION
All three power-of-X solutions (two, three, four) share an `n > 0` guard as their first short-circuit condition, since no non-positive integer is a power of any positive base — and each would fail differently without it (false positive for zero in power-of-two, ZeroDivisionError in power-of-three).
- Source: entries/2026/06/06/power-of-two-solution.md

### precompute-then-transfer-partition-idiom [IN] OBSERVATION
`max_score_after_splitting` uses a precompute-then-transfer pattern: initialize the right-side count to the full-string total, then "transfer" elements to the left side as the partition sweeps right, achieving O(n) time instead of O(n^2) re-counting.
- Source: entries/2026/06/06/maximum-score-after-splitting-a-string-solution.md

### predictability-is-itself-stable [IN] DERIVED
The system's quantitative predictability is itself a stable property (meta-stability): the two predictive relationships (abstraction overhead predicts convergence strength; judge reward signal predicts defense investment) are invariant because the quality equilibrium that generates them is doubly locked at every granularity — the predictors cannot drift because the underlying quality dynamics are at a fixed point, making the system not just predictable but reliably predictable across time.
- Source type: derived
- Depends on: systematic-behavior-quantitatively-predictable, quality-stasis-at-every-granularity

### prefix-count-difference-pattern [IN] OBSERVATION
The formula `f(high) - f(low - 1)` is used to count elements satisfying a predicate in a range by subtracting prefix counts, as seen in `count_odds` where `(high+1)//2 - low//2` computes odds in `[low, high]`.
- Source: entries/2026/06/06/count-odd-numbers-in-an-interval-range-solution.md

### prefix-match-requires-word-boundary [IN] OBSERVATION
`is_prefix_string` only returns `True` when `s` aligns exactly with a word boundary in `words`; partial word matches are rejected because equality is checked after appending whole words
- Source: entries/2026/06/06/check-if-string-is-a-prefix-of-array-solution.md

### preorder-reversed-children-for-left-to-right [IN] OBSERVATION
The n-ary preorder traversal pushes `reversed(node.children)` onto the stack so that LIFO pop order yields left-to-right child visitation — the mirror of postorder's `extend(children)` approach.
- Source: entries/2026/06/06/n-ary-tree-preorder-traversal-solution.md

### preorder-right-before-left-push-order [IN] OBSERVATION
In iterative preorder traversal, the right child is pushed onto the stack before the left child so that LIFO ordering produces the correct root-left-right visit sequence.
- Source: entries/2026/06/06/binary-tree-preorder-traversal-solution.md

### preprocess-then-stream-is-canonical-pipeline [IN] DERIVED
The dominant two-phase algorithmic pipeline is: build a hash structure (Counter for frequencies, set for membership) in O(n) preprocessing, then consume it via single-pass streaming with O(1) accumulators — combining the repo's two most pervasive patterns into one archetypal shape.
- Depends on: hash-preprocessing-universal-first-step, single-pass-streaming-dominant-shape

### preprocessing-is-domain-transformation-to-streaming [IN] DERIVED
The canonical pipeline's preprocessing phase functions as a domain adapter: it converts problems from domains where streaming alone may be insufficient (such as ordering-dependent or frequency-queried problems) into a form where single-traversal accumulation can produce correct results. This suggests that many non-streaming solutions can be understood as streaming with a preprocessing step prepended, since the single-traversal accumulation paradigm appears universal across data structures.
- Depends on: traversal-accumulation-universal-across-data-structures, preprocess-then-stream-is-canonical-pipeline

### prev-sentinel-assumes-positive [IN] OBSERVATION
`is_increasing_skip` initializes `prev = -1` as a sentinel, which is correct only because the problem guarantees `nums[i] >= 1` — this would silently break on inputs containing non-positive values.
- Source: entries/2026/06/06/remove-one-element-to-make-the-array-strictly-increasing-solution.md

### prev-zero-sentinel [IN] OBSERVATION
In `count_binary_substrings`, `prev` starts at 0 so the first group boundary contributes zero substrings via `min(0, curr)`, correctly handling the absence of a preceding group.
- Source: entries/2026/06/06/count-binary-substrings-solution.md

### prime-arrangements-factorial-decomposition [IN] OBSERVATION
The answer to Prime Arrangements equals `factorial(prime_count) * factorial(non_prime_count) mod 10^9+7`, because primes must occupy prime indices and non-primes must occupy non-prime indices — two independent permutation groups.
- Source: entries/2026/06/06/prime-arrangements-solution.md

### product-init-one-not-zero [IN] OBSERVATION
The product accumulator in `subtract_product_and_sum` starts at 1 (multiplicative identity); starting at 0 would make the product always 0 regardless of input
- Source: entries/2026/06/06/subtract-the-product-and-sum-of-digits-of-an-integer-solution.md

### property-based-tests-for-multi-answer-problems [IN] OBSERVATION
When a problem has multiple valid outputs, tests assert structural invariants (e.g., no consecutive repeats, preserved non-placeholder characters) rather than pinning to a specific expected string.
- Source: entries/2026/06/06/replace-all-s-to-avoid-consecutive-repeating-characters-solution.md

### pure-function-convention [IN] OBSERVATION
Solution methods are typically stateless pure functions with no side effects and no instance state; the `Solution` class exists solely to satisfy LeetCode's submission format.
- Source: entries/2026/06/06/convert-the-temperature-solution.md

### python-int-drops-leading-zeros-safely [IN] OBSERVATION
String-accumulator digit-splitting relies on Python's `int()` silently dropping leading zeros, so inputs with zero digits (e.g., 2030) need no special handling
- Source: entries/2026/06/06/split-with-minimum-sum-solution.md

### python-modulo-floor-semantics [IN] OBSERVATION
The `net %= len(s)` normalization relies on Python's floor-modulo semantics where `(-2) % 5 == 3` — this would produce different results in C/Java, which use truncated division.
- Source: entries/2026/06/06/perform-string-shifts-solution.md

### python-negative-mod-safe-for-circular [IN] OBSERVATION
Python's `%` operator guarantees non-negative results for positive divisors, so `(i - j) % n` correctly handles backward circular wrapping without an explicit bounds check — used in defuse-the-bomb and applicable to all circular-array solutions.
- Source: entries/2026/06/06/defuse-the-bomb-solution.md

### python-no-overflow-gauss-sum [IN] OBSERVATION
The Gauss sum approach in `missing-number/solution.py` has no overflow risk in Python due to arbitrary-precision integers, unlike equivalent C++/Java implementations where `n*(n+1)` can exceed fixed-width integer bounds.
- Source: entries/2026/06/06/missing-number-solution.md

### python-stdlib-preferred-over-manual-algorithms [IN] DERIVED
Solutions systematically delegate computation to Python standard library abstractions — str() for digit extraction, Counter for frequency counting, set for deduplication, bin().count() for popcount — rather than implementing equivalent arithmetic or bitwise logic manually.
- Depends on: string-over-arithmetic-for-digit-ops, counter-universal-frequency-primitive

### quality-equilibrium-self-reinforcing [IN] DERIVED
The repo's quality profile (high algorithmic sophistication, low engineering discipline) is a self-reinforcing equilibrium: the submission-optimized architecture makes engineering quality invisible to the judge, removing the feedback signal that would drive improvement, while algorithmic quality receives immediate accept/reject feedback — quality flows toward measurement, and the absence of measurement guarantees stasis.
- Depends on: quality-inversion-algorithmic-vs-engineering, inconsistency-is-invisible-because-submission-optimized

### quality-inversion-algorithmic-vs-engineering [IN] DERIVED
The repo exhibits a quality asymmetry: algorithmic sophistication (convergent paradigms, exact arithmetic) tends to be high while engineering discipline (naming, structure) tends to be low. This pattern is consistent with LeetCode's judge selecting primarily for correctness rather than maintainability, though other factors may also contribute.
- Depends on: algorithmic-coherence-emerges-without-engineering, algorithmic-precision-despite-engineering-neglect

### quality-inversion-structurally-inseparable [IN] DERIVED
The quality inversion (high algorithmic sophistication, low engineering discipline) is reinforced by the same construction-plus-isolation mechanism that eliminates defensive code: construction-based correctness removes runtime validation while submission-optimized isolation removes cross-module contracts, together producing lean, algorithmically coherent solutions that lack the cross-solution coupling where engineering conventions would normally develop — suggesting that improving engineering quality would likely require introducing structure that partially counteracts the isolation enabling algorithmic focus.
- Depends on: construction-and-isolation-jointly-eliminate-defensive-code, quality-inversion-algorithmic-vs-engineering

### quality-profile-doubly-locked [IN] DERIVED
The repo's quality profile (high algorithmic sophistication, low engineering discipline) is locked by two independent mechanisms operating at different structural levels: structural inseparability means the same mechanisms produce both algorithmic quality and engineering neglect (so changing one changes the other), while the self-reinforcing equilibrium means the submission-optimized feedback loop perpetuates both sides independently of structure — neither incremental improvement nor structural refactoring alone can alter the quality balance.
- Depends on: quality-inversion-structurally-inseparable, quality-equilibrium-self-reinforcing

### quality-stasis-at-every-granularity [IN] DERIVED
The repo is in quality stasis at every granularity: the macro-level quality profile (high algorithmic sophistication, low engineering discipline) is doubly locked by domain selection and self-reinforcing equilibrium, while micro-level engineering debts (naming drift, convention inconsistency, style divergence) are individually frozen by the submission-optimized architecture's inability to surface them.
- Source type: derived
- Depends on: engineering-debt-permanently-frozen, quality-profile-doubly-locked

### quarter-gap-proves-frequency-in-sorted-array [IN] OBSERVATION
In a sorted array, `arr[i] == arr[i + len(arr)//4]` proves that element appears at least `len(arr)//4 + 1` times, because all values between those indices must be identical.
- Source: entries/2026/06/06/element-appearing-more-than-25-in-sorted-array-solution.md

### queue-order-irrelevance [IN] OBSERVATION
The correctness of `countStudents` relies on the insight that queue rotation changes when a student eats but not whether they eat; any student of the matching type will eventually rotate to the front.
- Source: entries/2026/06/06/number-of-students-unable-to-eat-lunch-solution.md

### racecar-is-misnamed [IN] OBSERVATION
The function `racecar` in `rectangle-overlap/solution.py` implements rectangle overlap (LC 836), not the racecar problem (LC 818); the name is a bug, likely from a code generation pipeline.
- Source: entries/2026/06/06/rectangle-overlap-solution.md

### range-addition-ii-empty-ops-returns-full-matrix [IN] OBSERVATION
When `ops` is empty, `maxCount` returns `m * n` because all cells are zero and thus all share the maximum value
- Source: entries/2026/06/06/range-addition-ii-solution.md

### range-addition-ii-ignores-matrix-dimensions-with-ops [IN] OBSERVATION
When `ops` is non-empty, the parameters `m` and `n` are unused — the result depends solely on the minimum first and second elements across operations
- Source: entries/2026/06/06/range-addition-ii-solution.md

### range-addition-ii-reduces-to-min [IN] OBSERVATION
`maxCount` runs in O(len(ops)) time and O(1) space by reducing the problem to `min(ai) * min(bi)` — the matrix is never allocated
- Source: entries/2026/06/06/range-addition-ii-solution.md

### range-bounds-inclusive [IN] OBSERVATION
In `range_sum_bst`, both `low` and `high` are included in the sum because the pruning comparisons use strict `<` and `>`, so nodes equal to either bound fall into the in-range branch
- Source: entries/2026/06/06/range-sum-of-bst-solution.md

### rank-map-is-o-n-log-n [IN] OBSERVATION
The ranking solution's time complexity is O(n log n) dominated by `sorted()`; the dict construction is O(k) and lookup per element is O(1) amortized
- Source: entries/2026/06/06/rank-transform-of-an-array-solution.md

### rank-preserves-original-order [IN] OBSERVATION
The output of `arrayRankTransform` maintains index correspondence with the input array — only values are replaced with their ranks
- Source: entries/2026/06/06/rank-transform-of-an-array-solution.md

### rank-uses-dense-ranking [IN] OBSERVATION
`arrayRankTransform` produces dense ranks with no gaps: if k unique values exist, ranks span exactly [1, k], as opposed to competition ranking (1,2,2,4) or ordinal ranking (1,2,3,4)
- Source: entries/2026/06/06/rank-transform-of-an-array-solution.md

### read4-adapter-inheritance-pattern [IN] OBSERVATION
`Solution` extends `Reader4` to access the `read4` API, mirroring LeetCode's convention for "given an API" problems where the solution class inherits the provided interface.
- Source: entries/2026/06/06/read-n-characters-given-read4-solution.md

### rearrange-spaces-preserves-space-count [IN] OBSERVATION
The output of `reorderSpaces` always contains exactly the same number of space characters as the input — spaces are redistributed, never created or destroyed.
- Source: entries/2026/06/06/rearrange-spaces-between-words-solution.md

### rearrange-spaces-single-word-trailing [IN] OBSERVATION
When the input contains exactly one word, all spaces are placed after the word (not before), as a special case handled before the `divmod` distribution logic.
- Source: entries/2026/06/06/rearrange-spaces-between-words-solution.md

### recursive-reversal-On-stack [IN] OBSERVATION
`reverse_list_recursive` makes one recursive call per node, so stack depth equals list length — lists over ~1000 nodes risk hitting Python's default recursion limit.
- Source: entries/2026/06/06/reverse-linked-list-solution.md

### redistribute-chars-counter-update-avoids-concatenation [IN] OBSERVATION
Using `Counter.update` in a loop avoids allocating a single concatenated string, keeping peak memory proportional to unique characters rather than total characters.
- Source: entries/2026/06/06/redistribute-characters-to-make-all-strings-equal-solution.md

### redistribute-chars-divisibility-is-necessary-and-sufficient [IN] OBSERVATION
The check `all(count % n == 0)` is both necessary and sufficient for redistribution because characters can move freely between any two strings.
- Source: entries/2026/06/06/redistribute-characters-to-make-all-strings-equal-solution.md

### redistribute-chars-linear-time [IN] OBSERVATION
The function runs in O(C) time where C is the total number of characters across all words, plus O(U) for the final check where U is the number of unique characters.
- Source: entries/2026/06/06/redistribute-characters-to-make-all-strings-equal-solution.md

### redistribute-chars-no-input-validation [IN] OBSERVATION
The function performs no input validation and will raise `ZeroDivisionError` if called with an empty list, relying on LeetCode's guarantee that `words` is non-empty.
- Source: entries/2026/06/06/redistribute-characters-to-make-all-strings-equal-solution.md

### reduce-empty-guard-required [IN] OBSERVATION
`reduce(or_, nums)` with no initializer raises `TypeError` on an empty list; the early-return guard in `subsetXORSum` is load-bearing, not defensive.
- Source: entries/2026/06/06/sum-of-all-subset-xor-totals-solution.md

### reduce-gcd-no-initializer [IN] OBSERVATION
The x-of-a-kind solution calls `reduce(gcd, counts)` without an initial value, meaning an empty deck would raise `TypeError` — safe under LeetCode constraints but not defensively coded.
- Source: entries/2026/06/06/x-of-a-kind-in-a-deck-of-cards-solution.md

### reduction-hierarchy-reflects-domain-quality-gradient [IN] DERIVED
The complete three-tier reduction hierarchy (mathematical reduction → streaming → preprocessing pipeline) mirrors the domain's quality fixed point along its algorithmic axis: the judge reward signal creates an implicit preference gradient favoring solutions closer to the mathematical-reduction end (O(1) > O(n) > O(n log n)), while the quality dynamics simultaneously freeze engineering discipline at every tier, producing a sophistication gradient in the algorithmic dimension with no corresponding gradient in the engineering dimension — the hierarchy is domain-shaped, not developer-shaped.
- Source type: derived
- Depends on: solution-reduction-forms-complete-hierarchy, domain-is-fixed-point-of-quality-dynamics

### reformat-impossible-iff-diff-gt-1 [IN] OBSERVATION
`reformat` returns `""` if and only if the count of letters and digits differ by more than 1.
- Source: entries/2026/06/06/reformat-the-string-solution.md

### reformat-longer-group-gets-even-indices [IN] OBSERVATION
After the swap, the longer group always occupies even-indexed positions (0, 2, 4, ...) in the output.
- Source: entries/2026/06/06/reformat-the-string-solution.md

### reformat-no-block-of-one [IN] OBSERVATION
The loop guard `len(digits) - i > 4` ensures the tail is never a single digit, so no output block has size 1.
- Source: entries/2026/06/06/reformat-phone-number-solution.md

### reformat-output-is-deterministic [IN] OBSERVATION
For a given input, `reformat` always produces the same permutation (no randomness), though it may not match LeetCode's expected output since any valid interleaving is accepted.
- Source: entries/2026/06/06/reformat-the-string-solution.md

### reformat-tail-split-at-four [IN] OBSERVATION
When exactly 4 digits remain, they are split into two blocks of 2 (not 3+1 or a single 4).
- Source: entries/2026/06/06/reformat-phone-number-solution.md

### reformat-variable-names-misleading-after-swap [IN] OBSERVATION
After the swap at line 21, `letters` may contain digit characters and `digits` may contain letter characters; the names reflect initial assignment, not post-swap content.
- Source: entries/2026/06/06/reformat-the-string-solution.md

### relative-ranks-argsort-pattern [IN] OBSERVATION
`find_relative_ranks` uses the argsort idiom (`sorted(range(n), key=lambda i: score[i])`) to map ranks back to original positions without building intermediate tuples.
- Source: entries/2026/06/06/relative-ranks-solution.md

### relative-ranks-medal-threshold [IN] OBSERVATION
Exactly the first three places (0, 1, 2) receive medal strings; place 3 onward receives `str(place + 1)`.
- Source: entries/2026/06/06/relative-ranks-solution.md

### relative-ranks-no-tie-handling [IN] OBSERVATION
The function assumes all scores are unique; duplicate scores would receive arbitrary distinct ranks based on Python's stable sort order, with no explicit tie-breaking.
- Source: entries/2026/06/06/relative-ranks-solution.md

### relative-ranks-time-complexity [IN] OBSERVATION
The function runs in O(n log n) time dominated by the sort, with O(n) auxiliary space.
- Source: entries/2026/06/06/relative-ranks-solution.md

### relative-sort-assumes-arr2-subset-of-arr1 [IN] OBSERVATION
`relativeSortArray` calls `count.pop(x)` without a default — if `arr2` contains a value absent from `arr1`, it raises `KeyError` with no fallback.
- Source: entries/2026/06/06/relative-sort-array-solution.md

### relative-sort-preserves-multiplicity [IN] OBSERVATION
The Counter-based reconstruction guarantees every element from `arr1` appears in the output exactly as many times as in the input; no loss or duplication is possible.
- Source: entries/2026/06/06/relative-sort-array-solution.md

### relative-sort-uses-counter-pop-partition [IN] OBSERVATION
`Counter.pop` during the `arr2` traversal both retrieves element counts and removes keys, partitioning elements into "ordered" and "remainder" groups in a single pass without a separate set lookup.
- Source: entries/2026/06/06/relative-sort-array-solution.md

### remaining-invariant [IN] OBSERVATION
The remaining counter equals sum(count) at every point in sortString execution, ensuring the drain loop terminates exactly when all characters are consumed.
- Source: entries/2026/06/06/increasing-decreasing-string-solution.md

### remove-digit-no-input-validation [IN] OBSERVATION
`max_number_after_remove_digit` assumes `digit` appears at least once in `number`; if absent, `last` remains `-1` and the fallback silently truncates the wrong character.
- Source: entries/2026/06/06/remove-digit-from-number-to-maximize-result-solution.md

### remove-dupes-assumes-sorted [IN] OBSERVATION
`removeDuplicates` only compares against the last written element; it silently produces incorrect results on unsorted input with no validation or error.
- Source: entries/2026/06/06/remove-duplicates-from-sorted-array-solution.md

### remove-dupes-compare-against-write-head [IN] OBSERVATION
Uniqueness is checked via `nums[i] != nums[k-1]` (last written value), not `nums[i] != nums[i-1]` (previous read position) — both work on sorted input but the write-head form generalizes to the Remove Duplicates II variant.
- Source: entries/2026/06/06/remove-duplicates-from-sorted-array-solution.md

### remove-duplicates-no-dependencies [IN] OBSERVATION
The `remove-all-adjacent-duplicates-in-string` solution module has zero imports and depends only on Python builtins (`list`, `str.join`).
- Source: entries/2026/06/06/remove-all-adjacent-duplicates-in-string-solution.md

### remove-duplicates-stack-invariant [IN] OBSERVATION
In `removeDuplicates`, the stack never contains two identical adjacent characters at any point during execution, guaranteeing the result is fully reduced in a single pass.
- Source: entries/2026/06/06/remove-all-adjacent-duplicates-in-string-solution.md

### remove-element-uses-stable-compaction [IN] OBSERVATION
`removeElement` preserves the relative order of retained elements; it does not use the swap-to-end optimization (which would be unstable).
- Source: entries/2026/06/06/remove-element-solution.md

### remove-element-write-never-exceeds-read [IN] OBSERVATION
In `removeElement`, the write pointer `k` satisfies `k <= i` at all times, so the copy `nums[k] = nums[i]` never overwrites an unread element — this is the safety invariant that makes in-place compaction correct.
- Source: entries/2026/06/06/remove-element-solution.md

### remove-elements-no-advance-on-match [IN] OBSERVATION
When `remove_elements` deletes a node, the cursor does not advance — it re-inspects the new `curr.next`, ensuring consecutive matching nodes are all removed in sequence.
- Source: entries/2026/06/06/remove-linked-list-elements-solution.md

### repeated-division-terminates [IN] OBSERVATION
The `while n: n //= k` loop terminates in O(log_k(n)) iterations for k >= 2 because integer division by k >= 2 strictly decreases a positive n toward zero.
- Source: entries/2026/06/06/sum-of-digits-in-base-k-solution.md

### repeated-n-times-early-return [IN] OBSERVATION
`repeated_n_times` returns inside the loop body with no post-loop return; it relies on the problem guarantee that a duplicate always exists, and returns `None` implicitly if called with all-unique input.
- Source: entries/2026/06/06/n-repeated-element-in-size-2n-array-solution.md

### repeated-n-times-linear-time [IN] OBSERVATION
`repeated_n_times` runs in O(n) time and O(n) space using set-based duplicate detection with early termination.
- Source: entries/2026/06/06/n-repeated-element-in-size-2n-array-solution.md

### repeated-n-times-pigeonhole-bound [IN] OBSERVATION
In a 2n-length array where one value repeats n times, the pigeonhole principle guarantees a duplicate is found within the first n+1 elements during a linear scan.
- Source: entries/2026/06/06/n-repeated-element-in-size-2n-array-solution.md

### repo-dfs-naming-convention [IN] OBSERVATION
Solutions in this repo export a function named `dfs` regardless of the actual algorithm used; this is a repo-wide convention that the test harness depends on, not a description of the algorithm.
- Source: entries/2026/06/06/lucky-numbers-in-a-matrix-solution.md

### repo-each-problem-dir-is-independent [IN] OBSERVATION
Each problem directory contains a self-contained `solution.py` that defines all needed types (e.g., `TreeNode`) locally rather than importing from a shared module.
- Source: entries/2026/06/06/search-in-a-binary-search-tree-solution.md

### repo-function-naming-bug [IN] OBSERVATION
The closest-to-zero solution exports `robot_instructions` instead of a problem-appropriate name, suggesting a code-generation naming bug that may be shared across the repo.
- Source: entries/2026/06/06/find-closest-number-to-zero-solution.md

### repo-generator-counting-idiom [IN] OBSERVATION
Multiple solutions use `sum(pred(x) for x in iterable)` as the standard conditional counting pattern, exploiting Python's `True == 1` coercion and avoiding intermediate list allocation.
- Source: entries/2026/06/06/counting-words-with-a-given-prefix-solution.md

### repo-imported-by-is-misleading [IN] OBSERVATION
The "Imported By" cross-reference lists in file exploration output reflect test files importing their own local `solution.py`, not actual cross-module dependencies — each solution is consumed only by its own `test_solution.py`.
- Source: entries/2026/06/06/counting-words-with-a-given-prefix-solution.md

### repo-imported-by-lists-are-artifacts [IN] OBSERVATION
The "Imported By" lists reported by the analysis tooling are misleading — they reflect shared imports (like `unittest` or `typing.List`) across the repo, not actual dependencies on each solution's functions
- Source: entries/2026/06/06/slowest-key-solution.md

### repo-imported-by-lists-are-misleading [IN] OBSERVATION
The "Imported By" lists in code-expert prompts overcount: hundreds of test files appear because they share similar import patterns, but each `test_solution.py` only imports from its own co-located `solution.py`.
- Source: entries/2026/06/06/search-insert-position-solution.md

### repo-imported-by-unreliable [IN] OBSERVATION
The repo's dependency scanner produces misleading "Imported By" lists — it flags hundreds of test files as importing a given solution when they actually import their own `solution.py`; only each problem's own `test_solution.py` is a real consumer.
- Source: entries/2026/06/06/path-crossing-solution.md

### repo-mixes-class-and-function-styles [IN] OBSERVATION
Some solutions use a `Solution` class with LeetCode method signatures (e.g., `countPairs`, `countGoodTriplets`) while others use bare module-level functions (e.g., `distinct_numbers`, `min_moves`, `count_hills_and_valleys`) — the repo has no single convention.
- Source: entries/2026/06/06/count-equal-and-divisible-pairs-in-an-array-solution.md

### repo-mixes-function-and-class-conventions [IN] OBSERVATION
Some solutions expose a bare function named after the problem slug in snake_case (e.g., `determine_if_string_halves_are_alike`, `has_event_conflict`), while others wrap the solver in a `Solution` class (e.g., `Solution.findRotation`, `Solution.diStringMatch`, `diameter_of_binary_tree`); the convention is not uniform across the repo.
- Source: entries/2026/06/06/determine-if-string-halves-are-alike-solution.md, entries/2026/06/06/determine-whether-matrix-can-be-obtained-by-rotation-solution.md, entries/2026/06/06/di-string-match-solution.md

### repo-modules-are-self-contained [IN] OBSERVATION
Each problem directory contains a standalone `solution.py` with both the algorithm and its unit tests; there are no cross-problem import dependencies.
- Source: entries/2026/06/06/convert-1d-array-into-2d-array-solution.md

### repo-modules-self-contained [IN] OBSERVATION
Each problem directory is a self-contained module — types like `TreeNode` are defined locally rather than imported from a shared location, and there are no cross-problem runtime imports.
- Source: entries/2026/06/06/find-all-the-lonely-nodes-solution.md

### repo-most-solutions-skip-input-validation [IN] OBSERVATION
The dominant pattern across solutions is to trust LeetCode's input guarantees and omit validation; `smallest-even-multiple` is a notable exception that validates type and range
- Source: entries/2026/06/06/smallest-even-multiple-solution.md

### repo-no-cross-problem-imports [IN] OBSERVATION
Each problem directory is self-contained; solution files never import from other problem directories, and the "Imported By" lists across the repo are test-infrastructure artifacts, not real cross-problem dependencies.
- Source: entries/2026/06/06/truncate-sentence-solution.md, entries/2026/06/06/two-furthest-houses-with-different-colors-solution.md, entries/2026/06/06/two-out-of-three-solution.md, entries/2026/06/06/two-sum-iii-data-structure-design-solution.md, entries/2026/06/06/two-sum-iv-input-is-a-bst-solution.md

### repo-no-input-validation [IN] OBSERVATION
Solutions trust LeetCode's input constraints and perform no defensive validation; correctness relies on problem guarantees rather than runtime checks.
- Source: entries/2026/06/06/truncate-sentence-solution.md, entries/2026/06/06/two-furthest-houses-with-different-colors-solution.md, entries/2026/06/06/two-sum-iii-data-structure-design-solution.md

### repo-one-problem-per-directory [IN] OBSERVATION
Each LeetCode problem is isolated in its own directory with a consistent structure: `solution.py`, `test_solution.py`, `review.md`, `plan.md`.
- Source: entries/2026/06/06/rotate-string-solution.md

### repo-optimized-for-submission-not-engineering [IN] DERIVED
The repo's architecture is entirely submission-throughput-optimized: solutions are correct for the LeetCode judge but neither reusable nor internally consistent, as no enforcement mechanism exists at any level for naming, testing, or structural conventions.
- Depends on: leetcode-judge-optimized-not-reusable, no-consistency-enforcement-at-any-level

### repo-per-problem-directory-convention [IN] OBSERVATION
Each LeetCode problem lives in its own directory containing at least a `solution.py` and `test_solution.py`, forming a self-contained module.
- Source: entries/2026/06/06/binary-search-solution.md

### repo-problem-dirs-self-contained [IN] OBSERVATION
Each problem directory is fully independent — no solution imports symbols from another problem's directory, despite misleading cross-references in the code-expert "imported by" output
- Source: entries/2026/06/06/number-of-valid-words-in-a-sentence-solution.md, entries/2026/06/06/occurrences-after-bigram-solution.md, entries/2026/06/06/palindrome-linked-list-solution.md

### repo-single-file-solution-and-tests [IN] OBSERVATION
Each problem directory contains a single `solution.py` with both the `Solution` class (or standalone function) and a `unittest.TestCase` subclass — no separate test files required to run coverage
- Source: entries/2026/06/06/number-of-valid-words-in-a-sentence-solution.md, entries/2026/06/06/occurrences-after-bigram-solution.md, entries/2026/06/06/odd-string-difference-solution.md, entries/2026/06/06/palindrome-linked-list-solution.md, entries/2026/06/06/palindrome-number-solution.md

### repo-single-function-per-solution [IN] OBSERVATION
Each solution file exports exactly one public function (or one `Solution` class with one method), matching LeetCode's function signature adapted to the repo's snake_case convention.
- Source: entries/2026/06/06/counting-words-with-a-given-prefix-solution.md

### repo-solution-and-tests-colocated [IN] OBSERVATION
Solution classes and unit tests coexist in the same `solution.py` file with an `if __name__ == "__main__"` guard, following a repo-wide convention.
- Source: entries/2026/06/06/two-furthest-houses-with-different-colors-solution.md, entries/2026/06/06/two-sum-iv-input-is-a-bst-solution.md

### repo-solution-test-convention [IN] OBSERVATION
Each problem directory contains `solution.py` with the solution class/function and `test_solution.py` with tests; some solution files also include inline `unittest` suites runnable via `__main__`.
- Source: entries/2026/06/06/reformat-date-solution.md, entries/2026/06/06/reformat-the-string-solution.md

### repo-solutions-are-pure-stdlib [IN] OBSERVATION
All four solutions examined use no external dependencies — pure Python stdlib only (at most `collections.Counter`, `typing`, `unittest`)
- Source: entries/2026/06/06/two-sum-solution.md

### repo-solutions-stdlib-only [IN] OBSERVATION
Solutions import only from the Python standard library (`unittest`, `typing`, `collections`, `annotations`) — no external packages are used anywhere in the repo
- Source: entries/2026/06/06/number-of-valid-words-in-a-sentence-solution.md, entries/2026/06/06/occurrences-after-bigram-solution.md, entries/2026/06/06/odd-string-difference-solution.md, entries/2026/06/06/palindrome-linked-list-solution.md, entries/2026/06/06/palindrome-number-solution.md

### repo-solutions-trust-leetcode-constraints [IN] OBSERVATION
Solutions across the repo perform no input validation (shape, type, value range); they rely on LeetCode's guaranteed constraints, meaning invalid inputs produce silent wrong answers or unguarded exceptions.
- Source: entries/2026/06/06/matrix-diagonal-sum-solution.md

### repo-standard-problem-layout [IN] OBSERVATION
Each LeetCode problem is isolated in its own directory containing `solution.py`, `test_solution.py`, `plan.md`, and `review.md`.
- Source: entries/2026/06/06/intersection-of-three-sorted-arrays-solution.md

### repo-test-harness-shared-imports [IN] OBSERVATION
The "Imported By" lists in solution files are misleading — hundreds of test files appear because they share a common test runner import pattern, not because they actually import the specific solution module
- Source: entries/2026/06/06/palindrome-permutation-solution.md

### repo-test-helpers-use-leetcode-serialization [IN] OBSERVATION
Test helpers like `_build(vals)` and `_to_list(root)` use BFS-based level-order serialization matching LeetCode's own tree encoding format, with `None` entries representing missing children.
- Source: entries/2026/06/06/search-in-a-binary-search-tree-solution.md

### repo-uses-bare-functions-not-class-wrappers [IN] OBSERVATION
Solutions in this repo export bare functions rather than wrapping them in LeetCode's `class Solution` pattern — a repo-wide convention.
- Source: entries/2026/06/06/distribute-candies-solution.md

### repo-uses-leetcode-camelcase-convention [IN] OBSERVATION
Solution functions use LeetCode's camelCase method signatures (e.g., `searchInsert`, `searchBST`) rather than PEP 8 snake_case, as a repo-wide convention.
- Source: entries/2026/06/06/search-insert-position-solution.md

### repo-uses-post-hoc-sorting [IN] OBSERVATION
Multiple solutions (index-pairs, intersection) collect results unordered and sort once at the end rather than maintaining sorted order during construction — separating membership/computation logic from ordering requirements.
- Source: entries/2026/06/06/index-pairs-of-a-string-solution.md

### repo-wide-method-name-mismatches [IN] OBSERVATION
Multiple solutions use incorrect or template-inherited method names (`valid_selections`, `minOperations`, `add_rooms`) that don't match the LeetCode canonical names, indicating a shared template without per-problem renaming.
- Source: entries/2026/06/06/decode-the-message-solution.md, entries/2026/06/06/decode-xored-array-solution.md, entries/2026/06/06/decompress-run-length-encoded-list-solution.md

### reshape-no-input-mutation [IN] OBSERVATION
`matrixReshape` never modifies the input `mat`; the success path returns a freshly constructed list-of-lists, and the failure path returns the original object unchanged.
- Source: entries/2026/06/06/reshape-the-matrix-solution.md

### reshape-preserves-row-major-order [IN] OBSERVATION
Elements appear in the reshaped output in the same row-major order as the input, guaranteed by the `[val for row in mat for val in row]` iteration order.
- Source: entries/2026/06/06/reshape-the-matrix-solution.md

### reshape-returns-original-on-mismatch [IN] OBSERVATION
When `m*n != r*c`, `matrixReshape` returns the exact same `mat` object (identity, not a copy), so callers can use `is` to detect failure.
- Source: entries/2026/06/06/reshape-the-matrix-solution.md

### reshape-uses-flatten-then-slice [IN] OBSERVATION
`matrixReshape` uses the flatten→slice idiom: nested list comprehension to 1D, then `flat[i*c:(i+1)*c]` to partition into rows — same concept as `numpy.reshape` but with O(m·n) extra space for the intermediate list.
- Source: entries/2026/06/06/reshape-the-matrix-solution.md

### result-list-exact-invariant [IN] OBSERVATION
During `findRestaurant`'s scan, `result` always contains exactly the strings whose index sum equals the current `min_sum` — it is fully replaced on improvement and appended on tie, with no post-processing pass needed.
- Source: entries/2026/06/06/minimum-index-sum-of-two-lists-solution.md

### reversal-equals-reorder [IN] OBSERVATION
Any permutation of an array is reachable via a sequence of subarray reversals, so `make-two-arrays-equal-by-reversing-subarrays/solution.py` correctly reduces the problem to multiset equality via `sorted(target) == sorted(arr)`.
- Source: entries/2026/06/06/make-two-arrays-equal-by-reversing-subarrays-solution.md

### reverse-alpha-scan-gives-max [IN] OBSERVATION
Iterating the alphabet from Z to A and returning on first dual-case match guarantees the lexicographically greatest result via early exit, without needing `max()`.
- Source: entries/2026/06/06/greatest-english-letter-in-upper-and-lower-case-solution.md

### reverse-bits-accumulator-pattern [IN] OBSERVATION
`reverse_bits` builds its result LSB-first via `(result << 1) | (n & 1)`, extracting bits from `n` right-to-left and placing them left-to-right in the accumulator — no string conversion or array needed.
- Source: entries/2026/06/06/reverse-bits-solution.md

### reverse-bits-fixed-32-iterations [IN] OBSERVATION
`reverse_bits` always iterates exactly 32 times regardless of input value — this is the key correctness invariant, since a `while n:` loop would silently drop leading zeros (e.g., `reverse_bits(1)` must return `2147483648`).
- Source: entries/2026/06/06/reverse-bits-solution.md

### reverse-bits-unsigned-only [IN] OBSERVATION
`reverse_bits` assumes non-negative input; Python's right-shift on negative integers sign-extends, which would produce incorrect results — but the problem guarantees unsigned 32-bit input.
- Source: entries/2026/06/06/reverse-bits-solution.md

### reverse-list-tests-cover-both-implementations [IN] OBSERVATION
Every test case in `TestReverseList` runs against both `reverse_list` and `reverse_list_recursive` via the `_run_both` helper with `unittest.subTest`, ensuring behavioral equivalence with clear failure attribution.
- Source: entries/2026/06/06/reverse-linked-list-solution.md

### reverse-only-letters-method-name-mismatch [IN] OBSERVATION
The Reverse Only Letters solution (problem 917) has its method incorrectly named `num_rescue_boats` — a copy-paste artifact from a different problem. The implementation correctly solves problem 917 despite the name.
- Source: entries/2026/06/06/reverse-only-letters-solution.md

### reverse-str-ii-pure-function [IN] OBSERVATION
`reverseStr` returns a new string and does not mutate its input; it works on a `list(s)` copy internally and joins the result.
- Source: entries/2026/06/06/reverse-string-ii-solution.md

### reverse-str-ii-relies-on-slice-clamping [IN] OBSERVATION
`reverseStr` has no explicit bounds check for the final partial window — it relies on Python's slice clamping behavior (`chars[i:i+k]` naturally covers only remaining characters when fewer than `k` are left).
- Source: entries/2026/06/06/reverse-string-ii-solution.md

### reverse-str-ii-stride-pattern [IN] OBSERVATION
`reverseStr` uses `range(0, len(chars), 2*k)` to step through windows, reversing only `chars[i:i+k]` — the second half of each window is left untouched implicitly by never selecting it.
- Source: entries/2026/06/06/reverse-string-ii-solution.md

### reverse-vowels-case-sensitive-set [IN] OBSERVATION
`reverseVowels` defines vowels as `set("aeiouAEIOU")` — both cases explicitly listed — so mixed-case input is handled without normalization.
- Source: entries/2026/06/06/reverse-vowels-of-a-string-solution.md

### reverse-vowels-non-vowel-stability [IN] OBSERVATION
In `reverseVowels`, non-vowel characters are never moved; the pointer-advance logic guarantees a character is only swapped when both pointers point to vowels.
- Source: entries/2026/06/06/reverse-vowels-of-a-string-solution.md

### reverse-words-iii-preserves-word-order [IN] OBSERVATION
`reverse_words_in_string` reverses characters within each word but preserves word positions — split/reverse/join guarantees this structurally.
- Source: entries/2026/06/06/reverse-words-in-a-string-iii-solution.md

### rgb-channels-independently-optimizable [IN] OBSERVATION
The similar-rgb-color solution processes each color channel independently because the squared-difference similarity metric is separable, reducing a search over 4096 shorthand colors to three independent 16-candidate lookups.
- Source: entries/2026/06/06/similar-rgb-color-solution.md

### right-to-left-in-place-expansion-pattern [IN] OBSERVATION
The two-pass right-to-left copy in duplicate-zeros is the same strategy used for merge-sorted-array and similar in-place expansion problems — it avoids O(n) shifting per insertion and O(n) extra space.
- Source: entries/2026/06/06/duplicate-zeros-solution.md

### rightmost-odd-digit-determines-answer [IN] OBSERVATION
In `largest-odd-number-in-string/solution.py`, the largest odd substring is always the prefix `num[:k+1]` where `k` is the rightmost odd digit's index — this holds because no-leading-zeros guarantees longer prefixes are numerically larger
- Source: entries/2026/06/06/largest-odd-number-in-string-solution.md

### rings-stride-2-parsing [IN] OBSERVATION
`countPoints` parses the input string with `range(0, len(rings), 2)` stride-2 indexing, relying on the guaranteed alternating color-char/digit-char format rather than regex or explicit parsing.
- Source: entries/2026/06/06/rings-and-rods-solution.md

### rod-completion-threshold-hardcoded [IN] OBSERVATION
The completion check in `countPoints` uses the literal `3`, coupling it to exactly the RGB color set; a fourth color would require changing this constant.
- Source: entries/2026/06/06/rings-and-rods-solution.md

### roman-subtraction-lookahead-pattern [IN] OBSERVATION
`roman_to_int` uses a left-to-right single-pass scan that subtracts `values[s[i]]` when it is less than `values[s[i+1]]`, correctly handling all six Roman subtraction pairs (IV, IX, XL, XC, CD, CM).
- Source: entries/2026/06/06/roman-to-integer-solution.md

### roman-values-dict-local-to-function [IN] OBSERVATION
The Roman numeral `values` lookup dict is defined inside `roman_to_int` (not at module level), so it is reconstructed on every call.
- Source: entries/2026/06/06/roman-to-integer-solution.md

### rook-captures-max-four [IN] OBSERVATION
The return value is bounded [0, 4] because the rook probes exactly four cardinal directions with at most one capture each.
- Source: entries/2026/06/06/available-captures-for-rook-solution.md

### rook-captures-wrong-method-name [IN] OBSERVATION
`regionsBySlashes` is the wrong method name for LeetCode 999; it should be `numRookCaptures` — likely a copy-paste error that the LeetCode judge ignores.
- Source: entries/2026/06/06/available-captures-for-rook-solution.md

### root-equals-sum-treenode-also-widely-imported [IN] OBSERVATION
`TreeNode` from `root-equals-sum-of-children/solution.py` is imported by 400+ test files, creating a second widely-used canonical tree node definition alongside the one in `same-tree/solution.py`.
- Source: entries/2026/06/06/root-equals-sum-of-children-solution.md

### root-nonnull-precondition [IN] OBSERVATION
`averageOfLevels` assumes root is non-null; passing `None` raises `AttributeError` with no graceful handling.
- Source: entries/2026/06/06/average-of-levels-in-binary-tree-solution.md

### rotate-string-doubling-trick [IN] OBSERVATION
`can_transform` checks rotation equivalence via `goal in s + s` — concatenating `s` with itself produces a string containing every rotation of `s` as a substring, reducing the problem to a single substring search.
- Source: entries/2026/06/06/rotate-string-solution.md

### rotation-produces-new-matrix [IN] OBSERVATION
Each 90° rotation in the matrix rotation solution creates a new nested list via list comprehension; the caller's original matrix is never mutated.
- Source: entries/2026/06/06/determine-whether-matrix-can-be-obtained-by-rotation-solution.md

### rounding-plus-one-is-load-bearing [IN] OBSERVATION
The `+1` before `//2` in the odd-subarray formula is necessary: when `(i+1)*(n-i)` is odd, there is exactly one more odd-length subarray than even-length, and omitting the `+1` undercounts
- Source: entries/2026/06/06/sum-of-all-odd-length-subarrays-solution.md

### rstrip-suffix-safety [IN] OBSERVATION
`rstrip("stndrdth")` never removes day digits because no digit character appears in the strip set `{s,t,n,d,r,h}`.
- Source: entries/2026/06/06/reformat-date-solution.md

### running-min-before-diff [IN] OBSERVATION
In the maximum-difference solution, `min_val` is updated after the difference check within each loop iteration, guaranteeing the minimum always originates from an index strictly less than `j`.
- Source: entries/2026/06/06/maximum-difference-between-increasing-elements-solution.md

### running-minimum-pattern-recurs [IN] OBSERVATION
The running-minimum single-pass pattern (track smallest-so-far, compute difference against current element) is used across multiple solutions including buy/sell stock and maximum-difference-between-increasing-elements, with only the sentinel return value differing.
- Source: entries/2026/06/06/maximum-difference-between-increasing-elements-solution.md

### running-sum-mutates-input [IN] OBSERVATION
`runningSum` modifies and returns the input list in-place via forward accumulation rather than allocating a new list; callers lose the original data.
- Source: entries/2026/06/06/running-sum-of-1d-array-solution.md

### running-sum-prefix-suffix-pattern [IN] OBSERVATION
Prefix-suffix sum problems use a single-pass running accumulator with the identity `rightSum = total - leftSum - current` to avoid building separate prefix and suffix arrays.
- Source: entries/2026/06/06/left-and-right-sum-differences-solution.md

### same-tree-treenode-is-canonical-import [IN] OBSERVATION
`TreeNode` from `same-tree/solution.py` is imported by 300+ test files across the repo, making it the de facto shared tree node definition despite being defined inside a single problem's solution.
- Source: entries/2026/06/06/same-tree-solution.md

### scatter-write-for-permutation-rearrangement [IN] OBSERVATION
The shuffle-string solution uses a scatter-write pattern (pre-allocate result array, write each element directly to its target index) for O(n) permutation-based rearrangement, rather than sorting or in-place mutation.
- Source: entries/2026/06/06/shuffle-string-solution.md

### search-insert-equivalent-to-bisect-left [IN] OBSERVATION
`searchInsert(nums, target)` produces the same result as `bisect.bisect_left(nums, target)` for sorted distinct-integer lists — it is the canonical lower-bound binary search.
- Source: entries/2026/06/06/search-insert-position-solution.md

### search-insert-left-converges-to-insertion-point [IN] OBSERVATION
When `target` is absent, `searchInsert` returns `left`, which equals the count of elements strictly less than `target` — no post-loop adjustment needed.
- Source: entries/2026/06/06/search-insert-position-solution.md

### search-starts-at-isqrt [IN] OBSERVATION
`constructRectangle` begins its width search at `math.isqrt(area)` and decrements, guaranteeing the first divisor found is the largest factor ≤ sqrt(area), which yields the minimum `L - W`.
- Source: entries/2026/06/06/construct-the-rectangle-solution.md

### searchbst-assumes-valid-bst [IN] OBSERVATION
`searchBST` never validates BST ordering; it silently returns wrong results if the input tree violates the BST invariant.
- Source: entries/2026/06/06/search-in-a-binary-search-tree-solution.md

### searchbst-iterative-o1-space [IN] OBSERVATION
`searchBST` uses O(1) auxiliary space via iterative `while` loop traversal — no recursion, no stack, no queue.
- Source: entries/2026/06/06/search-in-a-binary-search-tree-solution.md

### searchbst-returns-subtree-by-reference [IN] OBSERVATION
`searchBST` returns the original `TreeNode` from the tree, not a copy; the caller receives the entire subtree rooted at that node via Python's object reference semantics.
- Source: entries/2026/06/06/search-in-a-binary-search-tree-solution.md

### second-highest-constant-time-digit-ops [IN] OBSERVATION
`second_highest` collects digits into a set bounded at 10 elements (digits 0–9), so all set and `max()` operations are O(1) regardless of input string length.
- Source: entries/2026/06/06/second-largest-digit-in-a-string-solution.md

### second-minimum-prune-on-greater-value [IN] OBSERVATION
In `find_second_minimum_value`, when `node.val > min_val`, the subtree is pruned because the tree's parent-equals-min-of-children invariant guarantees no descendant can have a value between `min_val` and `node.val`.
- Source: entries/2026/06/06/second-minimum-node-in-a-binary-tree-solution.md

### second-minimum-root-is-global-min [IN] OBSERVATION
In the special binary tree for LeetCode 671, `root.val` is always the global minimum due to the structural invariant that every parent's value equals the minimum of its children.
- Source: entries/2026/06/06/second-minimum-node-in-a-binary-tree-solution.md

### seen-set-checks-before-insert [IN] OBSERVATION
The standard duplicate-detection idiom checks `if x in seen` before `seen.add(x)`, preventing an element from matching itself — used in sliding-window and two-sum family problems throughout the repo.
- Source: entries/2026/06/06/find-subarrays-with-equal-sum-solution.md

### seen-set-insert-after-check [IN] OBSERVATION
In `count_arithmetic_triplets`, each element is added to `seen` after the triplet membership check, maintaining the invariant that only previously-visited elements are lookup candidates
- Source: entries/2026/06/06/number-of-arithmetic-triplets-solution.md

### seen-set-monotonic [IN] OBSERVATION
The `seen` vowel set within each inner loop iteration is monotonically non-decreasing; once all 5 vowels are found, every further vowel-only extension also increments the count
- Source: entries/2026/06/06/count-vowel-substrings-of-a-string-solution.md

### segments-strict-comparison [IN] OBSERVATION
`checkZeroOnes` uses strict `>` comparison, so equal-length runs of `'1'`s and `'0'`s return `False`
- Source: entries/2026/06/06/longer-contiguous-segments-of-ones-than-zeros-solution.md

### selective-condition-checking-not-absent [IN] DERIVED
Solutions check conditions that enable optimization (early-exit on domain invariants, short-circuit on first violation) but deliberately skip conditions that guard against invalid input (no bounds checks, no type checks), demonstrating selective rather than absent runtime checking — the discipline is in choosing which conditions matter.
- Depends on: early-exit-optimizations-pervasive, no-validation-is-deliberate-contract

### selective-defense-explained-by-judge-boundary [IN] DERIVED
The selective-defense pattern (invest in efficiency-improving conditions like early exit and short-circuit, skip robustness-improving conditions like input validation) is precisely explained by the judge's evaluation boundary: solutions invest in conditions whose payoff is measurable (early exit improves runtime, which the judge times) and skip conditions whose payoff is invisible (validation guards against inputs the judge never sends).
- Depends on: selective-defense-replaces-universal-validation, algorithmic-precision-despite-engineering-neglect

### selective-defense-replaces-universal-validation [IN] DERIVED
Solutions employ selective defense rather than universal validation: they invest in conditions that improve efficiency (early exit, short-circuit) and defaults that encode domain knowledge (Counter zero-default, sentinel initialization), while deliberately omitting input validation — defense serves optimization, not safety.
- Depends on: selective-condition-checking-not-absent, defaults-encode-domain-knowledge-at-every-layer

### self-contained-solution-test-files [IN] OBSERVATION
Each problem directory contains a single `solution.py` that co-locates the algorithm implementation and its `unittest` test class, runnable standalone or via a test runner — this is the repo-wide convention.
- Source: entries/2026/06/06/remove-palindromic-subsequences-solution.md

### self-contained-solution-with-local-treenode [IN] OBSERVATION
Each tree problem defines its own `TreeNode` class locally rather than importing from a shared module, making each problem directory independently runnable
- Source: entries/2026/06/06/subtree-of-another-tree-solution.md

### self-dividing-tests-original-not-truncated [IN] OBSERVATION
`is_self_dividing` checks `n % digit` against the original input `n`, not the progressively truncated `num` used for digit extraction — using `num` would test a shrinking value and produce wrong results.
- Source: entries/2026/06/06/self-dividing-numbers-solution.md

### self-dividing-zero-guard-before-modulo [IN] OBSERVATION
`is_self_dividing` checks `digit == 0` before `n % digit`, preventing division-by-zero at the logic level rather than via exception handling.
- Source: entries/2026/06/06/self-dividing-numbers-solution.md

### sentence-similarity-identity-implicit [IN] OBSERVATION
Word identity (`w1 == w2`) is handled by a direct equality check, not by requiring self-pairs in `similarPairs` — a word is always similar to itself.
- Source: entries/2026/06/06/sentence-similarity-solution.md

### sentence-similarity-no-transitivity [IN] OBSERVATION
`areSentencesSimilar` treats similarity as non-transitive: `a~b` and `b~c` does not imply `a~c`, enforced by the problem contract and verified by a dedicated test case.
- Source: entries/2026/06/06/sentence-similarity-solution.md

### sentence-similarity-symmetry-by-construction [IN] OBSERVATION
Symmetry is guaranteed by inserting both `(x,y)` and `(y,x)` into the lookup set during preprocessing, rather than checking both orderings at query time.
- Source: entries/2026/06/06/sentence-similarity-solution.md

### sentence-similarity-time-complexity [IN] OBSERVATION
The algorithm runs in O(N + P) time where N is sentence length and P is the number of similar pairs, achieved by converting the pair list to a set of tuples for O(1) membership tests.
- Source: entries/2026/06/06/sentence-similarity-solution.md

### sentinel-as-found-flag [IN] OBSERVATION
Solutions use sentinel values (e.g., initializing `result = n` where max valid answer is `n // 2`) to double as both accumulator and "not found" indicator, avoiding a separate boolean flag.
- Source: entries/2026/06/06/shortest-distance-to-target-string-in-a-circular-array-solution.md

### sentinel-boundary-flush [IN] OBSERVATION
The loop iterates to `len(s) + 1` (one past the last index) so the final character group is flushed without duplicating the emit logic after the loop — a pattern reused across run-length solutions in this repo.
- Source: entries/2026/06/06/positions-of-large-groups-solution.md

### sentinel-defaults-safe-under-constraints [IN] DERIVED
Sentinel initial values (-1, 0, None) never collide with valid data because LeetCode's input constraints guarantee the sentinel falls outside the problem's value domain, making sentinel-based boundary elimination unconditionally safe within the stated contract.
- Depends on: sentinel-initialization-encodes-boundary-conditions, no-validation-is-deliberate-contract
- Unless: rook-position-default-zero

### sentinel-initialization-encodes-boundary-conditions [IN] DERIVED
Sentinel initial values (-1, 0, None, specific constants) are used to encode boundary conditions directly into loop initializers, eliminating first-iteration special-case branches and keeping loop bodies uniform.
- Depends on: ascending-check-uses-sentinel-minus-one, k-length-apart-sentinel-minus-one, prev-zero-sentinel, getheight-sentinel-neg1

### sentinel-prev-initialization [IN] OBSERVATION
In `checkZeroOnes`, initializing `prev = ""` ensures the first character always starts a fresh run without requiring a conditional before the loop
- Source: entries/2026/06/06/longer-contiguous-segments-of-ones-than-zeros-solution.md

### sentinel-return-values-match-leetcode-spec [IN] OBSERVATION
Solutions use problem-specific sentinel values for "no answer" cases (`0` for largest-perimeter-triangle, `-1` for find_K and maxLengthBetweenEqualCharacters) matching each problem's LeetCode specification rather than using Python idioms like `None`.
- Source: entries/2026/06/06/largest-positive-integer-that-exists-with-its-negative-solution.md

### sentinel-values-bootstrap-streaming-state [IN] DERIVED
Sentinel initial values (-1, 0, None) bootstrap the O(1)-space running accumulators that power single-pass streaming, encoding boundary conditions directly into loop initializers so the first iteration executes the same code path as all subsequent iterations.
- Depends on: sentinel-initialization-encodes-boundary-conditions, o1-space-via-running-accumulators

### separate-digits-single-pass-eager [IN] OBSERVATION
`separate_digits` materializes the full result via a list comprehension in a single O(total_digits) pass — it is eager, not lazy.
- Source: entries/2026/06/06/separate-the-digits-in-an-array-solution.md

### set-based-pangram-check [IN] OBSERVATION
The pangram solution uses `len(set(sentence)) == 26` as both necessary and sufficient, which is correct only under the invariant that input contains exclusively lowercase a–z characters.
- Source: entries/2026/06/06/check-if-the-sentence-is-pangram-solution.md

### set-cardinality-uniqueness-idiom [IN] OBSERVATION
The `len(set(...)) == 1` idiom is used to check whether all elements share a single value (e.g., all letters on one keyboard row) and recurs across multiple solutions in this repo.
- Source: entries/2026/06/06/keyboard-row-solution.md

### set-complement-lookup-pattern [IN] OBSERVATION
The `find_K` solution and related problems (Two Sum family) use a set-complement idiom: build a set for O(1) membership, then iterate checking for a complementary value — a recurring O(n) pattern across the repo.
- Source: entries/2026/06/06/largest-positive-integer-that-exists-with-its-negative-solution.md

### set-conversion-before-loop-for-o1-lookup [IN] OBSERVATION
`greatest-english-letter` converts the input string to a set before the scan loop, turning each membership check from O(n) to O(1).
- Source: entries/2026/06/06/greatest-english-letter-in-upper-and-lower-case-solution.md

### set-early-return-first-duplicate [IN] OBSERVATION
The first-letter-to-appear-twice solution returns on the first duplicate encountered during left-to-right iteration, guaranteeing the result is the letter whose second occurrence index is minimal.
- Source: entries/2026/06/06/first-letter-to-appear-twice-solution.md

### set-for-o1-membership-universal [IN] DERIVED
Set conversion before scanning loops is a standard repo-wide pattern for upgrading membership/dedup operations from O(n) to O(1) per check.
- Depends on: set-conversion-before-loop-for-o1-lookup, k-distant-uses-set-dedup, find-difference-set-minus-idiom, two-out-of-three-set-algebra

### set-lookup-guarantees-linear-preprocessing [IN] OBSERVATION
`find_final_value` builds a set from `nums` in O(n), then performs O(1) membership checks per iteration, making total complexity O(n + log(max(nums))).
- Source: entries/2026/06/06/keep-multiplying-found-values-by-two-solution.md

### set-membership-over-trial-division [IN] OBSERVATION
Primality in `is_prime` is checked via O(1) set lookup rather than computed via trial division, because the domain is bounded (0–20) by the problem's input constraint of at most `10^6 < 2^20`
- Source: entries/2026/06/06/prime-number-of-set-bits-in-binary-representation-solution.md

### set-membership-testing-pattern [IN] OBSERVATION
Multiple solutions (jewels-and-stones, keep-multiplying-found-values-by-two) use the same idiom: convert an input collection to a `set` for O(1) amortized membership testing before iterating over another collection. This is the repo's standard approach for membership-check problems.
- Source: entries/2026/06/06/jewels-and-stones-solution.md, entries/2026/06/06/keep-multiplying-found-values-by-two-solution.md

### set-mismatch-gauss-sum-for-missing [IN] OBSERVATION
The solution finds the duplicate via set-based detection, then derives the missing number algebraically using the Gauss sum formula `n*(n+1)//2` rather than searching for it — a pattern shared with `missing-number` and similar 1-to-n range problems.
- Source: entries/2026/06/06/set-mismatch-solution.md

### set-mismatch-return-order [IN] OBSERVATION
`findErrorNums` returns `[duplicate, missing]`, matching the LeetCode 645 contract — the duplicate is always first.
- Source: entries/2026/06/06/set-mismatch-solution.md

### shared-linked-list-infra [IN] OBSERVATION
`ListNode`, `to_list`, and `from_list` from `merge-two-sorted-lists/solution.py` are imported by 400+ test files across the repo as de-facto shared linked-list infrastructure.
- Source: entries/2026/06/06/merge-two-sorted-lists-solution.md

### shift-grid-flatten-rotate-reshape [IN] OBSERVATION
The 2D grid shift is implemented by flattening to 1D, rotating via Python slice (`flat[-k:] + flat[:-k]`), and reshaping back — the canonical idiom for cyclic 2D shifts that avoids manual index arithmetic.
- Source: entries/2026/06/06/shift-2d-grid-solution.md

### shift-grid-k-mod-optimization [IN] OBSERVATION
`k` is reduced modulo `m*n` before any list operations, making runtime independent of `k`'s magnitude — standard for cyclic operations in this repo.
- Source: entries/2026/06/06/shift-2d-grid-solution.md

### shift-grid-zero-shift-aliases-input [IN] OBSERVATION
When `k % total == 0`, `shiftGrid` returns the original grid object (not a copy), meaning mutations to the return value alias the input.
- Source: entries/2026/06/06/shift-2d-grid-solution.md

### shoelace-orientation-independent [IN] OBSERVATION
The `abs()` call in the Shoelace formula makes the triangle area computation independent of vertex winding order (clockwise vs counterclockwise).
- Source: entries/2026/06/06/largest-triangle-area-solution.md

### shoelace-returns-zero-for-collinear [IN] OBSERVATION
The Shoelace formula produces area 0 exactly when three points are collinear, so `largestTriangleArea` handles degenerate triangles implicitly without a separate collinearity check.
- Source: entries/2026/06/06/largest-triangle-area-solution.md

### short-circuit-left-before-right [IN] OBSERVATION
`getTargetCopy` checks the left subtree result before recursing right; if the target is found left, the right subtree is never visited.
- Source: entries/2026/06/06/find-a-corresponding-node-of-a-binary-tree-in-a-clone-of-that-tree-solution.md

### short-string-returns-zero-naturally [IN] OBSERVATION
Strings shorter than 3 characters produce an empty `range(len(s) - 2)`, so `countGoodSubstrings` returns 0 without any special-case code
- Source: entries/2026/06/06/substrings-of-size-three-with-distinct-characters-solution.md

### shortest-completing-word-tie-breaking [IN] OBSERVATION
When multiple words have the same minimal length, the one appearing earliest in `words` is returned, enforced by strict `<` comparison (not `<=`) in the linear scan.
- Source: entries/2026/06/06/shortest-completing-word-solution.md

### shorthand-hex-values-are-multiples-of-17 [IN] OBSERVATION
All shorthand hex color components (`00`, `11`, `22`, ..., `ff`) are exactly the multiples of 17 from 0 to 255, making nearest-shorthand a `round(val/17)*17` problem rather than a brute-force search.
- Source: entries/2026/06/06/similar-rgb-color-solution.md

### shuffle-array-offset-indexing-over-slicing [IN] OBSERVATION
`shuffle-the-array/solution.py` uses offset indexing (`nums[i]` and `nums[n + i]`) in a single loop rather than slicing into two halves and zipping, avoiding intermediate list allocations.
- Source: entries/2026/06/06/shuffle-the-array-solution.md

### shuffle-string-assumes-valid-permutation [IN] OBSERVATION
`shuffle-string/solution.py` assumes `indices` is a valid permutation of `[0, len(s))` — duplicate indices silently overwrite, out-of-range indices raise `IndexError`, and no validation is performed.
- Source: entries/2026/06/06/shuffle-string-solution.md

### shuffle-string-wrong-method-name [IN] OBSERVATION
`shuffle-string/solution.py` has method named `kids_with_candies` but implements LeetCode 1528 (Shuffle String) — a copy-paste naming bug from the code generation pipeline.
- Source: entries/2026/06/06/shuffle-string-solution.md

### sign-func-zero-short-circuit [IN] OBSERVATION
`signFunc` returns `0` immediately upon encountering any zero element, skipping remaining iteration — both a correctness guarantee (zero dominates the product) and a minor performance optimization.
- Source: entries/2026/06/06/sign-of-the-product-of-an-array-solution.md

### sign-product-via-parity-counting [IN] OBSERVATION
`signFunc` determines the sign of a product by counting negative elements (even count → positive, odd → negative) and short-circuiting on zero, never computing the actual product — avoiding overflow entirely.
- Source: entries/2026/06/06/sign-of-the-product-of-an-array-solution.md

### similar-rgb-inline-tests [IN] OBSERVATION
`similar-rgb-color/solution.py` contains inline unit tests alongside the solution (importing `unittest`), unlike most solutions which keep tests in a separate `test_solution.py` file.
- Source: entries/2026/06/06/similar-rgb-color-solution.md

### simulation-elimination-via-preprocessing [IN] DERIVED
Both sort preprocessing and Counter-based frequency counting serve as simulation eliminators: sort replaces iterative simulation by establishing structural invariants that make outcomes directly readable, while Counter collapses position-dependent queue simulation to position-independent frequency analysis — two complementary preprocessing strategies achieving the same elimination goal.
- Source type: derived
- Depends on: sort-as-simulation-substitute, counter-over-simulation-pattern

### simulation-preferred-over-closed-form [IN] OBSERVATION
Solutions favor direct simulation loops over equivalent closed-form or bit-manipulation formulas — e.g., steps-to-zero uses a while loop instead of `bit_length + popcount - 1`
- Source: entries/2026/06/06/number-of-steps-to-reduce-a-number-to-zero-solution.md

### simulation-to-formula-pattern [IN] OBSERVATION
Multiple solutions (e.g., `time_to_buy_tickets`) replace explicit round-by-round simulation with per-element contribution formulas, reducing time complexity from O(n·k) to O(n) by reasoning about how many rounds each element participates in.
- Source: entries/2026/06/06/time-needed-to-buy-tickets-solution.md

### single-file-solution-test-layout [IN] OBSERVATION
Every problem directory uses the same structure: `solution.py` contains both the solution function and inline `unittest` tests, runnable standalone via `python -m unittest` or `if __name__ == "__main__"`.
- Source: entries/2026/06/06/minimum-number-of-moves-to-seat-everyone-solution.md

### single-file-solution-test-pattern [IN] OBSERVATION
Some problem directories combine the solution and test suite in a single `solution.py` file (e.g., `maximum-number-of-words-you-can-type`, `maximum-product-of-three-numbers`), diverging from the standard separate-file layout.
- Source: entries/2026/06/06/maximum-number-of-words-you-can-type-solution.md

### single-loop-computes-row-and-column-max [IN] OBSERVATION
The `grid[j][i]` index swap in `projectionArea` computes column maximums alongside row maximums in a single nested loop, avoiding a second O(n²) pass for the side projection
- Source: entries/2026/06/06/projection-area-of-3d-shapes-solution.md

### single-pass-accumulation-pattern [IN] OBSERVATION
Multiple solutions prefer single-pass accumulation (tracking running totals/counts) over multi-step approaches like filter-then-compute, achieving O(1) auxiliary space as a recurring design choice.
- Source: entries/2026/06/06/average-value-of-even-numbers-that-are-divisible-by-three-solution.md

### single-pass-dual-max-tracking [IN] OBSERVATION
`checkZeroOnes` computes both `max_ones` and `max_zeros` in a single O(n) pass with O(1) space, updating the relevant max on every character rather than only at run boundaries
- Source: entries/2026/06/06/longer-contiguous-segments-of-ones-than-zeros-solution.md

### single-pass-max-tracking-idiom [IN] OBSERVATION
The repo prefers single-pass algorithms with running accumulators over multi-pass approaches that materialize intermediate lists, as seen in rectangle counting (O(n) with running max+count) and line writing (O(n) greedy scan)
- Source: entries/2026/06/06/number-of-rectangles-that-can-form-the-largest-square-solution.md, entries/2026/06/06/number-of-lines-to-write-string-solution.md

### single-pass-no-length [IN] OBSERVATION
`middle_of_the_linked_list` finds the middle in exactly one pass (n/2 iterations) without computing the list's length, using the slow/fast pointer technique.
- Source: entries/2026/06/06/middle-of-the-linked-list-solution.md

### single-pass-streaming-dominant-shape [IN] DERIVED
The dominant algorithmic shape is single-pass streaming: a left-to-right scan maintaining O(1) scalar accumulators, extending or resetting counters at each step, and exiting early when possible — producing O(n) time with O(1) space.
- Depends on: early-exit-optimizations-pervasive, o1-space-via-running-accumulators, extend-or-reset-canonical-consecutive-pattern

### single-row-keyboard-finger-starts-at-zero [IN] OBSERVATION
The finger always starts at index 0 of the keyboard string, and `current` tracks the most recently typed character's position throughout the loop
- Source: entries/2026/06/06/single-row-keyboard-solution.md

### single-row-keyboard-no-validation [IN] OBSERVATION
`calculate_time` assumes all characters in `word` exist in `keyboard`; a missing character raises an unhandled `KeyError`
- Source: entries/2026/06/06/single-row-keyboard-solution.md

### single-row-keyboard-precomputed-index-map [IN] OBSERVATION
`calculate_time` builds a `{char: index}` dictionary from the keyboard string in O(26) time, enabling O(1) lookups per character instead of O(26) `str.index()` calls
- Source: entries/2026/06/06/single-row-keyboard-solution.md

### skip-counter-non-negative [IN] OBSERVATION
The `skip` variable in `_next_valid` is never decremented below zero; the `elif skip > 0` guard ensures decrements only occur when there are pending backspaces to consume.
- Source: entries/2026/06/06/backspace-string-compare-solution.md

### sliding-window-o1-update-pattern [IN] OBSERVATION
`min_operations` (recolors) updates the window count in O(1) per step by adding the incoming element and removing the outgoing one, using Python's `bool`-to-`int` coercion (`True == 1`, `False == 0`) in a single arithmetic expression.
- Source: entries/2026/06/06/minimum-recolors-to-get-k-consecutive-black-blocks-solution.md

### slow-fast-second-middle [IN] OBSERVATION
For even-length lists, `middle_of_the_linked_list` returns the second middle node because the while condition checks `fast` before `fast.next`, causing `fast` to overshoot to `None`.
- Source: entries/2026/06/06/middle-of-the-linked-list-solution.md

### slowest-key-first-duration-from-zero [IN] OBSERVATION
The first keypress duration is `releaseTimes[0]` (measured from time 0), handled by initializing `best_dur` before the loop rather than with a special case inside it
- Source: entries/2026/06/06/slowest-key-solution.md

### slowest-key-misleading-function-name [IN] OBSERVATION
The function is named `minInteger` (suggesting a numeric result) but actually returns the key character with the longest press duration — a naming artifact from LeetCode's class template
- Source: entries/2026/06/06/slowest-key-solution.md

### slowest-key-tiebreak-lexicographic-largest [IN] OBSERVATION
When multiple keys share the maximum press duration, `minInteger` returns the lexicographically largest key, using Python's native character comparison
- Source: entries/2026/06/06/slowest-key-solution.md

### smaller-numbers-constant-space [IN] OBSERVATION
Memory usage beyond the output is O(101) = O(1) regardless of input size, due to the fixed value range constraint of [0,100].
- Source: entries/2026/06/06/how-many-numbers-are-smaller-than-the-current-number-solution.md

### smaller-numbers-counting-sort-approach [IN] OBSERVATION
`smallerNumbersThanCurrent` uses counting sort + prefix sum over the fixed value range [0,100] to achieve O(n+k) time, avoiding the naive O(n²) pairwise comparison.
- Source: entries/2026/06/06/how-many-numbers-are-smaller-than-the-current-number-solution.md

### smaller-numbers-duplicate-handling [IN] OBSERVATION
Elements with the same value always receive the same count because they index into the same `prefix` slot — duplicates are handled correctly without special-casing.
- Source: entries/2026/06/06/how-many-numbers-are-smaller-than-the-current-number-solution.md

### smaller-numbers-prefix-sum-correctness [IN] OBSERVATION
`prefix[v]` equals exactly the count of elements in `nums` with value strictly less than `v`, computed as the cumulative sum of `count[0..v-1]`.
- Source: entries/2026/06/06/how-many-numbers-are-smaller-than-the-current-number-solution.md

### smallest-index-early-return-guarantees-first [IN] OBSERVATION
`smallest_index` returns the leftmost matching index because it iterates left-to-right with `enumerate` and returns immediately on the first hit
- Source: entries/2026/06/06/smallest-index-with-equal-value-solution.md

### smallest-index-sentinel-negative-one [IN] OBSERVATION
`smallest_index` returns `-1` (not `None` or an exception) when no index satisfies `i % 10 == nums[i]`, matching LeetCode's expected return contract
- Source: entries/2026/06/06/smallest-index-with-equal-value-solution.md

### smallest-multiple-parity-shortcut [IN] OBSERVATION
The LCM of `n` and 2 is computed as a parity check (`n if n % 2 == 0 else n * 2`) rather than using `math.gcd`, because 2 is prime so `gcd(n, 2)` is always 1 or 2
- Source: entries/2026/06/06/smallest-even-multiple-solution.md

### smallest-multiple-rejects-floats [IN] OBSERVATION
`smallest_multiple(6.0)` raises `ValueError` because the `isinstance(n, int)` check excludes float types even when mathematically equivalent
- Source: entries/2026/06/06/smallest-even-multiple-solution.md

### smallest-multiple-validates-input [IN] OBSERVATION
`smallest_multiple` checks `isinstance(n, int)` and range bounds `[1, 150]`, raising `ValueError` on failure — an exception to the repo-wide pattern of trusting LeetCode input guarantees
- Source: entries/2026/06/06/smallest-even-multiple-solution.md

### smallest-range-i-closed-form [IN] OBSERVATION
The minimum score equals `max(0, max(nums) - min(nums) - 2*k)` — the optimal strategy pushes the min up by `k` and the max down by `k`, collapsing to zero if `2k` exceeds the original spread
- Source: entries/2026/06/06/smallest-range-i-solution.md

### smallest-range-i-no-mutation [IN] OBSERVATION
`smallestRangeI` never modifies the input array; the answer is computed purely from `max(nums)`, `min(nums)`, and `k`
- Source: entries/2026/06/06/smallest-range-i-solution.md

### solution-alias-convention [IN] OBSERVATION
Every solution module exposes a module-level snake_case callable (function or lambda) that wraps `Solution().methodName`, providing a uniform import interface for the test harness.
- Source: entries/2026/06/06/check-if-matrix-is-x-matrix-solution.md

### solution-and-tests-colocated [IN] OBSERVATION
Every problem directory's `solution.py` contains both the `Solution` class and a `unittest.TestCase` subclass, runnable via `python -m unittest` or `if __name__ == "__main__"`
- Source: entries/2026/06/06/check-if-numbers-are-ascending-in-a-sentence-solution.md

### solution-class-camelcase-convention [IN] OBSERVATION
Solutions follow LeetCode's expected interface: a `Solution` class with a camelCase method name matching the problem's canonical signature (e.g., `removeVowels`, `replaceDigits`).
- Source: entries/2026/06/06/remove-vowels-from-a-string-solution.md

### solution-class-convention [IN] OBSERVATION
Every solution in the repo follows the `class Solution` pattern with a single method matching the LeetCode function signature, except standalone-function solutions like `tax_amount` and `findTilt`.
- Source: entries/2026/06/06/buddy-strings-solution.md

### solution-class-no-init [IN] OBSERVATION
`Solution` classes have no `__init__` method, matching LeetCode's expected interface where the judge instantiates `Solution()` and calls the method directly.
- Source: entries/2026/06/06/defanging-an-ip-address-solution.md

### solution-class-stateless-convention [IN] OBSERVATION
`Solution` classes in this repo carry no instance state — methods are pure functions that could equivalently be standalone functions; the class wrapper exists solely to satisfy LeetCode's interface expectation.
- Source: entries/2026/06/06/richest-customer-wealth-solution.md

### solution-class-style-inconsistent [IN] OBSERVATION
Some solutions use a `Solution` class (x-of-a-kind, XOR operation) while others use bare module-level functions (water bottles, alien dictionary, minimum training) — no consistent convention across the repo.
- Source: entries/2026/06/06/water-bottles-solution.md

### solution-class-vs-module-function-inconsistency [IN] OBSERVATION
Some solutions (e.g., binary-search) wrap logic in a `Solution` class matching LeetCode's interface, while others (e.g., binary-tree-inorder-traversal) expose module-level functions — the repo is inconsistent on this convention.
- Source: entries/2026/06/06/binary-tree-inorder-traversal-solution.md

### solution-class-vs-standalone-function [IN] OBSERVATION
Solutions use two module patterns inconsistently: some define a standalone function (e.g., `max_product`, `max_score_after_splitting`), while others wrap the function in a `Solution` class following LeetCode's submission convention (e.g., `maximum-value-of-a-string-in-an-array`).
- Source: entries/2026/06/06/maximum-value-of-a-string-in-an-array-solution.md

### solution-class-wraps-single-method [IN] OBSERVATION
Every solution file exposes a `Solution` class with exactly one public method matching the LeetCode interface; no standalone functions at module level.
- Source: entries/2026/06/06/check-if-the-sentence-is-pangram-solution.md, entries/2026/06/06/check-if-two-string-arrays-are-equivalent-solution.md

### solution-files-self-contain-treenode [IN] OBSERVATION
Each tree problem redefines `TreeNode` (or `Node`) locally rather than importing from a shared module, so every solution is independently runnable.
- Source: entries/2026/06/06/maximum-depth-of-binary-tree-solution.md

### solution-is-single-call [IN] OBSERVATION
`Solution.read` (LC #157) has no instance-level carryover buffer; leftover bytes from the last `read4` call are lost if `read` is called again, distinguishing it from LC #158's multi-call variant.
- Source: entries/2026/06/06/read-n-characters-given-read4-solution.md

### solution-module-level-alias-convention [IN] OBSERVATION
Every solution file instantiates `Solution()` and binds the target method to a top-level name so the test harness can import it uniformly without knowing the class API.
- Source: entries/2026/06/06/check-if-all-characters-have-equal-number-of-occurrences-solution.md

### solution-per-directory-structure [IN] OBSERVATION
Each LeetCode problem lives in its own directory containing at minimum `solution.py` and `test_solution.py`, with optional `review.md` and `plan.md` files.
- Source: entries/2026/06/06/add-two-integers-solution.md

### solution-read-never-exceeds-n [IN] OBSERVATION
`Solution.read` places at most `n` characters into `buf`, enforced by `min(count, n - total)` on every copy iteration — the key correctness guard.
- Source: entries/2026/06/06/read-n-characters-given-read4-solution.md

### solution-reduction-forms-complete-hierarchy [IN] DERIVED
The solution space admits a complete three-tier reduction hierarchy under the elimination principle: mathematical reduction eliminates iteration entirely (O(1) closed-form), raw streaming eliminates preprocessing (O(n) single-pass), and pipeline variants eliminate brute-force pairing (O(n log n) preprocessing + O(n) scan) — each tier eliminates a structural requirement of the tier below.
- Source type: derived
- Depends on: all-solutions-reduce-to-adapted-streaming, mathematical-reduction-is-third-elimination-axis

### solution-resets-state-per-call [IN] OBSERVATION
`minDiffInBST` sets `self.prev = None` and `self.min_diff = inf` at the top of every call, making `Solution` instances safe to reuse across multiple invocations.
- Source: entries/2026/06/06/minimum-distance-between-bst-nodes-solution.md

### solution-test-colocated-convention [IN] OBSERVATION
Each problem directory contains `solution.py`, `test_solution.py`, `plan.md`, and `review.md` as the standard per-problem layout.
- Source: entries/2026/06/06/delete-characters-to-make-fancy-string-solution.md

### solution-test-colocation-convention [IN] OBSERVATION
Each problem directory contains a `solution.py` with both the `Solution` class and a `unittest.TestCase` subclass, runnable standalone via a `__main__` guard.
- Source: entries/2026/06/06/find-numbers-with-even-number-of-digits-solution.md

### solutions-are-pure-functions [IN] OBSERVATION
Solution methods are pure — no state mutation, no side effects, same inputs always produce the same output. The `Solution` class carries no instance state.
- Source: entries/2026/06/06/check-if-two-string-arrays-are-equivalent-solution.md, entries/2026/06/06/check-if-word-equals-summation-of-two-words-solution.md

### solutions-are-pure-no-mutation [IN] OBSERVATION
Solutions in this repo (including `minOperations`, `makeTwoArraysEqualByReversingSubarrays`, and `majority_element`) do not mutate their input arguments; they use non-mutating operations like `sorted()`, `set()`, and scalar variables.
- Source: entries/2026/06/06/make-two-arrays-equal-by-reversing-subarrays-solution.md

### solutions-are-self-contained-modules [IN] OBSERVATION
Each solution file is self-contained with no cross-solution imports; solutions never depend on other solutions, and most use only stdlib or no imports at all.
- Source: entries/2026/06/06/determine-if-string-halves-are-alike-solution.md, entries/2026/06/06/di-string-match-solution.md, entries/2026/06/06/diameter-of-binary-tree-solution.md

### solutions-are-self-contained-no-imports [IN] OBSERVATION
Multiple solutions (`reshape-the-matrix`, `reverse-bits`, `reverse-only-letters`, `reverse-string-ii`) use zero imports and rely solely on Python builtins — this is a recurring pattern across the repo.
- Source: entries/2026/06/06/reshape-the-matrix-solution.md

### solutions-are-self-contained-no-shared-imports [IN] OBSERVATION
Solution files define all needed data structures locally (e.g., `TreeNode`) rather than importing from a shared utility module — every problem directory is independent.
- Source: entries/2026/06/06/root-equals-sum-of-children-solution.md

### solutions-are-zero-dependency [IN] OBSERVATION
Multiple solution modules (number-of-1-bits, arithmetic-triplets, days-in-a-month) have zero imports; even when imports exist (common-factors uses `math.gcd`), they are limited to the standard library — no external packages anywhere
- Source: entries/2026/06/06/number-of-1-bits-solution.md

### solutions-assume-leetcode-input-constraints [IN] OBSERVATION
Solutions perform no input validation or error handling; they trust callers to provide inputs satisfying LeetCode's stated constraints — invalid input produces silent wrong results rather than exceptions.
- Source: entries/2026/06/06/number-of-different-integers-in-a-string-solution.md

### solutions-assume-valid-input [IN] OBSERVATION
Solutions omit input validation (empty lists, type checks, bounds) and rely on LeetCode problem constraints guaranteeing valid input.
- Source: entries/2026/06/06/check-if-it-is-a-straight-line-solution.md

### solutions-assume-valid-input-no-validation [IN] OBSERVATION
All five solutions examined perform zero input validation — they trust LeetCode's guarantees on input format, size, and value ranges, and will silently produce wrong results or raise exceptions on out-of-contract inputs
- Source: entries/2026/06/06/largest-odd-number-in-string-solution.md

### solutions-bundle-tests-inline [IN] OBSERVATION
Every solution file contains both the implementation and a `unittest.TestCase` in the same file, runnable via `python solution.py`, with a separate `test_solution.py` for external test harness integration.
- Source: entries/2026/06/06/day-of-the-year-solution.md, entries/2026/06/06/decode-the-message-solution.md, entries/2026/06/06/decode-xored-array-solution.md

### solutions-embed-inline-tests [IN] OBSERVATION
Solution files include their own `unittest.TestCase` subclass with test methods, runnable via `python solution.py`, in addition to a separate `test_solution.py` for the project harness.
- Source: entries/2026/06/06/delete-n-nodes-after-m-nodes-of-a-linked-list-solution.md

### solutions-inconsistent-input-mutation [IN] OBSERVATION
There is no repo-wide convention on input mutation: some solutions mutate in-place for space efficiency (array-partition, assign-cookies) while others defensively copy (array-transformation); callers must check each solution individually.
- Source: entries/2026/06/06/array-partition-solution.md, entries/2026/06/06/array-transformation-solution.md, entries/2026/06/06/assign-cookies-solution.md

### solutions-minimal-imports [IN] OBSERVATION
Solutions use zero imports or only Python standard library modules (`math`, `unittest`); no third-party dependencies appear in any solution file.
- Source: entries/2026/06/06/armstrong-number-solution.md

### solutions-never-validate-input [IN] OBSERVATION
Solutions uniformly omit input validation, trusting callers to satisfy LeetCode constraints. This is intentional for competitive-programming code but means functions can silently produce wrong results on out-of-contract inputs (e.g., negative values, empty lists, empty strings).
- Source: entries/2026/06/06/maximum-product-of-two-elements-in-an-array-solution.md

### solutions-no-external-dependencies [IN] OBSERVATION
All solution files use only Python builtins and stdlib — no third-party packages are imported anywhere in the solution code.
- Source: entries/2026/06/06/rotate-string-solution.md

### solutions-no-input-validation [IN] OBSERVATION
Solutions uniformly skip input validation and error handling, relying entirely on LeetCode's guaranteed constraints; invalid inputs propagate as unhandled exceptions from stdlib calls.
- Source: entries/2026/06/06/day-of-the-week-solution.md, entries/2026/06/06/decode-xored-array-solution.md, entries/2026/06/06/decompress-run-length-encoded-list-solution.md

### solutions-nonmutating-when-copying [IN] OBSERVATION
Solutions that transform arrays (e.g., `performOps`) create a shallow copy with `nums[:]` before modification, leaving the caller's input unchanged.
- Source: entries/2026/06/06/apply-operations-to-an-array-solution.md

### solutions-prefer-math-over-simulation [IN] OBSERVATION
When a closed-form or O(1) mathematical reduction exists, solutions use it instead of simulating the described operation (e.g., digital root formula instead of iterative digit summing, modular arithmetic instead of double-reversal).
- Source: entries/2026/06/06/a-number-after-a-double-reversal-solution.md, entries/2026/06/06/add-digits-solution.md

### solutions-return-new-collections-not-in-place [IN] OBSERVATION
Array-rearrangement solutions (shuffle-the-array, shuffle-string) allocate and return new lists rather than mutating input arrays, even when in-place solutions exist.
- Source: entries/2026/06/06/shuffle-the-array-solution.md

### solutions-self-contained-no-internal-deps [IN] OBSERVATION
Solution files have no project-internal imports; they depend only on stdlib modules (`typing`, `unittest`) or nothing at all.
- Source: entries/2026/06/06/check-if-an-array-is-consecutive-solution.md

### solutions-skip-input-validation [IN] OBSERVATION
Solutions universally omit input validation (length checks, type checks, null guards), relying entirely on LeetCode's guaranteed constraints for correctness.
- Source: entries/2026/06/06/array-partition-solution.md, entries/2026/06/06/array-transformation-solution.md, entries/2026/06/06/assign-cookies-solution.md, entries/2026/06/06/available-captures-for-rook-solution.md, entries/2026/06/06/average-of-levels-in-binary-tree-solution.md

### solutions-trust-input-no-validation [IN] OBSERVATION
Solution functions assume valid input per LeetCode problem constraints and perform no input validation; invalid inputs propagate raw Python exceptions (`KeyError`, `AttributeError`, `TypeError`).
- Source: entries/2026/06/06/roman-to-integer-solution.md

### solutions-trust-inputs-no-validation [IN] OBSERVATION
Solutions perform no input validation and trust callers to satisfy LeetCode constraints — out-of-spec inputs produce wrong results or raw Python exceptions rather than meaningful errors
- Source: entries/2026/06/06/number-of-lines-to-write-string-solution.md, entries/2026/06/06/number-of-recent-calls-solution.md, entries/2026/06/06/number-of-rectangles-that-can-form-the-largest-square-solution.md, entries/2026/06/06/number-of-steps-to-reduce-a-number-to-zero-solution.md

### solutions-trust-leetcode-constraints [IN] OBSERVATION
All solution functions assume valid input per the LeetCode problem constraints and perform no input validation — no type checks, no bounds guards, no try/except. Invalid inputs produce undefined behavior (typically `ValueError`, `IndexError`, or infinite loops) rather than informative errors.
- Source: entries/2026/06/06/calculate-digit-sum-of-a-string-solution.md, entries/2026/06/06/calculate-money-in-leetcode-bank-solution.md, entries/2026/06/06/can-make-arithmetic-progression-from-sequence-solution.md, entries/2026/06/06/can-place-flowers-solution.md, entries/2026/06/06/capitalize-the-title-solution.md

### solutions-trust-leetcode-input-constraints [IN] OBSERVATION
All solution files assume valid input per LeetCode problem constraints and perform zero input validation — no type checks, no range guards, no empty-input handling.
- Source: entries/2026/06/06/1-bit-and-2-bit-characters-solution.md, entries/2026/06/06/a-number-after-a-double-reversal-solution.md, entries/2026/06/06/add-digits-solution.md, entries/2026/06/06/add-strings-solution.md, entries/2026/06/06/add-to-array-form-of-integer-solution.md

### solutions-trust-leetcode-input-contract [IN] OBSERVATION
Solutions across the repo perform no input validation — they trust that inputs satisfy LeetCode's stated constraints. Invalid inputs (wrong types, empty when guaranteed non-empty, malformed strings) produce undefined behavior rather than meaningful errors.
- Source: entries/2026/06/06/robot-return-to-origin-solution.md

### solutions-trust-leetcode-input-contracts [IN] OBSERVATION
Solutions perform no input validation or exception handling — they rely on LeetCode's guaranteed input constraints, making invalid-input behavior undefined.
- Source: entries/2026/06/06/last-stone-weight-solution.md

### solutions-trust-leetcode-preconditions [IN] OBSERVATION
Solutions across this repo do not validate inputs against problem constraints — they trust the caller to satisfy LeetCode guarantees (non-empty arrays, valid ranges, majority existence). Invalid inputs produce silent wrong answers rather than exceptions.
- Source: entries/2026/06/06/majority-element-solution.md

### solutions-use-bare-functions [IN] OBSERVATION
The repo convention is a bare top-level function (e.g., `postorder(root)`, `moveZeroes(nums)`) rather than wrapping in LeetCode's `class Solution`, making functions directly importable by test files.
- Source: entries/2026/06/06/n-ary-tree-preorder-traversal-solution.md

### solutions-use-both-class-and-function-styles [IN] OBSERVATION
Some solutions wrap the algorithm in a `Solution` class (e.g., `construct2DArray`), while others use bare module-level functions (e.g., `no_zero_integers`, `to_hex`); both patterns coexist in the repo.
- Source: entries/2026/06/06/convert-integer-to-the-sum-of-two-no-zero-integers-solution.md

### solutions-use-no-external-dependencies [IN] OBSERVATION
Solution files use only Python builtins and standard library modules (e.g., `unittest`, `typing`); no third-party packages are imported.
- Source: entries/2026/06/06/1-bit-and-2-bit-characters-solution.md, entries/2026/06/06/add-digits-solution.md, entries/2026/06/06/add-strings-solution.md, entries/2026/06/06/add-to-array-form-of-integer-solution.md

### solutions-use-only-stdlib-or-builtins [IN] OBSERVATION
Solution files import at most `unittest` from the standard library; no external dependencies are used across any of the examined solutions.
- Source: entries/2026/06/06/remove-vowels-from-a-string-solution.md

### some-solutions-are-standalone-functions [IN] OBSERVATION
Not all solutions use a `Solution` class — some expose a standalone function (e.g., `get_answer`, `largest_unique_number`) as the entry point, with no class wrapper.
- Source: entries/2026/06/06/left-and-right-sum-differences-solution.md

### some-solutions-bundle-tests-inline [IN] OBSERVATION
Some solution files (e.g., `largest-number-after-digit-swaps-by-parity`, `largest-odd-number-in-string`) contain both the `Solution` class and a `unittest.TestCase` class in the same module, while others keep tests in a separate `test_solution.py`
- Source: entries/2026/06/06/largest-number-after-digit-swaps-by-parity-solution.md

### some-solutions-combine-test-and-source [IN] OBSERVATION
Some solution files (e.g., `number-of-students-doing-homework-at-a-given-time/solution.py`, `number-of-valid-clock-times/solution.py`) include both the `Solution` class and a `unittest.TestCase` subclass in a single module, alongside a separate `test_solution.py`.
- Source: entries/2026/06/06/number-of-students-doing-homework-at-a-given-time-solution.md

### some-solutions-embed-tests [IN] OBSERVATION
Some solution files (e.g., `count-prefixes-of-a-given-string/solution.py`) contain both the algorithm and a `unittest`-based test class in the same file, with a `__main__` guard for direct execution, rather than using a separate `test_solution.py`.
- Source: entries/2026/06/06/count-prefixes-of-a-given-string-solution.md

### some-solutions-mutate-input [IN] OBSERVATION
Some solutions mutate their input arguments in place (e.g., `can_construct` sorts the array, `canPlaceFlowers` writes to the flowerbed list) while others are pure (e.g., `digitSum` rebinds without mutation). There is no repo-wide convention — each solution's mutation behavior must be checked individually.
- Source: entries/2026/06/06/can-make-arithmetic-progression-from-sequence-solution.md, entries/2026/06/06/can-place-flowers-solution.md, entries/2026/06/06/calculate-digit-sum-of-a-string-solution.md

### sort-and-deal-greedy-minimizes-digit-sum [IN] OBSERVATION
Round-robin dealing of ascending-sorted digits into two string accumulators minimizes the sum by placing smallest digits at highest significance positions and balancing number lengths
- Source: entries/2026/06/06/split-with-minimum-sum-solution.md

### sort-array-misnaming-in-chips-solution [IN] OBSERVATION
The function solving minimum-cost-to-move-chips is named `sort_array` despite performing no sorting — it computes a minimum cost via parity counting, likely a code-generation pipeline artifact.
- Source: entries/2026/06/06/minimum-cost-to-move-chips-to-the-same-position-solution.md

### sort-as-simulation-substitute [IN] OBSERVATION
Multiple solutions in this repo replace iterative simulations with a single sort step, then reduce over the sorted structure — a recurring pattern across greedy problems.
- Source: entries/2026/06/06/delete-greatest-value-in-each-row-solution.md

### sort-by-bits-stable-tiebreak [IN] OBSERVATION
Elements with equal bit count are sorted ascending by value; equal-value elements preserve input order due to Python's stable sort.
- Source: entries/2026/06/06/sort-integers-by-the-number-of-1-bits-solution.md

### sort-by-bits-uses-string-popcount [IN] OBSERVATION
`sortByBits` computes popcount via `bin(x).count('1')` string counting rather than bitwise arithmetic (Kernighan's trick or lookup tables).
- Source: entries/2026/06/06/sort-integers-by-the-number-of-1-bits-solution.md

### sort-by-parity-in-place [IN] OBSERVATION
`sortArrayByParity` mutates and returns the input list; it allocates no auxiliary array.
- Source: entries/2026/06/06/sort-array-by-parity-solution.md

### sort-by-parity-linear [IN] OBSERVATION
The parity-sort algorithm runs in O(n) time with O(1) extra space via a single converging two-pointer pass.
- Source: entries/2026/06/06/sort-array-by-parity-solution.md

### sort-by-parity-tests-property-based [IN] OBSERVATION
Tests for sort-by-parity verify two structural properties (evens-before-odds and permutation-of-input) rather than checking against hardcoded expected outputs, which is appropriate since multiple valid orderings exist.
- Source: entries/2026/06/06/sort-array-by-parity-solution.md

### sort-even-odd-misnamed [IN] OBSERVATION
The sort-even-odd-indices function is named `maxValue` but the LeetCode problem's canonical method name is `sortEvenOdd`, likely a generation pipeline artifact.
- Source: entries/2026/06/06/sort-even-and-odd-indices-independently-solution.md

### sort-even-odd-no-mutation [IN] OBSERVATION
`maxValue` (sort-even-odd-indices) returns a new list and never mutates the input `nums`.
- Source: entries/2026/06/06/sort-even-and-odd-indices-independently-solution.md

### sort-even-odd-time-complexity [IN] OBSERVATION
Sort-even-odd-indices runs in O(n log n) time dominated by two `sorted()` calls, with O(n) space for partition lists and result.
- Source: entries/2026/06/06/sort-even-and-odd-indices-independently-solution.md

### sort-greedy-positive-only [IN] OBSERVATION
`max_product_difference` is correct only because all `nums[i]` are positive (per LeetCode constraint 1 <= nums[i] <= 10^4); negative values would invalidate the assumption that the two smallest form the minimum product.
- Source: entries/2026/06/06/maximum-product-difference-between-two-pairs-solution.md

### sort-interleave-optimal-digit-split [IN] OBSERVATION
For 4-digit number splitting, sorting digits ascending and assigning the two smallest to tens places minimizes the two-number sum. The specific pairing assignment is irrelevant — `(0,2)+(1,3)` and `(0,3)+(1,2)` yield identical sums.
- Source: entries/2026/06/06/minimum-sum-of-four-digit-number-after-splitting-digits-solution.md

### sort-pair-greedy-optimal-1d-assignment [IN] OBSERVATION
Sorting both arrays and pairing by index yields the minimum total absolute displacement for 1D assignment problems, by the rearrangement inequality.
- Source: entries/2026/06/06/minimum-number-of-moves-to-seat-everyone-solution.md

### sort-people-assumes-distinct-heights [IN] OBSERVATION
`sort_names_by_height` correctness depends on all heights being distinct; duplicate heights cause tuple comparison to fall through to lexicographic name ordering, producing potentially wrong results.
- Source: entries/2026/06/06/sort-the-people-solution.md

### sort-preprocessing-enables-linear-scan [IN] DERIVED
O(n log n) sorting as a preprocessing step is the standard technique for reducing complex pair/ordering problems to simple linear-scan algorithms via two-pointer, adjacent-pair, or greedy strategies.
- Depends on: sort-then-two-pointer-pattern, meeting-rooms-sort-then-scan, array-partition-sort-greedy, subsequence-limited-sum-greedy-sort

### sort-select-restore-idiom [IN] OBSERVATION
Subsequence selection problems use a two-sort pattern: sort by value to select the top-k elements, then re-sort by original index to restore input order — correctness does not depend on sort stability.
- Source: entries/2026/06/06/find-subsequence-of-length-k-with-the-largest-sum-solution.md

### sort-sentence-positional-scatter [IN] OBSERVATION
`sort_sentence` uses positional scatter (pre-allocate array, place each word at its encoded index in one pass) instead of comparison sort, achieving O(n) time — the same pattern appears in `shuffle-string/solution.py`.
- Source: entries/2026/06/06/sorting-the-sentence-solution.md

### sort-sentence-single-digit-position [IN] OBSERVATION
`sort_sentence` reads exactly one trailing character as the position digit, so it only supports inputs with at most 9 words; inputs with 10+ words would misparse the position.
- Source: entries/2026/06/06/sorting-the-sentence-solution.md

### sort-string-constant-space [IN] OBSERVATION
The count array is always exactly 26 elements regardless of input size; auxiliary space is O(1) beyond the output.
- Source: entries/2026/06/06/increasing-decreasing-string-solution.md

### sort-string-counting-array-pattern [IN] OBSERVATION
Uses a 26-element integer array indexed by character ordinal offset instead of Counter or sorting — the canonical approach when the alphabet is small and fixed.
- Source: entries/2026/06/06/increasing-decreasing-string-solution.md

### sort-string-linear-time [IN] OBSERVATION
sortString runs in O(n × 26) = O(n) time; each character is appended exactly once across all sweep iterations.
- Source: entries/2026/06/06/increasing-decreasing-string-solution.md

### sort-then-column-max-equivalence [IN] OBSERVATION
`maxValueAfterOperations` sorts each row and sums column-wise maxima, which is mathematically equivalent to simulating repeated deletion of row maxima.
- Source: entries/2026/06/06/delete-greatest-value-in-each-row-solution.md

### sort-then-scan-pattern [IN] OBSERVATION
The sort-then-scan pattern (sort to establish adjacency invariants, then linear scan) recurs across multiple solutions in the repo including `minimum-absolute-difference`, `array-partition`, and `largest-perimeter-triangle`.
- Source: entries/2026/06/06/minimum-absolute-difference-solution.md

### sort-then-slide-correctness [IN] OBSERVATION
After sorting, the minimum max-min difference over all size-k subsets equals the minimum `nums[i+k-1] - nums[i]`, because optimal subsets are always contiguous in sorted order.
- Source: entries/2026/06/06/minimum-difference-between-highest-and-lowest-of-k-scores-solution.md

### sort-then-two-pointer-dominant-pair-pipeline [IN] DERIVED
The sort-then-two-pointer pipeline is the dominant combined technique for pair and ordering problems, where O(n log n) sorting establishes the monotonicity invariant that two-pointer convergence exploits for O(n) scanning.
- Depends on: sort-preprocessing-enables-linear-scan, two-pointer-primary-linear-array-technique

### sort-then-two-pointer-pattern [IN] OBSERVATION
The sort + two-pointer squeeze pattern (used in `two-sum-less-than-k`) recurs across multiple solutions for pair-sum optimization, converting O(n^2) brute force into O(n log n)
- Source: entries/2026/06/06/two-sum-less-than-k-solution.md

### sorted-adjacent-min-diff [IN] OBSERVATION
After sorting distinct integers, the minimum absolute difference always occurs between adjacent elements; the minimum-absolute-difference solution relies on this to reduce from O(n^2) pair comparisons to O(n) adjacent scan.
- Source: entries/2026/06/06/minimum-absolute-difference-solution.md

### sorted-merge-vs-hashmap-strategy [IN] OBSERVATION
The repo demonstrates two distinct merge-by-key strategies: `merge-similar-items` uses `defaultdict(int)` when inputs are unsorted, while `merge-two-2d-arrays` uses a two-pointer merge when inputs are pre-sorted — the choice is driven by the sorted precondition.
- Source: entries/2026/06/06/merge-two-2d-arrays-by-summing-values-solution.md

### sorted-order-enables-all-efficient-search [IN] DERIVED
Sorted order is a key prerequisite for two major families of efficient search and scan algorithms: it enables O(n) linear-scan techniques (two-pointer, adjacent-pair, greedy) after an O(n log n) preprocessing step, and it enables O(log n) binary search via convergence-loop structures that narrow a search range. The choice between these approaches depends on whether the problem requires processing multiple elements or locating a specific target.
- Depends on: sort-preprocessing-enables-linear-scan, binary-search-variants-share-convergence-structure

### sorted-precondition-not-validated [IN] OBSERVATION
`min_common_number` assumes both input arrays are sorted in non-decreasing order but does not check or enforce this; unsorted input produces silently wrong results.
- Source: entries/2026/06/06/minimum-common-value-solution.md

### sorted-rotated-at-most-one-break [IN] OBSERVATION
A non-decreasing array rotated by any number of positions has at most 1 index where `nums[i] > nums[(i+1) % n]`; the algorithm makes exactly `n` circular comparisons (not `n-1`) to include the wrap-around.
- Source: entries/2026/06/06/check-if-array-is-sorted-and-rotated-solution.md

### sorted-triangle-single-inequality [IN] OBSERVATION
When sides are sorted descending (`a >= b >= c`), only `a < b + c` needs explicit testing — the other two triangle inequalities hold automatically.
- Source: entries/2026/06/06/largest-perimeter-triangle-solution.md

### sorting-problems-use-tuple-keys [IN] OBSERVATION
Multi-criteria sorting problems in this repo consistently use Python's tuple sort keys (e.g., `(freq[x], -x)`, `(bin(x).count('1'), x)`) with lexicographic comparison rather than custom comparators via `functools.cmp_to_key`.
- Source: entries/2026/06/06/sort-array-by-increasing-frequency-solution.md

### space-minimization-dual-strategy [IN] DERIVED
Solutions minimize memory through two complementary strategies — algorithmic (scalar running accumulators replacing materialized collections) and structural (in-place mutation of input data structures) — achieving O(1) auxiliary space at both the computation and interface layers.
- Depends on: o1-space-via-running-accumulators, in-place-mutation-with-return-convention

### special-array-boundary-guard [IN] OBSERVATION
The `x == n` check in `specialArray` prevents an index-out-of-bounds access on `nums[x]` when `x` equals the array length; removing it would crash on arrays where all elements qualify.
- Source: entries/2026/06/06/special-array-with-x-elements-greater-than-or-equal-x-solution.md

### special-array-mutates-input [IN] OBSERVATION
`specialArray` sorts the input list in-place with `nums.sort(reverse=True)`, mutating the caller's data — callers must copy first if they need the original order.
- Source: entries/2026/06/06/special-array-with-x-elements-greater-than-or-equal-x-solution.md

### special-positions-precompute-row-col-sums [IN] OBSERVATION
`numSpecial` precomputes per-row and per-column sums in O(m·n), reducing the per-cell special check from O(m+n) to O(1) — this precomputation pattern recurs across matrix problems like `lucky-numbers-in-a-matrix` and `image-smoother`.
- Source: entries/2026/06/06/special-positions-in-a-binary-matrix-solution.md

### special-positions-three-way-conjunction [IN] OBSERVATION
A cell is special iff `mat[i][j] == 1`, `row_sums[i] == 1`, and `col_sums[j] == 1`; the `mat[i][j] == 1` check is technically redundant but short-circuits the sum lookups for the majority-zero cells.
- Source: entries/2026/06/06/special-positions-in-a-binary-matrix-solution.md

### split-min-sum-no-input-validation [IN] OBSERVATION
`min_sum_of_two_numbers` performs no input validation; a single-digit input would produce `int("")` on the empty accumulator, crashing at runtime
- Source: entries/2026/06/06/split-with-minimum-sum-solution.md

### split-space-vs-split-default-semantics [IN] OBSERVATION
`reverse_words_in_string` uses `split(" ")` (explicit space delimiter) instead of `split()`, which would collapse multiple spaces and strip leading/trailing whitespace — the explicit form preserves the input's spacing structure.
- Source: entries/2026/06/06/reverse-words-in-a-string-iii-solution.md

### sqrt-divisor-enumeration-pattern [IN] OBSERVATION
`common_factors` enumerates divisors in O(sqrt(gcd(a,b))) by iterating only up to the square root and pairing each divisor `i` with `g // i`, with a guard against double-counting perfect squares
- Source: entries/2026/06/06/number-of-common-factors-solution.md

### squares-sorted-array-function-misnamed [IN] OBSERVATION
`squares-of-a-sorted-array/solution.py` names its function `distinctSubseqII` (LeetCode 940) despite implementing LeetCode 977 (Squares of a Sorted Array)
- Source: entries/2026/06/06/squares-of-a-sorted-array-solution.md

### stack-cancellation-handles-cascades [IN] OBSERVATION
The stack-based pair cancellation in `make-the-string-great/solution.py` handles chain reactions (where removing one pair exposes a new bad pair) without re-scanning, because the next incoming character is checked against the newly-exposed stack top.
- Source: entries/2026/06/06/make-the-string-great-solution.md

### stack-extend-preserves-child-order [IN] OBSERVATION
In the postorder solution, `stack.extend(node.children)` pushes children left-to-right so the rightmost is popped first, producing root-right-left order that reverses to correct left-right-root postorder.
- Source: entries/2026/06/06/n-ary-tree-postorder-traversal-solution.md

### stack-queue-costly-push-strategy [IN] OBSERVATION
Push is O(n) due to rotating n-1 elements behind the new element; pop, top, and empty are all O(1). This is the costly-push variant, preferred when reads outnumber writes.
- Source: entries/2026/06/06/implement-stack-using-queues-solution.md

### stack-queue-deque-as-fifo [IN] OBSERVATION
deque is used strictly as a FIFO queue (only append, popleft, len, and [0] indexing); no deque-specific operations like appendleft are used.
- Source: entries/2026/06/06/implement-stack-using-queues-solution.md

### stack-queue-front-invariant [IN] OBSERVATION
After every push, the front of the internal deque is the most recently pushed element (stack top), maintained by dequeuing and re-enqueuing n-1 preceding elements.
- Source: entries/2026/06/06/implement-stack-using-queues-solution.md

### stack-queue-single-queue [IN] OBSERVATION
MyStack uses exactly one deque, satisfying the LeetCode follow-up constraint for single-queue implementation.
- Source: entries/2026/06/06/implement-stack-using-queues-solution.md

### staircase-requires-both-row-and-column-sort [IN] OBSERVATION
The staircase traversal's correctness depends on columns being sorted descending (to justify counting `m - row` cells at once); row-only sorting would make the O(m+n) approach incorrect.
- Source: entries/2026/06/06/count-negative-numbers-in-a-sorted-matrix-solution.md

### staircase-traversal-for-sorted-matrix [IN] OBSERVATION
The sorted-matrix negative count uses O(m+n) staircase traversal starting from top-right corner, not binary-search-per-row or brute force — the same pattern applicable to LeetCode 240 and 378.
- Source: entries/2026/06/06/count-negative-numbers-in-a-sorted-matrix-solution.md

### stale-aliases-from-generation-pipeline [IN] OBSERVATION
Some solution files contain dead method aliases (e.g., `carFleet = projectionArea`) that are artifacts of the automated solution generation pipeline; these are never called by tests
- Source: entries/2026/06/06/projection-area-of-3d-shapes-solution.md

### star-center-two-edge-sufficiency [IN] OBSERVATION
The center of a star graph is uniquely determined by inspecting only the first two edges, since the center must appear in every edge; `find_center` runs in O(1) time regardless of graph size.
- Source: entries/2026/06/06/find-center-of-star-graph-solution.md

### stdlib-gcd-delegation [IN] OBSERVATION
The GCD solution delegates entirely to `math.gcd` (C-accelerated in CPython) with no custom Euclidean algorithm.
- Source: entries/2026/06/06/find-greatest-common-divisor-of-array-solution.md

### stdlib-only-dependencies [IN] OBSERVATION
Solutions import only from Python's standard library (primarily `unittest` and `typing`); no external or third-party packages are used.
- Source: entries/2026/06/06/convert-a-number-to-hexadecimal-solution.md

### stdlib-only-no-external-deps [IN] OBSERVATION
Solutions import only from Python's standard library (primarily `typing` and `unittest`) — no external or third-party dependencies are used.
- Source: entries/2026/06/06/binary-prefix-divisible-by-5-solution.md

### stdlib-preferred-over-handrolled [IN] OBSERVATION
Solutions prefer standard library utilities (`bisect_right`, `sorted`, `sum` with generators) over hand-rolled implementations of the same logic, reducing off-by-one risk and code ceremony.
- Source: entries/2026/06/06/find-smallest-letter-greater-than-target-solution.md, entries/2026/06/06/find-target-indices-after-sorting-array-solution.md

### stdlib-reinforces-exactness [IN] DERIVED
Python stdlib delegation and exact integer arithmetic converge on the same goal: Counter gives exact frequencies, math.isqrt gives exact roots, set gives exact membership — the stdlib IS the exactness layer, and choosing manual implementations would compromise both idiomaticity and precision.
- Depends on: python-stdlib-preferred-over-manual-algorithms, exactness-over-performance-at-every-layer

### str-conversion-digit-extraction-idiom [IN] OBSERVATION
The `int(d) for d in str(n)` idiom is the standard digit-decomposition pattern across this repo, used instead of modular arithmetic (`% 10`, `// 10`), with the advantage of preserving left-to-right digit order without reversal.
- Source: entries/2026/06/06/separate-the-digits-in-an-array-solution.md

### str-digit-count-negative-miscount [IN] OBSERVATION
`findNumbers` uses `len(str(n))` to count digits, which is correct for positive integers but would miscount negatives because the `-` character inflates the string length by 1.
- Source: entries/2026/06/06/find-numbers-with-even-number-of-digits-solution.md

### str-digit-extraction-idiom [IN] OBSERVATION
Digit-manipulation problems in this repo consistently use `str(n)` to iterate digits left-to-right rather than arithmetic extraction via `% 10` / `divmod`, which yields digits in reverse order.
- Source: entries/2026/06/06/alternating-digit-sum-solution.md

### str-replace-replaces-all-occurrences [IN] OBSERVATION
`str.replace(d, '9')` remaps every occurrence of digit `d`, not just the first — this matches the problem's "remap a digit" semantics where choosing digit `d` affects all positions.
- Source: entries/2026/06/06/maximum-difference-by-remapping-a-digit-solution.md

### streaming-and-mutation-jointly-minimize-footprint [IN] DERIVED
The dominant space-minimization strategy combines two complementary mechanisms at different granularities: single-pass streaming with scalar accumulators avoids materializing intermediate collections (algorithmic minimization), while in-place mutation avoids allocating separate output structures (structural minimization) — together achieving minimal total memory footprint.
- Depends on: single-pass-streaming-dominant-shape, space-minimization-dual-strategy

### streaming-boundary-handling-robust-in-practice [IN] DERIVED
Streaming's structural boundary handling produces correct results for all observed boundary inputs: sentinel initialization handles empty/degenerate inputs without special-case code, and sentinel values never collide with valid data under LeetCode's constraints — making the paradigm empirically robust at boundaries, not just structurally sound.
- Source type: derived
- Depends on: streaming-boundary-handling-structurally-complete, sentinel-defaults-safe-under-constraints
- Unless: rook-position-default-zero, pillow-holder-n1-crash

### streaming-boundary-handling-structurally-complete [IN] DERIVED
The streaming paradigm handles all boundary conditions through structural mechanisms rather than conditional logic: sentinel initialization covers the start boundary (no first-iteration special cases), early-exit covers the termination boundary (no post-violation processing), and extend-or-reset covers transition boundaries (no inter-run bookkeeping).
- Source type: derived
- Depends on: early-exit-and-sentinel-jointly-eliminate-boundary-code, single-pass-streaming-dominant-shape

### streaming-counter-reset-pattern [IN] OBSERVATION
The "streaming counter with reset" idiom — increment on match, reset to 0 on mismatch — is used to detect k consecutive elements satisfying a predicate in O(n) time and O(1) space; `threeConsecutiveOdds` uses it with k=3.
- Source: entries/2026/06/06/three-consecutive-odds-solution.md

### streaming-dominates-because-lowest-adoption-barrier [IN] DERIVED
Streaming's prevalence in an uncoordinated repo is partially explained by its self-sufficiency: it requires no preprocessing phase and no external ordering — only local reasoning about accumulator state — making it a paradigm with a particularly low adoption barrier. When each solution is developed independently without shared patterns, this autonomy may contribute to streaming's natural emergence as a dominant paradigm alongside sort-then-scan.
- Depends on: streaming-is-self-sufficient-paradigm, algorithmic-coherence-emerges-without-engineering

### streaming-enables-precision-without-coordination [IN] DERIVED
Streaming's self-sufficiency (no preprocessing phase, no runtime validation) is a contributing factor that supports algorithmic precision emerging without engineering coordination — fewer moving parts reduce opportunities for misconfiguration, which helps explain how high algorithmic quality can arise even when solutions are authored independently with zero cross-reference, alongside the natural constraint that LeetCode's problem domain exerts on the solution space.
- Depends on: streaming-is-self-sufficient-paradigm, algorithmic-coherence-emerges-without-engineering

### streaming-extends-through-three-orthogonal-axes [IN] DERIVED
Streaming achieves complete universality through three orthogonal extension mechanisms: operation specialization adapts the accumulation function to data domains (XOR for bits, Counter for frequencies), cursor duplication extends to multi-input and pair problems, and write-cursor compaction extends to in-place array transformations — collectively exhausting the space of solution output modes.
- Source type: derived
- Depends on: streaming-universal-via-specialization-and-adaptation, cursor-streaming-unifies-input-multiplicity, two-pointer-compaction-extends-streaming-to-in-place-transform

### streaming-fixed-point-of-solution-space [IN] DERIVED
Streaming simultaneously coincides with four independent characterizations of optimality — convergence attractor (lowest adoption barrier), algebraic normal form (all solutions reduce to it), universal strategy (three orthogonal extension axes), and minimal strategy (fewest prerequisites) — establishing it as the unique fixed point of the solution space under all natural orderings, contingent on streaming algorithms terminating for all valid inputs.
- Source type: derived
- Depends on: convergence-attractor-coincides-with-normal-form, streaming-universality-and-minimality-coincide
- Unless: negative-input-causes-nontermination

### streaming-is-privileged-default-strategy [IN] DERIVED
Single-pass streaming occupies a distinct position in the three-strategy taxonomy: it is the only strategy that is self-sufficient — requiring neither preprocessing nor runtime validation — making it the most autonomous and minimal pattern. The other two strategies (sort-then-scan and closed-form reduction) are justified when problem structure demands ordering or structural reducibility, respectively.
- Depends on: streaming-is-self-sufficient-paradigm, three-strategies-cover-solution-taxonomy

### streaming-is-self-sufficient-paradigm [IN] DERIVED
Single-pass streaming is the only paradigm that requires neither preprocessing (no external ordering needed) nor runtime validation (correctness by construction via sentinels and exact arithmetic), making it the most autonomous and minimal algorithmic pattern in the repo.
- Depends on: streaming-needs-no-external-ordering, correctness-by-construction-not-validation

### streaming-is-solution-normal-form [IN] DERIVED
The closed taxonomy (three strategies exhaust the problem space) combined with universal reducibility to adapted streaming means the solution space has a normal form: every solution is either raw streaming or preprocessing-adapted streaming, and no solution lies outside this classification — the taxonomy is not just descriptive but canonical.
- Source type: derived
- Depends on: all-solutions-reduce-to-adapted-streaming, taxonomy-closed-and-structurally-partitioned

### streaming-isolation-co-adaptation-dynamically-locked [IN] DERIVED
The co-adaptation between streaming and isolation is not merely a structural fit but a dynamically locked equilibrium: the self-reinforcing quality feedback loop simultaneously rewards streaming dominance (by selecting for algorithmic investment) and perpetuates isolation (by making cross-solution engineering investment unrewarded), locking the co-adapted pair in place through the same mechanism that stabilizes the quality profile.
- Source type: derived
- Depends on: streaming-self-sufficiency-co-adapted-with-isolation, quality-equilibrium-self-reinforcing

### streaming-needs-no-external-ordering [IN] DERIVED
Single-pass streaming algorithms can process input in a single left-to-right scan without a separate preprocessing phase, because sentinel initialization bootstraps the O(1)-space accumulators so that extend-or-reset logic follows a uniform code path from the first iteration onward — in contrast to approaches like sort-then-scan that require O(n log n) ordering as a prerequisite.
- Depends on: single-pass-streaming-dominant-shape, sentinel-values-bootstrap-streaming-state

### streaming-normal-form-is-minimal-strategy [IN] DERIVED
The solution space has a normal form (streaming, to which every solution reduces via preprocessing) that is simultaneously its minimal-prerequisite member (self-sufficient, requiring no preprocessing or validation) — a structural property analogous to an algebraic identity element being the simplest group member: the universal reduction target is also the strategy with the lowest adoption barrier.
- Source type: derived
- Depends on: streaming-is-solution-normal-form, streaming-is-self-sufficient-paradigm

### streaming-safe-within-problem-domain [IN] DERIVED
Single-pass streaming algorithms terminate correctly for all inputs within LeetCode's stated constraints, because the deliberate contract of trusting input guarantees eliminates the edge cases that would cause divergence.
- Depends on: single-pass-streaming-dominant-shape, no-validation-is-deliberate-contract
- Unless: negative-input-causes-nontermination, binary-gap-negative-input-infinite-loop

### streaming-self-sufficiency-bridges-causes [IN] DERIVED
Streaming's self-sufficiency is the causal bridge that connects the system's ultimate explanatory factors (elimination principle + domain lock) to its observable properties: elimination produces streaming's self-sufficiency by removing all prerequisites, while the domain lock stabilizes this state, and self-sufficiency then independently generates the three observable system-level phenomena (co-adaptation with isolation, selective defense, convergence dominance) — forming a complete proximate-to-ultimate causal chain with no explanatory gaps.
- Source type: derived
- Depends on: streaming-self-sufficiency-is-proximate-system-cause, system-explained-by-elimination-and-domain-lock

### streaming-self-sufficiency-co-adapted-with-isolation [IN] DERIVED
Streaming's self-sufficiency and per-problem isolation form a co-adapted pair: streaming requires no shared infrastructure (no preprocessing library, no external ordering mechanism, no shared data structures), making isolation costless from an algorithmic perspective; isolation removes coordination overhead and convention enforcement, making streaming's self-sufficiency the path of least resistance for every new solution — the two properties mutually stabilize each other, each making the other more viable.
- Source type: derived
- Depends on: streaming-is-self-sufficient-paradigm, inconsistency-is-invisible-because-submission-optimized

### streaming-self-sufficiency-explains-selective-defense [IN] DERIVED
Streaming's self-sufficiency and the judge-boundary explanation for selective defense are mutually reinforcing: streaming eliminates validation requirements by construction, and the judge rewards this absence (validation has no test-case payoff), so the dominant paradigm's architecture naturally produces the selective defense pattern without deliberate engineering choice.
- Source type: derived
- Depends on: streaming-is-privileged-default-strategy, selective-defense-explained-by-judge-boundary

### streaming-self-sufficiency-is-proximate-system-cause [IN] DERIVED
Streaming's self-sufficiency is the single property from which three distinct system-level phenomena independently derive: it co-adapts with isolation to dynamically lock the architectural shape, it explains selective defense by eliminating validation requirements at the paradigm level, and its lowest adoption barrier drives uncoordinated convergence to the quality attractor — three independent causal paths from one property to three system characteristics.
- Source type: derived
- Depends on: streaming-isolation-co-adaptation-dynamically-locked, streaming-self-sufficiency-explains-selective-defense, streaming-dominates-because-lowest-adoption-barrier

### streaming-universal-via-specialization-and-adaptation [IN] DERIVED
Streaming achieves universal coverage of the solution space through two orthogonal extension mechanisms: operation specialization adapts streaming to different data domains within a single pass (XOR for bits, Counter for frequencies, min-tracking for extrema), while domain adaptation via preprocessing transforms problems from domains where streaming alone is insufficient into streaming-amenable form — specialization extends streaming's reach within its native domain, adaptation extends it beyond.
- Source type: derived
- Depends on: streaming-universality-through-operation-specialization, all-solutions-reduce-to-adapted-streaming

### streaming-universality-and-minimality-coincide [IN] DERIVED
Streaming simultaneously achieves universality (covering the entire solution space through three orthogonal extension axes: operation specialization, cursor multiplicity, and in-place compaction) and minimality (requiring the fewest prerequisites of any strategy as the solution normal form), resolving the typical tradeoff between generality and simplicity — the most general strategy is also the simplest.
- Source type: derived
- Depends on: streaming-extends-through-three-orthogonal-axes, streaming-normal-form-is-minimal-strategy

### streaming-universality-through-operation-specialization [IN] DERIVED
The streaming paradigm achieves universality across data domains by specializing only the accumulation operation: XOR for bit-level cancellation and diffing, arithmetic sum for counting and tracking, min/max for optimization, and DFS traversal for tree-structured data — while the single-pass-with-accumulator skeleton remains invariant.
- Source type: derived
- Depends on: xor-instantiates-streaming-for-bit-domain, traversal-accumulation-universal-across-data-structures

### strict-greater-than-plus-one [IN] OBSERVATION
The minimum training hours solution enforces the strict-greater-than requirement via `+ 1` in both the energy threshold (`sum + 1`) and experience gap (`exp + 1 - cur_exp`).
- Source: entries/2026/06/07/minimum-hours-of-training-to-win-a-competition-solution.md

### strict-inequality-enforces-positive-area [IN] OBSERVATION
The rectangle overlap solution uses strict `<` (not `<=`) in all four comparisons, ensuring that touching edges or corners return `False` — matching the problem's requirement for positive intersection area.
- Source: entries/2026/06/06/rectangle-overlap-solution.md

### strict-inequality-guard [IN] OBSERVATION
The `nums[j] > min_val` check (not `>=`) means equal-valued pairs never contribute a difference, and a non-increasing array returns `-1`.
- Source: entries/2026/06/06/maximum-difference-between-increasing-elements-solution.md

### strict-inequality-rejects-plateaus [IN] OBSERVATION
The valid-mountain-array solution uses strict `<` (not `<=`) in pointer advancement, so equal adjacent elements halt the pointer and cause the validity check to fail.
- Source: entries/2026/06/06/valid-mountain-array-solution.md

### string-based-digit-check-idiom [IN] OBSERVATION
Zero-digit detection uses `'0' not in str(x)` rather than arithmetic modulo operations, a string-conversion idiom that appears across digit-manipulation problems in the repo.
- Source: entries/2026/06/06/convert-integer-to-the-sum-of-two-no-zero-integers-solution.md

### string-concat-over-arithmetic-for-digit-joining [IN] OBSERVATION
Solutions that need to "concatenate" two integers as digits use `int(str(a) + str(b))` rather than `a * 10**len(str(b)) + b` — simpler code at the cost of O(d) string allocation per pair.
- Source: entries/2026/06/06/find-the-array-concatenation-value-solution.md

### string-digit-extraction-is-default-idiom [IN] OBSERVATION
Digit decomposition across solutions defaults to `sum(int(d) for d in str(n))` rather than arithmetic modulo/division — a repo-wide convention favoring readability over performance.
- Source: entries/2026/06/06/count-integers-with-even-digit-sum-solution.md, entries/2026/06/06/count-largest-group-solution.md

### string-doubling-trim-eliminates-trivial-matches [IN] OBSERVATION
In the repeated-substring-pattern solution, `(s + s)[1:-1]` is correctness-critical: without the `[1:-1]` trim, `s` always appears at positions 0 and `len(s)` in `s + s`, making every input a false positive.
- Source: entries/2026/06/06/repeated-substring-pattern-solution.md

### string-immutability-eliminates-backtracking [IN] OBSERVATION
`binary_tree_paths` passes the accumulated path as a string parameter, relying on Python string immutability to give each recursive branch an independent snapshot without explicit undo or copy.
- Source: entries/2026/06/06/binary-tree-paths-solution.md

### string-join-then-parse-for-digit-construction [IN] OBSERVATION
When building multi-digit numbers from character sequences, solutions prefer joining digit strings and calling `int()` over arithmetic place-value computation (`acc * 10 + digit`).
- Source: entries/2026/06/06/check-if-word-equals-summation-of-two-words-solution.md

### string-matching-break-prevents-duplicates [IN] OBSERVATION
In `string-matching-in-an-array`, the `break` after appending a matched word to the result list is the sole mechanism preventing duplicate entries — no set or other dedup is used
- Source: entries/2026/06/06/string-matching-in-an-array-solution.md

### string-matching-self-exclusion-via-index [IN] OBSERVATION
The `i != j` index guard is the only mechanism preventing a word from being reported as a substring of itself
- Source: entries/2026/06/06/string-matching-in-an-array-solution.md

### string-normalization-over-int-conversion [IN] OBSERVATION
`num_different_integers` normalizes leading zeros via `str.lstrip('0')` instead of `int()` conversion, keeping the solution safe for digit sequences that could exceed typical numeric ranges (LeetCode allows up to 200-digit sequences).
- Source: entries/2026/06/06/number-of-different-integers-in-a-string-solution.md

### string-over-arithmetic-for-digit-ops [IN] DERIVED
Digit extraction, digit checking, and popcount operations consistently use string conversion (str(), indexing, character iteration, bin().count()) rather than modular arithmetic across unrelated problems.
- Depends on: str-conversion-digit-extraction-idiom, string-based-digit-check-idiom, digit-sum-via-str-conversion, bin-count-for-popcount

### string-popcount-idiom [IN] OBSERVATION
`bin(n).count('1')` is used as the popcount method in `hamming-distance/solution.py` and is likely the standard popcount idiom across the repo (shared with `number-of-1-bits`, `counting-bits`, `minimum-bit-flips-to-convert-number`).
- Source: entries/2026/06/06/hamming-distance-solution.md

### strobogrammatic-center-self-symmetric [IN] OBSERVATION
For odd-length strings, the `left <= right` loop condition forces the center digit to be checked against its own rotation, so only 0, 1, and 8 are valid center digits
- Source: entries/2026/06/06/strobogrammatic-number-solution.md

### strobogrammatic-five-valid-digits [IN] OBSERVATION
Only digits 0, 1, 6, 8, 9 are valid in a strobogrammatic number; the absence of any other digit from the mapping dict causes immediate rejection
- Source: entries/2026/06/06/strobogrammatic-number-solution.md

### strobogrammatic-uses-rotation-not-equality [IN] OBSERVATION
The strobogrammatic check compares `mapping[num[left]]` against `num[right]`, not `num[left]` against `num[right]` — "69" is strobogrammatic but not a palindrome
- Source: entries/2026/06/06/strobogrammatic-number-solution.md

### structural-congruence-assumed [IN] OBSERVATION
`getTargetCopy` assumes the cloned tree is structurally identical to the original without validation; divergent trees produce undefined behavior.
- Source: entries/2026/06/06/find-a-corresponding-node-of-a-binary-tree-in-a-clone-of-that-tree-solution.md

### structural-equality-not-prefix-match [IN] OBSERVATION
`_is_same` returns `True` only when both trees have identical structure and values at every position; a node with extra children that `subRoot` lacks correctly returns `False`
- Source: entries/2026/06/06/subtree-of-another-tree-solution.md

### structural-twin-of-stock-problem [IN] OBSERVATION
The maximum-difference-between-increasing-elements solution is algorithmically identical to "Best Time to Buy and Sell Stock" (running minimum pattern) except it returns `-1` instead of `0` when no valid pair exists.
- Source: entries/2026/06/06/maximum-difference-between-increasing-elements-solution.md

### subsequence-limited-sum-greedy-sort [IN] OBSERVATION
Sorting `nums` ascending and taking smallest elements first guarantees maximum count under any sum budget; this greedy choice is optimal because swapping a larger element for a smaller one never decreases remaining capacity.
- Source: entries/2026/06/06/longest-subsequence-with-limited-sum-solution.md

### subsequence-limited-sum-positive-input-invariant [IN] OBSERVATION
`bisect_right` on the prefix sum array requires strictly non-decreasing prefix sums, which holds only when all values in `nums` are positive; zero or negative values would break monotonicity and produce wrong answers.
- Source: entries/2026/06/06/longest-subsequence-with-limited-sum-solution.md

### subsequence-limited-sum-query-independence [IN] OBSERVATION
Each query is answered in O(log n) via binary search against a shared prefix array built once in O(n log n); queries do not interact with each other.
- Source: entries/2026/06/06/longest-subsequence-with-limited-sum-solution.md

### subset-xor-closed-form [IN] OBSERVATION
The sum of XOR totals over all subsets equals `reduce(or_, nums) * 2^(len(nums)-1)`, reducing subset XOR summation from O(n·2^n) enumeration to O(n) time and O(1) space.
- Source: entries/2026/06/06/sum-of-all-subset-xor-totals-solution.md

### substring-negation-pattern [IN] OBSERVATION
Multiple solutions in this repo reduce ordering/segmentation problems to checking for a forbidden 2-character substring (e.g., `"ba" not in s` for all-a's-before-b's).
- Source: entries/2026/06/06/check-if-all-as-appears-before-all-bs-solution.md

### subtraction-order-assumes-bst-validity [IN] OBSERVATION
`node.val - self.prev` (without `abs()`) is correct only because inorder traversal on a valid BST visits values in non-decreasing order; the code does not verify the BST property.
- Source: entries/2026/06/06/minimum-absolute-difference-in-bst-solution.md

### subtree-check-is-quadratic [IN] OBSERVATION
`isSubtree` has O(m * n) worst-case time because `_is_same` (which is O(n)) is called at up to m nodes during the DFS traversal of `root`
- Source: entries/2026/06/06/subtree-of-another-tree-solution.md

### subtree-sum-return-contract [IN] OBSERVATION
`subtree_sum` always returns the sum of all node values in its subtree, never the tilt; tilt is accumulated separately via the `nonlocal total_tilt` side effect.
- Source: entries/2026/06/06/binary-tree-tilt-solution.md

### sum-base-k1-infinite-loop [IN] OBSERVATION
`sum_base` with k=1 causes an infinite loop (n //= 1 never decreases n) and k=0 raises ZeroDivisionError — neither is guarded because LeetCode guarantees k >= 2.
- Source: entries/2026/06/06/sum-of-digits-in-base-k-solution.md

### sum-substitution-avoids-float-precision [IN] OBSERVATION
`distinctAverages` compares sums instead of averages to determine distinctness, exploiting the fact that dividing by a constant preserves distinctness — this eliminates floating-point precision issues entirely.
- Source: entries/2026/06/06/number-of-distinct-averages-solution.md

### sumzero-no-input-validation [IN] OBSERVATION
`sumZero` performs no bounds checking on `n`; it relies on LeetCode's guarantee that `1 <= n <= 1000`. Passing `n=0` returns `[]` silently.
- Source: entries/2026/06/06/find-n-unique-integers-sum-up-to-zero-solution.md

### sumzero-output-length-equals-n [IN] OBSERVATION
`sumZero(n)` always returns exactly `n` elements: `2 * (n // 2)` from pairs plus `n % 2` from the optional zero append.
- Source: entries/2026/06/06/find-n-unique-integers-sum-up-to-zero-solution.md

### sumzero-symmetric-pair-construction [IN] OBSERVATION
`sumZero(n)` constructs its result by appending `(i, -i)` pairs for `i` in `[1, n//2]`, plus `0` if `n` is odd — guaranteeing uniqueness, zero-sum, and correct length by construction without tracking a running sum.
- Source: entries/2026/06/06/find-n-unique-integers-sum-up-to-zero-solution.md

### surface-area-forward-neighbor-no-double-count [IN] OBSERVATION
Grid adjacency problems use a forward-only neighbor check (right and down only) so each adjacent pair is processed exactly once, preventing double-counting of shared faces or edges.
- Source: entries/2026/06/06/surface-area-of-3d-shapes-solution.md

### surplus-forces-sacrifice [IN] OBSERVATION
When all children would get $8 but leftover money remains, distribute-money demotes exactly one child to absorb the surplus, because the problem requires distributing all money.
- Source: entries/2026/06/06/distribute-money-to-maximum-children-solution.md

### swap-check-symmetry [IN] OBSERVATION
The cross-check `s1[i]==s2[j] and s1[j]==s2[i]` is equivalent regardless of which string the swap is applied to, so `are_almost_equal` doesn't need to specify the swap target
- Source: entries/2026/06/06/check-if-one-string-swap-can-make-strings-equal-solution.md

### sweep-ordering-guarantee [IN] OBSERVATION
Characters within each forward sweep are strictly ascending and within each backward sweep strictly descending, by construction of the index iteration direction.
- Source: entries/2026/06/06/increasing-decreasing-string-solution.md

### system-doubly-terminal-in-structure-and-dynamics [IN] DERIVED
The system has reached a doubly terminal state: the solution space has converged to a provably unique canonical form (structural terminus, established by dual-description convergence) and the quality dynamics have reached an absorbing state with no exit path (dynamic terminus, established by orthogonal defect confinement). Neither what solutions compute nor how well they are engineered can drift under the current architecture — the system is fully determined in both dimensions simultaneously.
- Source type: derived
- Depends on: dual-description-proves-unique-canonical-form, equilibrium-is-absorbing-state

### system-explained-by-elimination-and-domain-lock [IN] DERIVED
The repo's complete system character is explained by two orthogonal forces operating at different levels: elimination (of validation, coupling, and computation) produces all structural properties — coherence, quality inversion, and the streaming-dominant architecture — while the LeetCode domain locks these properties into a stable equilibrium by rewarding algorithmic investment and ignoring engineering discipline.
- Source type: derived
- Depends on: elimination-is-universal-structural-explanation, domain-is-fixed-point-of-quality-dynamics

### system-fully-characterized-as-static-equilibrium [IN] DERIVED
The repo constitutes a fully characterized static equilibrium: its mechanism is explained (elimination + domain lock), its quality profile is in stasis at every granularity (macro and micro levels reproduce the same high-algorithmic/low-engineering pattern), and its observable behaviors are quantitatively predictable from two measurable features (abstraction overhead and judge reward signal) — leaving no unexplained systematic variance.
- Source type: derived
- Depends on: system-explained-by-elimination-and-domain-lock, quality-stasis-at-every-granularity, systematic-behavior-quantitatively-predictable

### system-meta-stable-across-all-dimensions [IN] DERIVED
The system exhibits meta-stability: stability holds independently in the orthogonal correctness and quality dimensions (neither can perturb the other), the quantitative predictive relationships between observable features are themselves stable properties (not transient correlations), and together these establish that the system's global state — including the fact of its own stability — is a fixed point with no remaining degree of freedom.
- Source type: derived
- Depends on: correctness-quality-orthogonal-stability, predictability-is-itself-stable

### systematic-behavior-quantitatively-predictable [IN] DERIVED
Two observable features account for major systematic behaviors in the repo: abstraction overhead predicts convergence strength (zero-abstraction streaming converges most strongly, abstraction-dependent strategies converge proportionally less), and judge reward signal predicts defensive investment (efficiency-improving conditions checked, robustness-improving conditions skipped). Together these two gradients explain the primary patterns in the repo's engineering profile, though other factors may contribute to behaviors not covered by these two dimensions.
- Depends on: abstraction-cost-predicts-convergence-strength, defense-investment-tracks-judge-reward-signal

### tax-amount-assumes-sorted-brackets [IN] OBSERVATION
`tax_amount` requires `brackets` sorted by `upper_bound` ascending; unsorted input silently produces incorrect results with no validation or error.
- Source: entries/2026/06/06/calculate-amount-paid-in-taxes-solution.md

### tax-float-division-imprecision [IN] OBSERVATION
Tax is accumulated as a float via `percent / 100` division, so results may have floating-point imprecision; tests correctly use `assertAlmostEqual` rather than exact equality.
- Source: entries/2026/06/06/calculate-amount-paid-in-taxes-solution.md

### tax-min-clamp-marginal-taxation [IN] OBSERVATION
`min(upper, income)` prevents a bracket from taxing more income than actually earned, which is the core invariant ensuring correct progressive (not flat) taxation.
- Source: entries/2026/06/06/calculate-amount-paid-in-taxes-solution.md

### taxonomy-closed-and-structurally-partitioned [IN] DERIVED
The solution taxonomy is both closed (three strategies exhaust the problem space) and structurally partitioned (two pipeline forms instantiate all preprocessing-dependent strategies), meaning every solution is classifiable by exactly one strategy choice and at most one pipeline shape.
- Depends on: three-strategies-cover-solution-taxonomy, canonical-pipeline-has-exactly-two-instantiations

### teemo-last-attack-full-duration [IN] OBSERVATION
The final attack always contributes exactly `duration` to the total because no subsequent attack can truncate it, encoded as an unconditional `total += duration` after the loop.
- Source: entries/2026/06/06/teemo-attacking-solution.md

### teemo-overlap-resets-not-stacks [IN] OBSERVATION
When two attacks overlap (`gap < duration`), only the gap between them counts toward poisoned time — the poison timer resets rather than stacking additively.
- Source: entries/2026/06/06/teemo-attacking-solution.md

### teemo-single-pass-min-clamping [IN] OBSERVATION
The teemo-attacking solution computes total poisoned time in O(n) via adjacent-pair comparison with `min(gap, duration)`, avoiding explicit interval construction or merging.
- Source: entries/2026/06/06/teemo-attacking-solution.md

### teemo-sorted-precondition [IN] OBSERVATION
Correctness of the teemo-attacking solution depends on `timeSeries` being non-decreasing; no runtime sort or validation enforces this.
- Source: entries/2026/06/06/teemo-attacking-solution.md

### test-colocation-dual-mode-inconsistent [IN] DERIVED
Tests appear in two coexisting patterns — inline unittest classes within solution.py and separate test_solution.py files — but the antecedents show these are complementary rather than incompatible: some problems use both, with the separate test file being the consistent convention and inline tests being an optional addition. No evidence indicates a conflict between the patterns or that the lack of a single enforced standard causes problems.
- Depends on: tests-colocated-in-solution-file, test-files-import-sibling-solution, some-solutions-bundle-tests-inline, repo-solution-test-convention

### test-files-import-sibling-solution [IN] OBSERVATION
Each `test_solution.py` imports from its sibling `solution.py` via `from solution import Solution`; the repo-wide "imported by" lists are artifacts of shared naming, not actual cross-problem dependencies.
- Source: entries/2026/06/06/intersection-of-two-arrays-solution.md

### test-harness-uniform-import-convention [IN] OBSERVATION
The repo's test harness imports a uniform symbol name from each solution module, leading to semantically incorrect aliases (e.g., `is_univalued` aliasing `largest_sum_after_k_negations`) that exist purely for test infrastructure wiring.
- Source: entries/2026/06/06/maximize-sum-of-array-after-k-negations-solution.md

### test-import-graph-artifact [IN] OBSERVATION
The "Imported By" lists in code exploration prompts show hundreds of test files repo-wide, but each `solution.py` is only truly imported by its co-located `test_solution.py`. The apparent cross-imports are an artifact of the import-graph collection method (likely a shared test harness or conftest pattern).
- Source: entries/2026/06/06/calculate-digit-sum-of-a-string-solution.md, entries/2026/06/06/calculate-money-in-leetcode-bank-solution.md, entries/2026/06/06/can-make-arithmetic-progression-from-sequence-solution.md, entries/2026/06/06/can-place-flowers-solution.md, entries/2026/06/06/capitalize-the-title-solution.md

### test-import-list-artifact [IN] OBSERVATION
The large "Imported By" lists on solution files (showing ~400+ test files) are artifacts of a shared test runner or dynamic import mechanism, not actual cross-problem dependencies. Each solution is consumed only by its own `test_solution.py`.
- Source: entries/2026/06/06/jewels-and-stones-solution.md, entries/2026/06/06/k-items-with-the-maximum-sum-solution.md, entries/2026/06/06/keep-multiplying-found-values-by-two-solution.md

### test-import-list-is-artifact [IN] OBSERVATION
The large "Imported By" lists showing hundreds of test files are artifacts of the repo's shared test infrastructure — each solution is imported only by its co-located `test_solution.py`.
- Source: entries/2026/06/06/baseball-game-solution.md

### tests-colocated-in-solution-file [IN] OBSERVATION
Some problem solutions bundle `unittest` test cases directly in `solution.py` alongside the solution class, with `unittest.main()` at the bottom, in addition to the separate `test_solution.py` file.
- Source: entries/2026/06/06/latest-time-by-replacing-hidden-digits-solution.md

### tests-colocated-with-solutions [IN] OBSERVATION
Test suites live alongside solutions — either embedded in the same `solution.py` file (with a `unittest` class) or in a sibling `test_solution.py`, making each problem directory independently testable.
- Source: entries/2026/06/06/binary-tree-inorder-traversal-solution.md

### third-max-cascading-demotion [IN] OBSERVATION
When a new global maximum is found, `third_max` demotes `first → second → third` via tuple unpacking in a single statement, guaranteeing no tracked value is lost.
- Source: entries/2026/06/06/third-maximum-number-solution.md

### third-max-distinct-invariant [IN] OBSERVATION
The duplicate-skip guard (`if n in (first, second, third)`) ensures `first`, `second`, and `third` are always mutually distinct when non-`None` throughout execution.
- Source: entries/2026/06/06/third-maximum-number-solution.md

### third-max-fallback-to-global-max [IN] OBSERVATION
When fewer than 3 distinct values exist, `third_max` returns the global maximum (`first`) rather than raising an error or returning a sentinel.
- Source: entries/2026/06/06/third-maximum-number-solution.md

### third-max-none-sentinel-safety [IN] OBSERVATION
`third_max` uses `None` as a sentinel for unfilled slots, which is safe because the input domain is `int` only — no value in `nums` can collide with `None`.
- Source: entries/2026/06/06/third-maximum-number-solution.md

### thousand-separator-no-dot-for-small-inputs [IN] OBSERVATION
Inputs with 3 or fewer digits produce no dot separator because the while-loop condition `len(s) > 3` is never satisfied.
- Source: entries/2026/06/06/thousand-separator-solution.md

### thousand-separator-pure-string-ops [IN] OBSERVATION
The thousand-separator solution uses only string slicing and list operations — no imports, format specifiers, regex, or locale-dependent formatting.
- Source: entries/2026/06/06/thousand-separator-solution.md

### thousand-separator-right-to-left-chunking [IN] OBSERVATION
The thousand-separator solution removes exactly 3 characters per iteration from the right of the string, guaranteeing uniform chunk sizes except for the leftmost group (1–3 chars).
- Source: entries/2026/06/06/thousand-separator-solution.md

### three-consecutive-odds-counter-invariant [IN] OBSERVATION
In `threeConsecutiveOdds`, the `count` variable always equals the length of the current run of consecutive odd elements ending at the current position, resetting to 0 on any even element.
- Source: entries/2026/06/06/three-consecutive-odds-solution.md

### three-consecutive-odds-early-exit [IN] OBSERVATION
`threeConsecutiveOdds` returns `True` immediately upon finding the first qualifying triplet, short-circuiting the remainder of the array scan.
- Source: entries/2026/06/06/three-consecutive-odds-solution.md

### three-consecutive-odds-positive-only-modulo [IN] OBSERVATION
`threeConsecutiveOdds` checks oddness via `num % 2 == 1`, which is correct only for non-negative integers; negative odds yield `-1` from `%`, but the problem constraint `1 <= arr[i] <= 1000` makes this safe.
- Source: entries/2026/06/06/three-consecutive-odds-solution.md

### three-divisors-perfect-square-prime [IN] OBSERVATION
`isThreeDivisors` encodes the number-theory result that τ(n)=3 iff n=p² for prime p, reducing a divisor-counting problem to a perfect-square check followed by a primality test on the root.
- Source: entries/2026/06/06/three-divisors-solution.md

### three-divisors-quarter-root-complexity [IN] OBSERVATION
The primality check in `isThreeDivisors` runs trial division on `sqrt(n)` up to `isqrt(sqrt(n))`, giving O(n^(1/4)) overall time — faster than the O(√n) brute-force divisor count.
- Source: entries/2026/06/06/three-divisors-solution.md

### three-parts-cumulative-boundary [IN] OBSERVATION
Partition boundaries are detected via `running_sum == target * (parts_found + 1)`, which relies on parts_found incrementing sequentially from 0 to 1 to 2
- Source: entries/2026/06/06/partition-array-into-three-parts-with-equal-sum-solution.md

### three-parts-divisibility-precondition [IN] OBSERVATION
The method returns False immediately when the array sum is not divisible by 3, before scanning any elements
- Source: entries/2026/06/06/partition-array-into-three-parts-with-equal-sum-solution.md

### three-parts-linear-complexity [IN] OBSERVATION
The algorithm performs exactly one pass over the array after the initial sum, achieving O(n) time and O(1) auxiliary space
- Source: entries/2026/06/06/partition-array-into-three-parts-with-equal-sum-solution.md

### three-parts-nonempty-guarantee [IN] OBSERVATION
The loop bound `range(len(arr) - 1)` ensures the third partition always contains at least one element when True is returned
- Source: entries/2026/06/06/partition-array-into-three-parts-with-equal-sum-solution.md

### three-parts-zero-sum-correct [IN] OBSERVATION
When `total == 0`, `target == 0` and the cumulative check still works correctly — finds two prefixes summing to 0, with the remainder guaranteed to sum to 0
- Source: entries/2026/06/06/partition-array-into-three-parts-with-equal-sum-solution.md

### three-pointer-linear-time-constant-space [IN] OBSERVATION
The three-pointer intersection algorithm runs in O(n1 + n2 + n3) time with O(1) auxiliary space by always advancing the pointer at the smallest current value.
- Source: entries/2026/06/06/intersection-of-three-sorted-arrays-solution.md

### three-pointer-requires-strictly-sorted-input [IN] OBSERVATION
`arraysIntersection` produces correct results only when all three input arrays are sorted in strictly increasing order (no duplicates within a single array); unsorted input causes the pointer-advance logic to skip valid matches.
- Source: entries/2026/06/06/intersection-of-three-sorted-arrays-solution.md

### three-strategies-cover-solution-taxonomy [IN] DERIVED
The solution space is largely covered by three strategy families — single-pass streaming for accumulation and counting, sort-then-scan for pair and ordering problems, and closed-form mathematical reduction for structurally reducible problems — though not every solution maps neatly to exactly one category.
- Depends on: two-paradigms-cover-solution-space, mathematical-insight-replaces-brute-computation

### tickets-k-must-be-positive [IN] OBSERVATION
`time_to_buy_tickets` assumes `tickets[k] >= 1`; if `tickets[k]` were 0, the expression `tickets[k] - 1` becomes -1, causing incorrect negative contributions from `min` for post-k elements.
- Source: entries/2026/06/06/time-needed-to-buy-tickets-solution.md

### tickets-pure-function-no-deps [IN] OBSERVATION
`time_to_buy_tickets` is a standalone pure function with zero imports and no side effects, taking `(tickets, k)` and returning an integer.
- Source: entries/2026/06/06/time-needed-to-buy-tickets-solution.md

### tickets-simulation-avoidance [IN] OBSERVATION
`time_to_buy_tickets` replaces an O(n·max(tickets)) queue simulation with an O(n) single-pass formula that computes each person's contribution based on their position relative to index k.
- Source: entries/2026/06/06/time-needed-to-buy-tickets-solution.md

### tickets-split-at-k-boundary [IN] OBSERVATION
In `time_to_buy_tickets`, people at indices ≤ k contribute `min(t, tickets[k])` seconds and people at indices > k contribute `min(t, tickets[k] - 1)` seconds, because post-k people do not get a turn in k's final round.
- Source: entries/2026/06/06/time-needed-to-buy-tickets-solution.md

### tictactoe-eager-win-check-all-moves [IN] OBSERVATION
Win detection runs after every move by checking all 8 winning lines, so the first player to complete a line wins immediately and later moves are never evaluated.
- Source: entries/2026/06/06/find-winner-on-a-tic-tac-toe-game-solution.md

### tictactoe-function-misnamed [IN] OBSERVATION
The tic-tac-toe solution exports a function named `validateBinaryTreeNodes` instead of a tic-tac-toe-related name, indicating a copy-paste naming error that tests depend on.
- Source: entries/2026/06/06/find-winner-on-a-tic-tac-toe-game-solution.md

### tictactoe-trailing-space-returns [IN] OBSERVATION
All four return values from the tic-tac-toe solution include a trailing space (`"A "`, `"B "`, `"Draw "`, `"Pending "`); tests must match this exact format.
- Source: entries/2026/06/06/find-winner-on-a-tic-tac-toe-game-solution.md

### tie-breaking-earliest-year [IN] OBSERVATION
`maxAliveYear` uses strict `>` in its comparison so the left-to-right scan naturally returns the earliest year when multiple years share peak population.
- Source: entries/2026/06/06/maximum-population-year-solution.md

### time-complexity-sort-then-reduce [IN] OBSERVATION
`maxValueAfterOperations` runs in O(m * n log n) — dominated by sorting m rows of length n — followed by an O(m * n) column-max scan.
- Source: entries/2026/06/06/delete-greatest-value-in-each-row-solution.md

### toeplitz-neighbor-equivalence [IN] OBSERVATION
The Toeplitz check verifies `matrix[i][j] == matrix[i-1][j-1]` for all interior cells rather than enumerating diagonals explicitly; this is equivalent by transitivity of equality along each diagonal.
- Source: entries/2026/06/06/toeplitz-matrix-solution.md

### toeplitz-short-circuits-on-mismatch [IN] OBSERVATION
`isToeplitzMatrix` returns `False` on the first cell that differs from its diagonal predecessor, skipping all remaining comparisons.
- Source: entries/2026/06/06/toeplitz-matrix-solution.md

### toeplitz-trivial-for-single-dimension [IN] OBSERVATION
A 1×n or m×1 matrix is trivially Toeplitz because the loop ranges `range(1, 1)` are empty, so the method returns `True` without executing any comparisons.
- Source: entries/2026/06/06/toeplitz-matrix-solution.md

### top-projection-counts-nonzero-cells [IN] OBSERVATION
The xy (top-down) projection area equals the count of cells where `grid[i][j] > 0`, not the sum of cell values — each non-empty stack casts exactly one unit square
- Source: entries/2026/06/06/projection-area-of-3d-shapes-solution.md

### trailing-space-in-poker-output [IN] OBSERVATION
All return strings in `best_poker_hand` end with a trailing space (e.g., `"Flush "`, `"Pair "`), matching LeetCode's expected output format exactly.
- Source: entries/2026/06/06/best-poker-hand-solution.md

### transpose-empty-input-raises [IN] OBSERVATION
`transpose([])` raises `IndexError` because the code unconditionally accesses `matrix[0]` to determine the column count; this is safe under LeetCode's constraint `m >= 1`.
- Source: entries/2026/06/06/transpose-matrix-solution.md

### transpose-index-identity [IN] OBSERVATION
The output of `transpose` satisfies `result[j][i] == matrix[i][j]` for all valid `(i, j)`, achieved by swapping the outer/inner loop indices in a nested list comprehension.
- Source: entries/2026/06/06/transpose-matrix-solution.md

### transpose-output-dimensions-swapped [IN] OBSERVATION
`transpose` always returns an `n × m` matrix from an `m × n` input, constructing a new list-of-lists; it never modifies the input in place.
- Source: entries/2026/06/06/transpose-matrix-solution.md

### traversal-accumulation-universal-across-data-structures [IN] DERIVED
The single-traversal accumulation paradigm — visit each element once while maintaining state via accumulators — is a recurring algorithmic shape across data structures: arrays use left-to-right streaming with scalar variables, and trees use DFS with closure-captured variables. Both achieve efficient single-pass O(n) computation, suggesting that traversal-order discipline is a primary mechanism for correctness in these patterns.
- Depends on: tree-postorder-closure-idiom, single-pass-streaming-dominant-shape

### tree-postorder-closure-idiom [IN] DERIVED
Tree solutions combine closure-based DFS (capturing mutable result variables from the enclosing scope for side-effect accumulation) with postorder return values (propagating subtree summaries upward for recursive composition), enabling single-pass O(n) tree computations that both accumulate a global answer and compose local results.
- Depends on: closure-dfs-pattern, postorder-accumulator-pattern

### tree-serialization-helpers-duplicated [IN] OBSERVATION
`list_to_tree` and `tree_to_list` BFS serialization helpers are duplicated per tree problem rather than shared from a common module.
- Source: entries/2026/06/06/invert-binary-tree-solution.md

### tree-to-list-strips-trailing-nones [IN] OBSERVATION
`tree_to_list` removes trailing `None` values from its BFS serialization, making `[1, None, 2]` and `[1, None, 2, None, None]` equivalent representations.
- Source: entries/2026/06/06/invert-binary-tree-solution.md

### tree-to-list-strips-trailing-nulls [IN] OBSERVATION
`tree_to_list` removes all trailing `None` entries from its BFS level-order output, matching LeetCode's canonical serialization format.
- Source: entries/2026/06/06/merge-two-binary-trees-solution.md

### tree2str-empty-left-parens-preserved [IN] OBSERVATION
`tree2str` emits `()` for a missing left child if and only if the right child exists, preserving positional unambiguity in the serialized output.
- Source: entries/2026/06/06/construct-string-from-binary-tree-solution.md

### tree2str-handles-negative-vals [IN] OBSERVATION
Negative node values are serialized correctly (e.g., `-1(-2)(-3)`) with no special-case logic — `str()` handles the sign naturally.
- Source: entries/2026/06/06/construct-string-from-binary-tree-solution.md

### tree2str-local-treenode [IN] OBSERVATION
`tree2str` defines `TreeNode` locally rather than importing from a shared module, making the solution self-contained for LeetCode submission.
- Source: entries/2026/06/06/construct-string-from-binary-tree-solution.md

### tree2str-no-unnecessary-right-parens [IN] OBSERVATION
`tree2str` never emits parentheses for an absent right child, regardless of whether the left child exists — the asymmetric conditional (`if root.left or root.right` vs. `if root.right`) encodes this rule.
- Source: entries/2026/06/06/construct-string-from-binary-tree-solution.md

### treenode-canonical-definition [IN] OBSERVATION
`TreeNode` with `val`, `left`, `right` is the canonical binary tree node definition, redefined per-file to match LeetCode's interface rather than shared from a common module.
- Source: entries/2026/06/06/leaf-similar-trees-solution.md

### treenode-defined-in-multiple-files [IN] OBSERVATION
`TreeNode` is defined locally in multiple solution files (`same-tree/solution.py`, `root-equals-sum-of-children/solution.py`, and likely others) rather than in a single shared location.
- Source: entries/2026/06/06/root-equals-sum-of-children-solution.md

### treenode-defined-locally-per-solution [IN] OBSERVATION
`TreeNode` is defined locally in each tree-problem solution file rather than imported from a shared module, making each solution independently runnable.
- Source: entries/2026/06/06/binary-tree-tilt-solution.md

### treenode-is-de-facto-shared-via-inline-copies [IN] OBSERVATION
`TreeNode` is defined inline in each tree-problem solution file rather than in a shared module, yet hundreds of test files import it from individual solutions — making each copy a critical dependency despite the duplication.
- Source: entries/2026/06/06/second-minimum-node-in-a-binary-tree-solution.md

### treenode-is-shared-canonical-definition [IN] OBSERVATION
`TreeNode` in `convert-sorted-array-to-binary-search-tree/solution.py` is imported by 300+ test files across the repo, serving as the de facto canonical binary tree node definition.
- Source: entries/2026/06/06/convert-sorted-array-to-binary-search-tree-solution.md

### treenode-redefined-per-problem [IN] OBSERVATION
`TreeNode` is defined locally in each tree problem's `solution.py` rather than imported from a shared module, matching LeetCode's submission format and keeping each problem directory self-contained
- Source: entries/2026/06/06/range-sum-of-bst-solution.md

### treenode-shared-definition-in-preorder [IN] OBSERVATION
`TreeNode` defined in `binary-tree-preorder-traversal/solution.py` is imported by 400+ test files across the repo, making it the de facto shared binary tree node class — changes to its constructor signature are breaking.
- Source: entries/2026/06/06/binary-tree-preorder-traversal-solution.md

### treenode-shared-dependency [IN] OBSERVATION
The `TreeNode` class defined in `average-of-levels-in-binary-tree/solution.py` is imported by hundreds of test files across the repo, making it a de facto shared data structure whose signature changes have high blast radius.
- Source: entries/2026/06/06/average-of-levels-in-binary-tree-solution.md

### trial-division-pattern-reuse [IN] OBSERVATION
The strip-all-factors-then-check-residual pattern (used in `ugly-number`) recurs in `power-of-two`, `power-of-three`, `power-of-four`, and `three-divisors` solutions
- Source: entries/2026/06/06/ugly-number-solution.md

### triangular-number-correctness [IN] OBSERVATION
A run of `n` identical characters contributes exactly `n*(n+1)/2` single-character substrings, and the integer division is always exact because one of `n` or `n+1` is even
- Source: entries/2026/06/06/count-substrings-with-only-one-distinct-letter-solution.md

### tribonacci-base-cases-complete [IN] OBSERVATION
The three Tribonacci base cases T(0)=0, T(1)=1, T(2)=1 are handled via early returns before the loop, so the loop range `3..n` never executes for n < 3.
- Source: entries/2026/06/06/n-th-tribonacci-number-solution.md

### tribonacci-iterative-o1-space [IN] OBSERVATION
`tribonacci` uses O(1) auxiliary space via a three-variable sliding window `(a, b, c)`, not memoization or a DP array.
- Source: entries/2026/06/06/n-th-tribonacci-number-solution.md

### tribonacci-tuple-swap-correctness [IN] OBSERVATION
The simultaneous tuple assignment `a, b, c = b, c, a+b+c` evaluates all RHS values before any assignment, ensuring correctness without temporary variables — a Python-specific idiom critical to the sliding-window recurrence.
- Source: entries/2026/06/06/n-th-tribonacci-number-solution.md

### trim-mean-mutates-input [IN] OBSERVATION
`trimMean` calls `arr.sort()` which modifies the caller's list in-place, destroying original element ordering.
- Source: entries/2026/06/06/mean-of-array-after-removing-some-elements-solution.md

### trim-mean-removes-exactly-5-percent-each-end [IN] OBSERVATION
`trimMean` removes `len(arr) // 20` elements from both the low and high ends, which equals exactly 5% when `len(arr)` is a multiple of 20; silently trims fewer than 5% otherwise.
- Source: entries/2026/06/06/mean-of-array-after-removing-some-elements-solution.md

### trim-mean-safe-under-constraints [IN] OBSERVATION
Division by zero cannot occur in `trimMean` when `len(arr) >= 20`, since the trimmed slice retains at least `len(arr) - 2*(len(arr)//20)` elements (minimum 18 for a 20-element input).
- Source: entries/2026/06/06/mean-of-array-after-removing-some-elements-solution.md

### trim-mean-time-complexity-is-sort-dominated [IN] OBSERVATION
`trimMean` is O(n log n) dominated by the sort; the subsequent slice and sum are O(n).
- Source: entries/2026/06/06/mean-of-array-after-removing-some-elements-solution.md

### triple-stabilization-across-orthogonal-dimensions [IN] DERIVED
The system is stabilized by three independent mechanisms operating on orthogonal dimensions: correctness is dual-stabilized (paradigmatic convergence + construction techniques), the quality profile is dual-stabilized (domain attractor + self-reinforcing equilibrium), and defect tolerance is self-reinforced by the quality equilibrium itself — making the system triply resilient because any single destabilization affects only one dimension.
- Source type: derived
- Depends on: correctness-and-quality-independently-dual-stabilized, immunity-self-reinforced-by-quality-equilibrium

### triplet-no-index-tracking [IN] OBSERVATION
Despite the problem requiring `i < j < k` ordering, `countTriplets` never tracks indices — the product `a * b * c` (one element from each of three distinct-value groups) maps 1-to-1 to ordered index triples.
- Source: entries/2026/06/06/number-of-unequal-triplets-in-array-solution.md

### triplet-order-independence [IN] OBSERVATION
The group-contribution sweep in `countTriplets` produces the same result regardless of iteration order over `Counter.values()`, because each triple of distinct groups is counted exactly once when its "middle" group (in processing order) is visited.
- Source: entries/2026/06/06/number-of-unequal-triplets-in-array-solution.md

### truncate-sentence-safe-overslice [IN] OBSERVATION
`truncateSentence` safely handles `k` greater than the word count by returning the full sentence, relying on Python's slice semantics rather than explicit bounds checking.
- Source: entries/2026/06/06/truncate-sentence-solution.md

### twenty-dollar-bills-never-tracked [IN] OBSERVATION
The lemonade-change solution tracks only $5 and $10 bill counts; $20 bills are never stored because they can never be used as change.
- Source: entries/2026/06/06/lemonade-change-solution.md

### two-char-alphabet-bounds-answer-to-two [IN] OBSERVATION
For palindromic-subsequence removal over a 2-character alphabet, the answer is always in `{0, 1, 2}` — remove all of one character in one step, all of the other in a second step. This bound breaks with 3+ characters.
- Source: entries/2026/06/06/remove-palindromic-subsequences-solution.md

### two-digit-construction-commutative [IN] OBSERVATION
The `min(a,b)*10 + max(a,b)` formula produces the correct smallest two-digit number regardless of which array contributes the smaller minimum.
- Source: entries/2026/06/06/form-smallest-number-from-two-digit-arrays-solution.md

### two-max-tracker-ge-not-gt [IN] OBSERVATION
In the two-max tracking idiom (`max_product`), the primary branch uses `>=` (not `>`), which is critical for correctness: with `>`, an array of identical values would leave `max2` at the initial value of 0 instead of being promoted.
- Source: entries/2026/06/06/maximum-product-of-two-elements-in-an-array-solution.md

### two-out-of-three-set-algebra [IN] OBSERVATION
The Two Out of Three solution expresses "appears in >= 2 of 3 arrays" as the union of all pairwise set intersections: `(s1 & s2) | (s1 & s3) | (s2 & s3)`.
- Source: entries/2026/06/06/two-out-of-three-solution.md

### two-out-of-three-wrong-name [IN] OBSERVATION
The function implementing LeetCode 2032 (Two Out of Three) is misnamed `largest_odd`, a copy-paste error from another solution file.
- Source: entries/2026/06/06/two-out-of-three-solution.md

### two-paradigms-cover-solution-space [IN] DERIVED
Nearly all solutions follow one of two dominant paradigms — single-pass streaming with O(1) accumulators for counting, tracking, and accumulation problems, or sort-then-two-pointer for pair-finding, ordering, and constraint-satisfaction problems — with the choice determined by whether the problem requires aggregation or search.
- Depends on: single-pass-streaming-dominant-shape, sort-then-two-pointer-dominant-pair-pipeline

### two-pointer-backward-fill-avoids-sort [IN] OBSERVATION
The squares-of-sorted-array solution fills the result array from index n-1 down to 0 using two inward-converging pointers, achieving O(n) time instead of O(n log n) square-then-sort
- Source: entries/2026/06/06/squares-of-a-sorted-array-solution.md

### two-pointer-compaction-extends-streaming-to-in-place-transform [IN] DERIVED
The read/write pointer compaction idiom (used for remove-duplicates, remove-element, move-zeroes) extends single-pass streaming from pure scalar accumulation to in-place array transformation: instead of reducing the input to a scalar accumulator, the write pointer constructs the output array in-place while the read pointer streams through the input, achieving O(1) auxiliary space via mutation rather than via scalar reduction — broadening the streaming paradigm's applicability to problems whose output is a transformed array, not a single value.
- Source type: derived
- Depends on: two-pointer-compaction-family, single-pass-streaming-dominant-shape

### two-pointer-compaction-family [IN] OBSERVATION
Problems 26 (remove duplicates), 27 (remove element), and 283 (move zeroes) all use the same read/write pointer compaction pattern with different keep-predicates; the structural code is identical, only the filter condition varies.
- Source: entries/2026/06/06/remove-element-solution.md

### two-pointer-convergence-linear-time [IN] OBSERVATION
The converging two-pointer pattern in `reverse-only-letters` runs in O(n) time because each pointer advances monotonically inward, collectively visiting each index at most once.
- Source: entries/2026/06/06/reverse-only-letters-solution.md

### two-pointer-convergence-pattern [IN] OBSERVATION
The walk-inward two-pointer technique (left pointer advances right, right pointer advances left, check convergence) recurs across mountain-array, palindrome, and sorted-array solutions.
- Source: entries/2026/06/06/valid-mountain-array-solution.md

### two-pointer-inward-sweep-pattern [IN] OBSERVATION
The two-pointer inward sweep (left from 0, right from end, march inward with subset-specific skip logic) is a recurring pattern used by `reverse-vowels-of-a-string` and `reverse-only-letters` for reversing a character subset in-place.
- Source: entries/2026/06/06/reverse-vowels-of-a-string-solution.md

### two-pointer-is-dual-cursor-streaming [IN] DERIVED
Two-pointer techniques are a structural variant of single-pass streaming using paired cursors: they share streaming's core properties (monotonic progress, O(1) state, single traversal) but generalize the scan by allowing convergent or divergent cursor movement, making them streaming algorithms with a richer cursor model.
- Source type: derived
- Depends on: two-pointer-primary-linear-array-technique, single-pass-streaming-dominant-shape

### two-pointer-merge-scan-for-sorted-intersection [IN] OBSERVATION
`min_common_number` uses the two-pointer merge-scan pattern: advance the pointer on the smaller value, return on equality — the canonical O(n+m) time, O(1) space approach for finding common elements in two sorted arrays.
- Source: entries/2026/06/06/minimum-common-value-solution.md

### two-pointer-pattern-variants [IN] OBSERVATION
The repo contains multiple two-pointer variants: inward sweep (valid-palindrome), lockstep with skip (valid-word-abbreviation), and matrix transpose walk (valid-word-square) — all sharing the fail-fast early-return idiom.
- Source: entries/2026/06/06/valid-palindrome-solution.md

### two-pointer-primary-linear-array-technique [IN] DERIVED
Converging two-pointer patterns — forward/backward fill, inward squeeze, and sorted-pair matching — are the dominant technique for achieving O(n) time on array pair and partition problems.
- Depends on: two-pointer-convergence-linear-time, two-pointer-sorted-array-pattern, two-pointer-backward-fill-avoids-sort, sort-then-two-pointer-pattern

### two-pointer-sorted-array-pattern [IN] OBSERVATION
Solutions pairing min/max elements (e.g., distinct averages) sort once then walk inward with left/right pointers rather than simulating repeated removal, achieving O(n log n) overall.
- Source: entries/2026/06/06/number-of-distinct-averages-solution.md

### two-preprocessing-paradigms-partition-problems [IN] DERIVED
Problems partition by which preprocessing unlocks linear-time solution: hashing (Counter/set) for membership and frequency queries vs sorting for positional and pair relationships, with the core query type — lookup or comparison — determining which paradigm applies.
- Depends on: hash-preprocessing-universal-first-step, sorted-order-enables-all-efficient-search

### two-solution-conventions-coexist [IN] OBSERVATION
The repo uses two conventions for solution entry points: `Solution` class with a method (LeetCode boilerplate style, e.g., `runningSum`) and standalone module-level functions (e.g., `is_same_tree`, `can_transform`, `roman_to_int`).
- Source: entries/2026/06/06/same-tree-solution.md

### two-stack-queue-amortized-o1 [IN] OBSERVATION
Every element in `MyQueue` is transferred from `_in_stack` to `_out_stack` exactly once across its lifetime, so `push`, `pop`, and `peek` are all amortized O(1) despite O(n) worst-case transfers.
- Source: entries/2026/06/06/implement-queue-using-stacks-solution.md

### two-stack-queue-amortized-via-lazy-transfer [IN] DERIVED
The two-stack queue achieves correct FIFO semantics with amortized O(1) per operation through lazy bulk transfer: each element crosses from input to output stack exactly once across its lifetime, push is worst-case O(1) (never triggers transfer), and the deferred reversal preserves total ordering.
- Source type: derived
- Depends on: two-stack-queue-amortized-o1, two-stack-queue-lazy-transfer, two-stack-queue-push-always-o1

### two-stack-queue-lazy-transfer [IN] OBSERVATION
`_transfer` only moves elements when `_out_stack` is empty — it never re-reverses elements already in `_out_stack`, which is the key invariant preserving both correctness and amortized cost.
- Source: entries/2026/06/06/implement-queue-using-stacks-solution.md

### two-stack-queue-push-always-o1 [IN] OBSERVATION
`push` always appends to `_in_stack` and never triggers a transfer, making it worst-case O(1) — not just amortized — unlike `pop` and `peek` which may trigger O(n) transfers.
- Source: entries/2026/06/06/implement-queue-using-stacks-solution.md

### two-sum-complement-lookup-pattern [IN] OBSERVATION
`twoSum` uses a hash map keyed by value (not index) to check whether the complement `target - num` has been seen, which is the canonical O(n) complement lookup idiom
- Source: entries/2026/06/06/two-sum-solution.md

### two-sum-family-spans-lookup-strategy-space [IN] DERIVED
The Two Sum problem family collectively spans the lookup strategy space: hash map for O(1) complement lookup with check-before-insert ordering (classic), frequency counter for duplicate-aware pairing (III), hash set for tree-traversal membership with check-before-insert preventing self-pairing (IV), and sort plus two-pointer for inequality-bounded search (less-than-k) — demonstrating that a single problem concept exercises all major lookup mechanisms in the repo's abstraction trio.
- Source type: derived
- Depends on: two-sum-complement-lookup-pattern, two-sum-iii-add-find-asymmetry, two-sum-iv-check-before-insert, two-sum-less-than-k-time-complexity

### two-sum-iii-add-find-asymmetry [IN] OBSERVATION
`TwoSum` optimizes `add()` to O(1) at the cost of O(n) `find()`; the inverse tradeoff (precompute all sums on add, O(1) find) would be better when finds dominate.
- Source: entries/2026/06/06/two-sum-iii-data-structure-design-solution.md

### two-sum-iii-self-pair-requires-count-two [IN] OBSERVATION
In `TwoSum.find()`, a number can only pair with itself to reach a target if its count in the `Counter` is >= 2; this prevents `add(3); find(6)` from returning `True`.
- Source: entries/2026/06/06/two-sum-iii-data-structure-design-solution.md

### two-sum-implicit-none-on-no-solution [IN] OBSERVATION
If no valid pair exists (violating the problem contract), the function silently returns `None` rather than raising
- Source: entries/2026/06/06/two-sum-solution.md

### two-sum-index-ordering [IN] OBSERVATION
The returned indices are always in ascending order because values enter `seen` strictly before the current index
- Source: entries/2026/06/06/two-sum-solution.md

### two-sum-instantiates-hash-pipeline [IN] DERIVED
The Two Sum family is a canonical instantiation of the hash-then-stream pipeline: the hash map serves as the O(1) preprocessing structure for complement lookup while the single-pass array scan constitutes the streaming phase, with check-before-insert ordering providing construction-based correctness — paralleling palindrome's instantiation through Counter and demonstrating the pipeline's universality across point-lookup and aggregate-frequency query modes.
- Source type: derived
- Depends on: two-sum-family-spans-lookup-strategy-space, hash-preprocessing-universal-first-step

### two-sum-iv-check-before-insert [IN] OBSERVATION
`findTarget` prevents self-pairing by checking the `seen` set *before* inserting the current node's value — the ordering of check-then-add is the critical invariant.
- Source: entries/2026/06/06/two-sum-iv-input-is-a-bst-solution.md

### two-sum-iv-ignores-bst-property [IN] OBSERVATION
`findTarget` uses a generic hash-set approach that works on any binary tree; it does not exploit BST ordering, trading potential O(log n) space for implementation simplicity.
- Source: entries/2026/06/06/two-sum-iv-input-is-a-bst-solution.md

### two-sum-less-than-k-monotonic-convergence [IN] OBSERVATION
Each loop iteration moves exactly one pointer inward, guaranteeing termination in at most n-1 steps
- Source: entries/2026/06/06/two-sum-less-than-k-solution.md

### two-sum-less-than-k-returns-neg-one [IN] OBSERVATION
The function returns `-1` (not `None` or an exception) when no pair sum is strictly less than `k`
- Source: entries/2026/06/06/two-sum-less-than-k-solution.md

### two-sum-less-than-k-sort-mutates [IN] OBSERVATION
`max_sum_under_k` mutates the input list via in-place sort; callers that need the original order must copy first
- Source: entries/2026/06/06/two-sum-less-than-k-solution.md

### two-sum-less-than-k-strict-inequality [IN] OBSERVATION
The comparison is `s < k` (strict), not `s <= k`; a pair summing exactly to `k` is excluded
- Source: entries/2026/06/06/two-sum-less-than-k-solution.md

### two-sum-less-than-k-time-complexity [IN] OBSERVATION
The algorithm runs in O(n log n) time and O(1) auxiliary space via sort + two-pointer
- Source: entries/2026/06/06/two-sum-less-than-k-solution.md

### two-sum-no-self-pair [IN] OBSERVATION
An element cannot pair with itself; the lookup-before-insert order prevents `seen[num]` from matching the current index
- Source: entries/2026/06/06/two-sum-solution.md

### two-sum-single-pass-linear [IN] OBSERVATION
`twoSum` runs in O(n) time and O(n) space via a single-pass hash map, never iterating the array more than once
- Source: entries/2026/06/06/two-sum-solution.md

### twos-complement-mask-pattern [IN] OBSERVATION
Solutions handling signed 32-bit integers use `num &= 0xFFFFFFFF` to reinterpret negative Python integers as unsigned 32-bit two's complement values, bridging Python's arbitrary-precision integers to fixed-width behavior.
- Source: entries/2026/06/06/convert-a-number-to-hexadecimal-solution.md

### typing-import-for-annotations [IN] OBSERVATION
The repo consistently uses `from typing import List` for type annotations rather than Python 3.9+ built-in `list[]` syntax.
- Source: entries/2026/06/06/check-if-two-string-arrays-are-equivalent-solution.md

### typing-list-used-for-compatibility [IN] OBSERVATION
Solutions consistently use `typing.List` for type annotations rather than the built-in `list[str]` syntax available in Python 3.9+, maintaining backward compatibility across the repo.
- Source: entries/2026/06/06/number-of-strings-that-appear-as-substrings-in-word-solution.md

### ugly-number-complexity [IN] OBSERVATION
The total number of divisions across all three primes is O(log n), since each division at least halves `n`
- Source: entries/2026/06/06/ugly-number-solution.md

### ugly-number-one-is-ugly [IN] OBSERVATION
`is_ugly(1)` returns `True` because 1 has no prime factors, so the loop body never executes and `n == 1` holds
- Source: entries/2026/06/06/ugly-number-solution.md

### ugly-number-trial-division-pattern [IN] OBSERVATION
`is_ugly` uses the strip-and-check-residual pattern: divide out all factors of 2, 3, and 5, then check if the remainder is 1
- Source: entries/2026/06/06/ugly-number-solution.md

### ugly-number-zero-guard [IN] OBSERVATION
`is_ugly(0)` returns `False` and never enters the division loop; without the `n <= 0` guard, `0 % 2 == 0` would loop forever
- Source: entries/2026/06/06/ugly-number-solution.md

### uncommon-concat-then-split [IN] OBSERVATION
Concatenating with a space and splitting is equivalent to splitting each sentence independently and merging, because `str.split()` handles multiple consecutive spaces
- Source: entries/2026/06/06/uncommon-words-from-two-sentences-solution.md

### uncommon-counts-globally [IN] OBSERVATION
A word appearing twice in one sentence and zero times in the other is excluded; frequency is counted across the union, not per-sentence
- Source: entries/2026/06/06/uncommon-words-from-two-sentences-solution.md

### uncommon-output-order-is-insertion-order [IN] OBSERVATION
The returned list preserves the left-to-right first-occurrence order of words across the combined input (Python 3.7+ dict ordering guarantee)
- Source: entries/2026/06/06/uncommon-words-from-two-sentences-solution.md

### uniform-frequency-set-idiom [IN] OBSERVATION
`len(set(counter.values())) == 1` is used as the canonical check for whether all character frequencies are equal throughout the repo.
- Source: entries/2026/06/06/remove-letter-to-equalize-frequency-solution.md

### union-by-rank-increments-on-tie-only [IN] OBSERVATION
Rank is incremented only when merging two roots of equal rank, maintaining it as an upper bound on subtree height.
- Source: entries/2026/06/06/find-if-path-exists-in-graph-solution.md

### union-find-uses-path-splitting [IN] OBSERVATION
The `find` function in `find-if-path-exists-in-graph/solution.py` uses iterative path splitting (`parent[x] = parent[parent[x]]`), which halves path length per traversal, not full recursive path compression that flattens to the root.
- Source: entries/2026/06/06/find-if-path-exists-in-graph-solution.md

### unknown-chars-treated-as-present [IN] OBSERVATION
Characters outside `{'A', 'L', 'P'}` fall into the `else` branch and behave identically to `'P'` (resetting late counter, not incrementing absences)
- Source: entries/2026/06/06/student-attendance-record-i-solution.md

### unlimited-swaps-equals-independent-sort [IN] OBSERVATION
For problems where unlimited swaps are allowed within a partition (e.g., same-parity digits), the optimal strategy reduces to sorting each partition group independently in descending order — this pattern appears in `largest-number-after-digit-swaps-by-parity` and likely recurs across similar problems
- Source: entries/2026/06/06/largest-number-after-digit-swaps-by-parity-solution.md

### valid-palindrome-case-insensitive-at-compare [IN] OBSERVATION
Case normalization happens at comparison time via `.lower()`, not by preprocessing the entire string — the original string is never mutated or copied.
- Source: entries/2026/06/06/valid-palindrome-solution.md

### valid-palindrome-empty-is-palindrome [IN] OBSERVATION
An empty string or a string with no alphanumeric characters returns `True` because the outer loop condition `left < right` is never satisfied.
- Source: entries/2026/06/06/valid-palindrome-solution.md

### valid-palindrome-inner-loop-guards [IN] OBSERVATION
The inner skip loops re-check `left < right`, which prevents index-out-of-bounds on strings containing no alphanumeric characters.
- Source: entries/2026/06/06/valid-palindrome-solution.md

### valid-palindrome-uses-o1-space [IN] OBSERVATION
`isPalindrome` uses O(1) auxiliary space via two-pointer inward sweep; it never allocates a filtered or reversed copy of the input string.
- Source: entries/2026/06/06/valid-palindrome-solution.md

### valid-parentheses-final-stack-empty-check [IN] OBSERVATION
The final `return not stack` is required to reject inputs with unmatched openers (e.g., `"("`); without it, any string whose closers all match would pass regardless of leftover openers.
- Source: entries/2026/06/06/valid-parentheses-solution.md

### valid-parentheses-match-dict-dual-use [IN] OBSERVATION
The `match` dict serves both as a closer-detection set (`ch in match`) and as a closer-to-opener lookup, eliminating the need for a separate set or if-chain.
- Source: entries/2026/06/06/valid-parentheses-solution.md

### valid-parentheses-no-index-error [IN] OBSERVATION
Short-circuit evaluation of `not stack or stack.pop() != match[ch]` guarantees `pop` is never called on an empty list; a lone closer like `")"` returns `False` without raising `IndexError`.
- Source: entries/2026/06/06/valid-parentheses-solution.md

### valid-parentheses-single-pass-stack [IN] OBSERVATION
`is_valid` uses a single-pass stack-based approach with O(n) time and O(n) worst-case space; it short-circuits on the first mismatch.
- Source: entries/2026/06/06/valid-parentheses-solution.md

### valid-word-hyphen-boundary-safe [IN] OBSERVATION
The hyphen validation in `is_valid` checks `i == 0 or i == len(token) - 1` and returns `False` before accessing `token[i-1]` or `token[i+1]`, guaranteeing no `IndexError`
- Source: entries/2026/06/06/number-of-valid-words-in-a-sentence-solution.md

### valid-word-punctuation-position-before-count [IN] OBSERVATION
A punctuation character not at the final position causes immediate rejection in `is_valid`, independent of `punct_count` — position is checked before count matters
- Source: entries/2026/06/06/number-of-valid-words-in-a-sentence-solution.md

### valid-word-single-pass-validation [IN] OBSERVATION
`is_valid` validates all character constraints (digits, hyphens, punctuation) in a single left-to-right pass with early returns — no regex or multi-pass scanning
- Source: entries/2026/06/06/number-of-valid-words-in-a-sentence-solution.md

### valid-word-square-boundary-as-logic [IN] OBSERVATION
The three-part boundary condition (`j >= len(words)`, `i >= len(words[j])`, character mismatch) both enforces the word-square invariant and prevents all `IndexError` scenarios in a single expression.
- Source: entries/2026/06/06/valid-word-square-solution.md

### valid-word-square-handles-ragged-input [IN] OBSERVATION
`valid_word_square` correctly handles words of different lengths without padding; a missing character position is treated as a structural mismatch.
- Source: entries/2026/06/06/valid-word-square-solution.md

### valid-word-square-single-direction-sufficient [IN] OBSERVATION
Iterating only over existing characters in rows (not separately over columns) is sufficient to validate the word square because any extra column character at `(j, i)` would be caught when row `j` is iterated as the outer loop.
- Source: entries/2026/06/06/valid-word-square-solution.md

### visit-all-points-order-is-fixed [IN] OBSERVATION
`minimum-time-visiting-all-points/solution.py` visits points strictly in input order — it solves a sequential traversal, not the traveling salesman problem.
- Source: entries/2026/06/06/minimum-time-visiting-all-points-solution.md

### visit-before-enqueue-prevents-duplicates [IN] OBSERVATION
In `matrix-cells-in-distance-order/solution.py`, marking cells as visited at enqueue time (not dequeue time) ensures each cell enters the queue at most once, preventing duplicate work and incorrect output.
- Source: entries/2026/06/06/matrix-cells-in-distance-order-solution.md

### vowel-set-module-level [IN] OBSERVATION
The `VOWELS` set in `count-the-number-of-vowel-strings-in-range/solution.py` is allocated once at module load, not per method call, paired with a module-level `is_vowel` helper outside the `Solution` class
- Source: entries/2026/06/06/count-the-number-of-vowel-strings-in-range-solution.md

### vowel-strings-range-no-precomputation [IN] OBSERVATION
`vowelStrings` performs a single O(n) linear scan with no prefix sums or caching — repeated queries over the same array would each pay full cost
- Source: entries/2026/06/06/count-the-number-of-vowel-strings-in-range-solution.md

### vowel-substring-consonant-break [IN] OBSERVATION
The inner loop `break` on consonants guarantees no substring containing a consonant is ever counted, and prunes all extensions from position `i` past the first consonant
- Source: entries/2026/06/06/count-vowel-substrings-of-a-string-solution.md

### vowel-substrings-quadratic-by-design [IN] OBSERVATION
`count_vowel_substrings` is O(n²) worst-case by design, acceptable given the problem's n ≤ 100 constraint — an O(n) sliding-window solution exists but is not used here
- Source: entries/2026/06/06/count-vowel-substrings-of-a-string-solution.md

### water-bottles-flat-function [IN] OBSERVATION
The water bottles solution uses a bare `numWaterBottles` function rather than a `Solution` class, diverging from the LeetCode class-based template used by other solutions in the repo.
- Source: entries/2026/06/06/water-bottles-solution.md

### water-bottles-loop-terminates [IN] OBSERVATION
The water bottles simulation loop terminates for all valid inputs because `empties` strictly decreases each iteration when `numExchange >= 2`.
- Source: entries/2026/06/06/water-bottles-solution.md

### water-bottles-simulation-not-closed-form [IN] OBSERVATION
The water bottles solution uses iterative greedy simulation (O(log n) rounds) even though an O(1) closed-form exists: `numBottles + (numBottles - 1) // (numExchange - 1)`.
- Source: entries/2026/06/06/water-bottles-solution.md

### weakest-rows-ignores-sorted-row-property [IN] OBSERVATION
The k-weakest-rows solution uses `sum(row)` to count soldiers, ignoring the constraint that 1s always precede 0s — a property that would allow O(log n) binary search per row instead of O(n) summation.
- Source: entries/2026/06/06/the-k-weakest-rows-in-a-matrix-solution.md

### weakest-rows-silent-truncation-on-large-k [IN] OBSERVATION
If `k > len(mat)`, the k-weakest-rows solution silently returns fewer than `k` elements via Python's slice behavior rather than raising an error.
- Source: entries/2026/06/06/the-k-weakest-rows-in-a-matrix-solution.md

### weakest-rows-stable-sort-tiebreak [IN] OBSERVATION
The k-weakest-rows solution relies on Python's stable sort guarantee for index-based tiebreaking rather than encoding row index as a secondary sort key.
- Source: entries/2026/06/06/the-k-weakest-rows-in-a-matrix-solution.md

### week-k-total-is-28-plus-7k [IN] OBSERVATION
Each 0-indexed complete week `k` contributes exactly `28 + 7k` to the total; the formula sums this series as `28W + 7·W(W-1)/2` where `W` is the number of complete weeks.
- Source: entries/2026/06/06/calculate-money-in-leetcode-bank-solution.md

### well-spaced-early-exit [IN] OBSERVATION
`well_spaced_string` returns `False` on the first letter pair that violates its distance constraint, short-circuiting without examining remaining letters.
- Source: entries/2026/06/06/check-distances-between-same-letters-solution.md

### well-spaced-exclusive-distance [IN] OBSERVATION
The distance formula `i - first_seen[c] - 1` counts characters *strictly between* the two occurrences, excluding both endpoints — matching the LeetCode problem's definition.
- Source: entries/2026/06/06/check-distances-between-same-letters-solution.md

### well-spaced-first-seen-dict-pattern [IN] OBSERVATION
`well_spaced_string` uses the single-pass first-seen-index dict pattern: record each character's first index, act on the second occurrence — the same pattern used by two-sum, first-duplicate, and related problems.
- Source: entries/2026/06/06/check-distances-between-same-letters-solution.md

### well-spaced-third-occurrence-bug [IN] OBSERVATION
If a letter appeared three times (violating the precondition), the third occurrence would silently compare against the first occurrence's index rather than the second — a latent bug guarded only by the problem's guarantee.
- Source: entries/2026/06/06/check-distances-between-same-letters-solution.md

### within-domain-correctness-comprehensive [IN] DERIVED
Solutions achieve comprehensive correctness for all inputs within LeetCode's stated constraints, covering both edge cases (empty inputs, zero, single elements) and general cases (via construction techniques including exact arithmetic, sentinel initialization, and streaming invariants).
- Source type: derived
- Depends on: edge-case-inputs-crash-free, construction-correctness-universal-for-valid-inputs
- Unless: pillow-holder-n1-crash, zero-input-returns-false, zero-input-returns-wrong-result, find-difference-reduce-no-initial-value

### word-abbreviation-colocated-tests [IN] OBSERVATION
`valid-word-abbreviation/solution.py` colocates implementation and 16 `unittest` test cases in a single module, runnable via `python -m unittest` — this is described as the standard layout across the repo.
- Source: entries/2026/06/06/valid-word-abbreviation-solution.md

### wrap-case-output-is-sorted [IN] OBSERVATION
In the most-visited-sector solution, the wrap-around case (`start > end`) concatenates `range(1, end+1)` before `range(start, n+1)`, producing ascending order because `end < start` is a precondition of that branch.
- Source: entries/2026/06/06/most-visited-sector-in-a-circular-track-solution.md

### wrapper-name-mismatch-minimize-the-difference [IN] OBSERVATION
The module-level wrapper in `find-first-palindromic-string-in-the-array/solution.py` is named `minimizeTheDifference` despite solving a palindrome problem — likely a copy-paste artifact from the code generation pipeline.
- Source: entries/2026/06/06/find-first-palindromic-string-in-the-array-solution.md

### wrapper-name-mismatch-pattern [IN] OBSERVATION
Some solutions have wrapper functions whose names don't match the problem semantics (e.g., `min_months` wrapping a pair-counting problem), suggesting automated generation of wrapper names rather than manual authoring.
- Source: entries/2026/06/06/count-equal-and-divisible-pairs-in-an-array-solution.md

### wrong-method-name-mctFromLeafValues [IN] OBSERVATION
`missing-number-in-arithmetic-progression/solution.py` has its method named `mctFromLeafValues` (from LeetCode 1130) but implements the missing-number-in-AP algorithm (LeetCode 1228) — a copy-paste naming bug.
- Source: entries/2026/06/06/missing-number-in-arithmetic-progression-solution.md

### wrong-method-name-min-start-value [IN] OBSERVATION
`minimum-value-to-get-positive-step-by-step-sum/solution.py` has its method named `maxSideLength` (from LeetCode 1292) but implements `minStartValue` (LeetCode 1413) — a copy-paste naming bug.
- Source: entries/2026/06/06/minimum-value-to-get-positive-step-by-step-sum-solution.md

### x-matrix-full-scan-required [IN] OBSERVATION
The X-matrix check must visit all `n*n` cells because off-diagonal zeros must be verified, not just diagonal non-zeros; checking only diagonals would miss non-zero off-diagonal elements.
- Source: entries/2026/06/06/check-if-matrix-is-x-matrix-solution.md

### xor-accumulator-identity-zero [IN] OBSERVATION
The XOR operation solution initializes its accumulator to `0` because `0` is the identity element for XOR (`x ^ 0 = x`), following the standard reduce-over-XOR idiom.
- Source: entries/2026/06/06/xor-operation-in-an-array-solution.md

### xor-binary-flip-pattern [IN] OBSERVATION
The `^ 1` idiom for binary value inversion (0↔1) appears across multiple solutions in the repo, including `flipping-an-image`, `complement-of-base-10-integer`, and `number-complement`.
- Source: entries/2026/06/06/flipping-an-image-solution.md

### xor-cancellation-finds-extra-char [IN] OBSERVATION
`findTheDifference` uses XOR cancellation (`reduce(xor, ...)`) over the ordinals of `s + t` to isolate the single extra character — every matched character cancels to zero.
- Source: entries/2026/06/06/find-the-difference-solution.md

### xor-decode-deterministic [IN] OBSERVATION
Given `encoded` and `first`, the XOR decode produces exactly one valid original array — the decoding is unique because XOR is its own inverse (`a ^ b ^ b = a`).
- Source: entries/2026/06/06/decode-xored-array-solution.md

### xor-for-bit-diff [IN] OBSERVATION
XOR is the canonical idiom in this repo for isolating differing bit positions between two integers; `minBitFlips` and `hammingDistance` are functionally identical implementations of Hamming distance.
- Source: entries/2026/06/06/minimum-bit-flips-to-convert-number-solution.md

### xor-instantiates-streaming-for-bit-domain [IN] DERIVED
XOR's three roles in the repo (cancellation for isolating unique elements, diffing for detecting bit changes, flipping for bitwise inversion) align naturally with the single-pass streaming paradigm — each role operates via simple accumulation or per-element transformation compatible with a left-to-right scan over O(1) state. This makes XOR a primary instantiation of the streaming shape for bit-manipulation problems, analogous to how frequency-counting accumulators serve the same role in other domains.
- Depends on: xor-universal-bit-primitive, single-pass-streaming-dominant-shape

### xor-mask-width-matches-input [IN] OBSERVATION
The complement mask is always exactly `num.bit_length()` bits wide via `(1 << bit_length) - 1`, so the complement never introduces bits above the MSB of the input — this is what distinguishes it from a fixed-width (e.g., 32-bit) complement.
- Source: entries/2026/06/06/number-complement-solution.md

### xor-op-virtual-array [IN] OBSERVATION
The XOR operation solution never allocates the array `nums[i] = start + 2*i`; elements are computed inline during the XOR fold, keeping space at O(1).
- Source: entries/2026/06/06/xor-operation-in-an-array-solution.md

### xor-shift-produces-all-ones [IN] OBSERVATION
For any integer with alternating bits, `n ^ (n >> 1)` produces a value of the form `2^k - 1` (all ones), which is the invariant the solution checks.
- Source: entries/2026/06/06/binary-number-with-alternating-bits-solution.md

### xor-universal-bit-primitive [IN] DERIVED
XOR serves as the universal primitive for bit-level computation across the repo, instantiated in three distinct roles: cancellation (isolating unique or extra elements via the self-inverse property), diffing (counting positional bit differences for Hamming distance), and flipping (toggling binary values via `^ 1`) — each exploiting a different algebraic property of the same operation.
- Depends on: xor-cancellation-finds-extra-char, xor-for-bit-diff, xor-binary-flip-pattern

### zero-coupling-cost-invisible-at-runtime [IN] DERIVED
The costs of zero-coupling isolation — tooling confusion, naming drift, convention divergence, duplicated definitions — are exclusively non-runtime phenomena; at execution time, duplication is free (every copy is independently correct) and isolation's side effects (misleading imports, stale aliases) never manifest.
- Source type: derived
- Depends on: duplication-cost-free-when-implementations-correct, isolation-side-effects-invisible-at-runtime

### zero-element-skipped-in-digit-sum [IN] OBSERVATION
A `0` element contributes nothing to `digit_sum` because the `while num > 0` loop body never executes for zero — correct under the LeetCode constraint `nums[i] >= 1` but would silently drop zeros if the constraint were relaxed.
- Source: entries/2026/06/06/difference-between-element-sum-and-digit-sum-of-an-array-solution.md

### zero-init-assumes-nonneg-input [IN] OBSERVATION
`max_product` initializes `max1 = max2 = 0`, which is only correct because the problem guarantees all elements are >= 1; negative inputs would never beat the initial zero and the tracker would silently return a wrong result.
- Source: entries/2026/06/06/maximum-product-of-two-elements-in-an-array-solution.md

### zero-on-empty-qualifying-set [IN] OBSERVATION
`average_even_divisible_by_three` returns 0 (not an error) when no elements satisfy the divisibility-by-6 filter, guarding against ZeroDivisionError with an explicit `if count` check.
- Source: entries/2026/06/06/average-value-of-even-numbers-that-are-divisible-by-three-solution.md

### zero-removal-required-for-correctness [IN] OBSERVATION
The `- {0}` set difference in `minOperations` is necessary for correctness: without it, an all-zeros input like `[0, 0, 0]` would incorrectly return `1` instead of `0`.
- Source: entries/2026/06/06/make-array-zero-by-subtracting-equal-amounts-solution.md

### zero-special-cased-in-hex-conversion [IN] OBSERVATION
`to_hex` special-cases zero with an early return because the digit-extraction loop requires `num > 0` to execute; without the guard, zero input produces an empty string.
- Source: entries/2026/06/06/convert-a-number-to-hexadecimal-solution.md

### zip-silent-truncation-risk [IN] OBSERVATION
`busyStudent` uses `zip(startTime, endTime)` which silently truncates to the shorter list if lengths differ — no error raised on mismatched inputs.
- Source: entries/2026/06/06/number-of-students-doing-homework-at-a-given-time-solution.md

### zip-truncates-silently-on-length-mismatch [IN] OBSERVATION
`min_moves_to_seat` uses `zip(sorted(seats), sorted(students))` — if the two lists differ in length, `zip` silently truncates to the shorter one, producing a wrong answer with no error.
- Source: entries/2026/06/06/minimum-number-of-moves-to-seat-everyone-solution.md

### binary-gap-negative-input-infinite-loop [OUT] OBSERVATION
Passing a negative integer to `binary_gap` causes an infinite loop because Python's arbitrary-precision right-shift of a negative number never reaches `0`.
- Source: entries/2026/06/06/binary-gap-solution.md

### boundary-handling-complete-unless-degenerate-input-escapes [OUT] DERIVED
Streaming's structural boundary handling (sentinel initialization + early exit) combined with observed crash-freedom for degenerate inputs jointly establish that the streaming paradigm handles all boundary conditions without conditional logic — provided no degenerate input (single-element, empty, zero) escapes the sentinel+early-exit net.
- Source type: derived
- Depends on: streaming-boundary-handling-structurally-complete, edge-case-inputs-crash-free
- Unless: pillow-holder-n1-crash, min-on-empty-is-unguarded

### build-helper-uses-list-pop-zero [OUT] OBSERVATION
`_build` constructs trees via BFS using `queue.pop(0)`, which is O(n) per pop on a Python list, making tree construction O(n^2) — acceptable for small test inputs but not optimal
- Source: entries/2026/06/06/subtree-of-another-tree-solution.md

### circular-sentence-nonempty-assumed [OUT] OBSERVATION
`is_circular` accesses `sentence[0]` and `sentence[-1]` unconditionally; an empty string raises `IndexError`.
- Source: entries/2026/06/06/circular-sentence-solution.md

### correctness-and-efficiency-unified-by-construction [OUT] DERIVED
Some structural mechanisms serve both correctness and efficiency rather than addressing them as separate concerns: sentinel initialization can prevent boundary bugs while also eliminating first-iteration branching, and exact arithmetic can prevent precision errors while also avoiding float conversion overhead. However, the antecedents identify these as construction techniques for correctness and work-elimination strategies for efficiency respectively — the dual-purpose nature is an observed overlap rather than a demonstrated unifying principle, and the greedy-algorithm claim (simultaneous optimality guarantee and early exit) is not supported by either antecedent.
- Depends on: correctness-by-construction-not-validation, work-elimination-at-two-abstraction-levels

### defaults-enable-streaming-self-sufficiency [STALE] DERIVED
Counter's zero-default for missing keys and sentinel initialization for loop state are not independent convenience features but structurally coupled components of the streaming paradigm: both encode boundary conditions into initial state so that the streaming loop body requires no special-case logic — well-chosen defaults are the mechanism that makes streaming self-sufficient rather than requiring explicit setup.
- Depends on: defaults-encode-domain-knowledge-at-every-layer, streaming-is-self-sufficient-paradigm
- Stale reason: research: abandoned — The belief commits a category error: Counter's zero-default belongs to the hash-based preprocessing paradigm (frequency counting via hash maps), not to streaming. Streaming is explicitly defined as requiring no preprocessing, so Counter defaults cannot be its 'hidden infrastructure.' This isn't an overstatement fixable by softening — the claim structurally conflates two paradigms that the antecedents themselves distinguish. No additional antecedent could bridge this because the conflation is in the conclusion's logic, not in missing evidence.

### digit-operations-handle-all-nonneg-inputs [OUT] DERIVED
String-based digit manipulation solutions correctly handle all non-negative integer inputs including zero and multi-digit numbers.
- Depends on: str-conversion-digit-extraction-idiom, zero-element-skipped-in-digit-sum, getlucky-first-sum-on-string
- Unless: digit-sum-no-validation, digits-dividing-num-no-zero-guard

### distance-value-mutates-arr2 [OUT] OBSERVATION
`findTheDistanceValue` mutates the input `arr2` in-place via `.sort()` rather than using `sorted()`, reordering the caller's list as a side effect.
- Source: entries/2026/06/06/find-the-distance-value-between-two-arrays-solution.md

### domain-determines-complete-system-character [OUT] DERIVED
The LeetCode domain is a primary explanatory factor for two systematic properties of the codebase: (1) the quality equilibrium, where the judge reward signal selects for algorithmic investment over engineering robustness and structural constraints make this profile a stable attractor, and (2) the complete taxonomic structure, where both the three-strategy partition and the dual classification-optimization pipeline emerge from problem-space constraints alone. Together these suggest that domain constraints account for major systematic patterns in the codebase, though this does not preclude additional influences from individual developer decisions or coordination mechanisms.
- Depends on: domain-is-fixed-point-of-quality-dynamics, domain-sufficient-for-complete-taxonomic-structure

### domain-sufficient-for-complete-taxonomic-structure [OUT] DERIVED
Domain constraints from the problem space are sufficient to produce algorithmic convergence — including the closed three-strategy partition of the solution space — without coordination. The pipeline decomposition that emerges from these constraints additionally serves a dual role as both classification criterion and optimization mechanism. However, while the taxonomic structure and its dual classification-optimization character arise naturally from problem structure, engineering-level consistency (naming, testing, code structure) requires active process enforcement beyond what domain constraints alone provide.
- Depends on: pipeline-decomposition-unifies-classification-and-optimization, domain-constraints-sufficient-for-algorithmic-not-engineering-convergence

### dp-rolling-reduction-correct-unless-degenerate-input [OUT] DERIVED
The DP-to-rolling-variable reduction extends the O(1)-space running accumulator pattern from streaming to dynamic programming, collapsing O(n) DP tables to O(1) rolling variables while preserving recurrence correctness for all inputs within LeetCode constraints.
- Source type: derived
- Depends on: min-cost-dp-uses-constant-space, o1-space-via-running-accumulators
- Unless: min-cost-assumes-length-ge-2

### exact-arithmetic-prevents-all-precision-errors [OUT] DERIVED
The combination of stdlib-delegated exact data structures (Counter for exact frequencies, set for exact membership) and construction-based exact arithmetic (isqrt, integer division, sentinel initialization) should prevent all precision-related errors across the repo.
- Depends on: stdlib-reinforces-exactness, correctness-by-construction-not-validation
- Unless: tax-float-division-imprecision

### find-difference-reduce-no-initial-value [OUT] OBSERVATION
`findTheDifference` calls `reduce` without an initial value, so it raises `TypeError` if both `s` and `t` are empty (empty sequence with no initial value).
- Source: entries/2026/06/06/find-the-difference-solution.md

### function-name-mismatches-behavior [OUT] OBSERVATION
`get_max_occurrences` in `greatest-english-letter-in-upper-and-lower-case/solution.py` does not count occurrences — it finds the greatest letter appearing in both cases; the name is likely a repo-wide template artifact.
- Source: entries/2026/06/06/greatest-english-letter-in-upper-and-lower-case-solution.md

### greedy-optimality-requires-nonnegative-domain [OUT] DERIVED
Greedy algorithms in the repo are provably optimal across their problem domains, but this universal optimality claim is contingent on non-negative input values — at least one greedy sort-then-pair strategy (max_product_difference) is correct only for positive inputs, where magnitude ordering coincides with value ordering.
- Source type: derived
- Depends on: greedy-algorithms-provably-optimal
- Unless: sort-greedy-positive-only

### greedy-with-early-exit-maximizes-pruning [STALE] DERIVED
Greedy algorithms in the repo are systematically paired with early-exit conditions — returning on first violation, terminating on deadlock detection, short-circuiting on zero — so that provably-optimal local choices combine with aggressive pruning to minimize both time complexity and actual executed instructions.
- Depends on: greedy-algorithms-provably-optimal, early-exit-optimizations-pervasive
- Stale reason: research: abandoned — The antecedents describe two independent patterns observed in completely disjoint problem sets with no overlapping solutions. The claim that greedy algorithms are 'systematically paired' with early-exit conditions is not just overstated — it's fabricated from unrelated observations. Softening would still assert a relationship (e.g., 'sometimes co-occur') that has zero evidential support. The synergy argument ('greedy without early-exit still does unnecessary work') is a theoretical observation, not something derived from the codebase evidence. No amount of rewording fixes a derivation whose antecedents share no common ground.

### input-mutation-convention-coherent [OUT] DERIVED
The in-place mutation with return convention forms a coherent repo-wide pattern, but inconsistent mutation behavior across solutions undermines it — some solutions mutate in-place for space efficiency while others create copies for the same category of operation, with no systematic policy governing which approach to use.
- Source type: derived
- Depends on: in-place-mutation-with-return-convention
- Unless: solutions-inconsistent-input-mutation

### integer-accumulators-precision-safe [OUT] DERIVED
Scalar streaming accumulators achieve exact results for all inputs within LeetCode's constraint bounds because Python's arbitrary-precision integers prevent overflow and the repo systematically chooses integer arithmetic over floating-point — but this precision guarantee breaks for any solution that introduces floating-point division into the accumulation chain.
- Source type: derived
- Depends on: o1-space-via-running-accumulators, integer-arithmetic-avoids-float-precision
- Unless: tax-float-division-imprecision

### language-causally-determines-convergence-landscape [OUT] DERIVED
Python's language-level defaults are a primary determinant of the convergence landscape: they privilege streaming by making it self-sufficient (Counter's zero-default, set's O(1) membership, arbitrary-precision integers require no external infrastructure), and this self-sufficiency aligns with the adoption-barrier gradient that makes convergence strength predictable from prerequisite count — suggesting the convergence pattern is substantially shaped by the host language's built-in semantics, not solely by the problem domain.
- Depends on: language-defaults-determine-strategy-privilege, adoption-barrier-gradient-explains-convergence-pattern

### language-defaults-determine-strategy-privilege [OUT] DERIVED
Python's language-level defaults — particularly Counter's zero-default for missing keys and sentinel initialization for loop state — are a primary mechanism that makes streaming self-sufficient by encoding boundary conditions into initial state, removing the need for special-case logic in loop bodies. Because streaming is the privileged default strategy (self-sufficient, covering the largest problem subset with the tightest resource bounds), these defaults help explain why streaming occupies its dominant position in the solution taxonomy: the language's built-in semantics align with the prerequisites of the strategy that needs the least external support.
- Depends on: defaults-enable-streaming-self-sufficiency, streaming-is-privileged-default-strategy

### language-produces-quality-inversion-through-streaming [OUT] DERIVED
Python's language defaults produce the quality inversion through a specific three-step causal chain: language features determine which strategies are self-sufficient, streaming is privileged because it requires no abstractions beyond what the language provides natively, and streaming's dominance is the specific mechanism through which algorithmic quality outpaces engineering quality — making the quality inversion a downstream consequence of language design rather than developer choice.
- Depends on: language-defaults-determine-strategy-privilege, streaming-is-mechanism-of-quality-inversion

### max-distance-mutates-input [OUT] OBSERVATION
`max_distance` sorts `nums` in-place; callers cannot rely on the original ordering after the call.
- Source: entries/2026/06/06/minimum-difference-between-highest-and-lowest-of-k-scores-solution.md

### misnamed-module-exports-in-test-harness [OUT] OBSERVATION
Some solution modules export a module-level alias (e.g., `count_balls = Solution().replaceDigits`) that does not match the actual problem — this is a code-generation artifact from the repo's test harness, not a logic error.
- Source: entries/2026/06/06/replace-all-digits-with-characters-solution.md

### negative-input-causes-nontermination [OUT] OBSERVATION
`hamming_weight` has no guard against negative inputs; on Python's arbitrary-precision integers, `n &= n - 1` on a negative value never reaches zero, causing an infinite loop
- Source: entries/2026/06/06/number-of-1-bits-solution.md

### pillow-holder-n1-crash [OUT] OBSERVATION
Calling `pillowHolder(1, t)` for any `t > 0` raises `ZeroDivisionError` because `cycle` is 0
- Source: entries/2026/06/06/pass-the-pillow-solution.md

### pipeline-decomposition-unifies-classification-and-optimization [OUT] DERIVED
The preprocess-then-stream pipeline decomposition serves a dual structural role: it is simultaneously the classification criterion that partitions the solution taxonomy into three exhaustive strategies AND the optimization mechanism that achieves correctness, time efficiency, and space efficiency — the same structural cut that classifies solutions also optimizes them.
- Depends on: taxonomy-closed-and-structurally-partitioned, triple-optimization-unified-by-pipeline-decomposition

### remove-dupes-assumes-nonempty [OUT] OBSERVATION
`removeDuplicates` starts `k=1` with no empty-list guard, so an empty input returns 1 instead of 0 — a latent bug masked by LeetCode's `1 <= nums.length` constraint.
- Source: entries/2026/06/06/remove-duplicates-from-sorted-array-solution.md

### resource-optimization-coordinated-across-pipeline [STALE] DERIVED
Resource optimization is coordinated across the two pipeline phases: the preprocessing phase minimizes space via in-place mutation of inputs, while the streaming phase minimizes time via O(1) scalar accumulators, so neither phase's optimization strategy compromises the other's.
- Depends on: preprocess-then-stream-is-canonical-pipeline, streaming-and-mutation-jointly-minimize-footprint
- Stale reason: research: abandoned — The belief's central structural claim — that preprocessing minimizes space via in-place mutation — directly contradicts its own antecedent, which says preprocessing BUILDS hash structures (Counter, set), increasing space. This isn't an overstatement fixable by softening; it's a misattribution of which phase performs which optimization. Nor would a missing antecedent help, since the existing antecedent actively contradicts the mapping. The coordination narrative as constructed is unsound.

### rook-position-default-zero [OUT] OBSERVATION
If no rook is present on the board, the code silently treats cell (0, 0) as the rook position rather than raising an error — a latent bug if input constraints are ever relaxed.
- Source: entries/2026/06/06/available-captures-for-rook-solution.md

### sort-preprocessing-universally-correct [OUT] DERIVED
Sort-then-scan preprocessing produces correct results across all solutions that use it, because sorting establishes exactly the adjacency and monotonicity invariants that the subsequent linear scan requires for correctness.
- Source type: derived
- Depends on: sort-preprocessing-enables-linear-scan, correctness-by-construction-not-validation
- Unless: sort-people-assumes-distinct-heights

### stdlib-construction-composable-correctness [OUT] DERIVED
The combination of stdlib delegation (exact arithmetic, correct data structures) and construction techniques (sentinel initialization, streaming invariants) should compose to provide end-to-end correctness guarantees — no manual reimplementation means no reimplementation bugs, and construction eliminates boundary-condition errors.
- Depends on: stdlib-reinforces-exactness, correctness-by-construction-not-validation
- Unless: min-on-empty-is-unguarded, zero-input-returns-false

### stdlib-delegation-safe-under-input-contracts [OUT] DERIVED
Delegating computation to Python stdlib abstractions (Counter, min, reduce, sorted, set) is safe when LeetCode's input contracts hold, because the stdlib functions handle all valid inputs correctly without explicit error handling.
- Depends on: python-stdlib-preferred-over-manual-algorithms, no-validation-is-deliberate-contract
- Unless: min-on-empty-is-unguarded, find-difference-reduce-no-initial-value

### streaming-is-mechanism-of-quality-inversion [STALE] DERIVED
Streaming is the specific mechanism through which algorithmic quality outpaces engineering quality: it achieves the strongest convergence (via lowest adoption barrier) while requiring the least engineering infrastructure (no preprocessing, no coordination, no shared abstractions), making the quality inversion an inevitable structural consequence rather than a contingent outcome.
- Depends on: streaming-dominates-because-lowest-adoption-barrier, quality-inversion-algorithmic-vs-engineering
- Stale reason: research: abandoned — The belief sits at depth 6 with 2 flagged ancestors, meaning its foundation is already crumbling. The review correctly identifies two fatal problems: (1) it claims streaming is THE specific mechanism for quality inversion, but the quality inversion involves multiple independent factors (exact arithmetic, stdlib delegation) that have nothing to do with streaming, and (2) the causal claim in the first antecedent is itself unsound. Softening wouldn't help because even a weakened version ('streaming is a contributing factor') would still rest on the unsound causal claim in the ancestor. The logical chain from 'streaming has low adoption barrier' to 'this explains why algorithmic quality exceeds engineering quality' is a non-sequitur — low adoption barrier explains paradigm convergence, not the quality gap between algorithm design and engineering discipline.

### streaming-quality-divergence-requires-safety [OUT] DERIVED
Streaming's self-sufficiency enables the quality divergence (high algorithmic quality achieved without engineering discipline) only while the streaming paradigm's implicit language-level safety assumptions hold — when Python's arbitrary-precision semantics cause streaming algorithms to fail on inputs outside problem constraints, the clean divergence story is incomplete.
- Depends on: streaming-is-mechanism-of-quality-inversion, streaming-is-self-sufficient-paradigm
- Unless: negative-input-causes-nontermination

### triple-optimization-unified-by-pipeline-decomposition [OUT] DERIVED
The pipeline architecture simultaneously achieves three optimizations through a single structural decomposition: correctness (construction techniques prevent errors at each phase boundary), efficiency (mathematical reduction and early exit eliminate work within phases), and resource minimization (streaming minimizes time while mutation minimizes space) — these are co-products of the pipeline, not independently layered concerns.
- Depends on: correctness-and-efficiency-unified-by-construction, resource-optimization-coordinated-across-pipeline

### work-elimination-at-two-abstraction-levels [OUT] DERIVED
Solutions eliminate unnecessary computation at two levels: mathematical reduction removes entire computational phases (closed-form replaces iteration), while early-exit pruning removes unnecessary iterations within remaining phases — together minimizing work from both above and below.
- Depends on: mathematical-insight-replaces-brute-computation, greedy-with-early-exit-maximizes-pruning

### zero-input-returns-false [OUT] OBSERVATION
Passing `num=0` to `is_perfect_square` returns `False` (the loop body never executes because `lo=1 > hi=0`), even though 0 is technically a perfect square — a known edge-case gap.
- Source: entries/2026/06/06/valid-perfect-square-solution.md

### zero-input-returns-wrong-result [OUT] OBSERVATION
`subtract_product_and_sum(0)` returns 1 (loop never executes, product=1 minus sum=0) which is mathematically incorrect, but the problem guarantees `n >= 1`
- Source: entries/2026/06/06/subtract-the-product-and-sum-of-digits-of-an-integer-solution.md
