Code Room
CodingMediumcod-g1249
Subject HashingLevel Entry–Mid~14 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

Given a list of integers and a target, count how many positions hold a value that can be matched with some other position so the two values sum exactly to target. Each position is counted at most once, and the partner must be a different position (the same value at another index is allowed). For example, in [3, 7, 3, 1] with target 10, both 3s pair with the 7 and the 7 pairs with a 3, so three positions qualify and the answer is 3; the 1 has no partner. Return the count of qualifying positions.

Implement
partnered_count(nums: list[int], target: int) → int
Examples
in[[3,7,3,1],10]out3
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.

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.