Codes with frequency k
Your task
An inventory audit flags product codes by how often they were counted. Given the list of counted codes (in any order) and a target k (k >= 1), return all distinct codes that appear exactly k times, in ascending order. Return an empty list if none qualify. Example: [1, 2, 2, 3, 3, 3] with k = 2 gives [2].
Examples
codes_seen_k_times(codes: list[int], k: int) -> list[int]Example 1
Input
codes_seen_k_times([1, 2, 2, 3, 3, 3], 2)Output
[2]