{"id":"two-preprocessing-paradigms-partition-problems","text":"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.","truth_value":"IN","source":"","source_url":"","source_hash":"","justifications":[{"type":"SL","antecedents":["hash-preprocessing-universal-first-step","sorted-order-enables-all-efficient-search"],"outlist":[],"label":"Query type (lookup vs comparison) determines the preprocessing choice"}],"dependents":["canonical-pipeline-has-exactly-two-instantiations"],"metadata":{"last_reviewed":"2026-06-07T22:02:22","review_result":"invalid"},"created_at":"","updated_at":"","reviewed_at":"","verified_at":"","retracted_at":"","explanation":{"steps":[{"node":"two-preprocessing-paradigms-partition-problems","truth_value":"IN","reason":"SL justification valid","antecedents":["hash-preprocessing-universal-first-step","sorted-order-enables-all-efficient-search"],"label":"Query type (lookup vs comparison) determines the preprocessing choice"},{"node":"hash-preprocessing-universal-first-step","truth_value":"IN","reason":"SL justification valid","antecedents":["counter-universal-frequency-primitive","set-for-o1-membership-universal"],"label":"Counter and set are complementary hash tools — Counter for \"how many\" and set for \"is present\" — and together cover the preprocessing needs of the majority of easy/medium problems"},{"node":"counter-universal-frequency-primitive","truth_value":"IN","reason":"SL justification valid","antecedents":["counter-dominant-frequency-tool","counter-pattern-dominates-frequency-problems","counter-missing-key-returns-zero","counter-subtraction-drops-nonpositive"],"label":"Counter's built-in semantics eliminate boilerplate that manual dicts would require"},{"node":"counter-dominant-frequency-tool","truth_value":"IN","reason":"premise"},{"node":"counter-pattern-dominates-frequency-problems","truth_value":"IN","reason":"premise"},{"node":"counter-missing-key-returns-zero","truth_value":"IN","reason":"premise"},{"node":"counter-subtraction-drops-nonpositive","truth_value":"IN","reason":"premise"},{"node":"set-for-o1-membership-universal","truth_value":"IN","reason":"SL justification valid","antecedents":["set-conversion-before-loop-for-o1-lookup","k-distant-uses-set-dedup","find-difference-set-minus-idiom","two-out-of-three-set-algebra"],"label":"Set algebra (intersection, difference, membership) replaces manual iteration wherever applicable"},{"node":"set-conversion-before-loop-for-o1-lookup","truth_value":"IN","reason":"premise"},{"node":"k-distant-uses-set-dedup","truth_value":"IN","reason":"premise"},{"node":"find-difference-set-minus-idiom","truth_value":"IN","reason":"premise"},{"node":"two-out-of-three-set-algebra","truth_value":"IN","reason":"premise"},{"node":"sorted-order-enables-all-efficient-search","truth_value":"IN","reason":"SL justification valid","antecedents":["sort-preprocessing-enables-linear-scan","binary-search-variants-share-convergence-structure"],"label":"Sorting is the shared upstream step; linear scan and binary search are the two downstream consumers that exploit the monotonicity it establishes, covering the full spectrum from exhaustive to targeted search"},{"node":"sort-preprocessing-enables-linear-scan","truth_value":"IN","reason":"SL justification valid","antecedents":["sort-then-two-pointer-pattern","meeting-rooms-sort-then-scan","array-partition-sort-greedy","subsequence-limited-sum-greedy-sort"],"label":"Sorting is the universal complexity bridge from quadratic brute-force to n-log-n solutions"},{"node":"sort-then-two-pointer-pattern","truth_value":"IN","reason":"premise"},{"node":"meeting-rooms-sort-then-scan","truth_value":"IN","reason":"premise"},{"node":"array-partition-sort-greedy","truth_value":"IN","reason":"premise"},{"node":"subsequence-limited-sum-greedy-sort","truth_value":"IN","reason":"premise"},{"node":"binary-search-variants-share-convergence-structure","truth_value":"IN","reason":"SL justification valid","antecedents":["binary-search-on-derived-quantities-pattern","binary-search-on-value-pattern","left-biased-binary-search-pattern","fixed-point-uses-leftmost-binary-search"],"label":"the four patterns are orthogonal specializations of one template — search-target and bias are independent choices, and recognizing the shared structure reveals that any new binary search problem maps to a point in this 2D design space"},{"node":"binary-search-on-derived-quantities-pattern","truth_value":"IN","reason":"premise"},{"node":"binary-search-on-value-pattern","truth_value":"IN","reason":"premise"},{"node":"left-biased-binary-search-pattern","truth_value":"IN","reason":"premise"},{"node":"fixed-point-uses-leftmost-binary-search","truth_value":"IN","reason":"premise"}]}}