Code RoomEven sum pairs
EasyPrep Room Coding #362

Even sum pairs

CodingAlgorithms & data structuresEntry–Mid~12 min

Given a list of integers, count the unordered pairs of positions (i, j) with i < j whose values sum to an even number. Two values sum to an even number exactly when they have the same parity. Aim for a solution that does not compare every pair directly. Example: [1, 2, 3, 4] has 2 such pairs: (1, 3) and (2, 4).

Implement
even_sum_pairs(nums: list[int]) → int
Examples
in[[1,2,3,4]]out2
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

0:00 of about 12 min
InputExpectedGot
[[1,2,3,4]]2not run yetsample