Skip to main content
📜 WAYPOINT LESSON

Checkpoint — Bank the Bands

⭐⭐⭐ advanced⏳ 25 min read📍 Lesson 236 of 281

Even-sum pair counting with explicit bands: O(n) formula at full scale, honest O(n²) available for band B. The W forgets the /2 — the ordered/unordered counting stumble.

Checkpoint — Bank the Bands. a_i + a_j is even exactly when both are even or both are odd: count parities, answer C(c,2) + C(d,2) — O(n), no pairs enumerated. The W is the ordered/unordered stumble: x·(x−1) without the halving, silently doubling the answer. Counting discipline: state WHETHER your pairs are ordered, once, before the formula.