Code RoomChatbot normalized exact match
EasyPrep Room Coding #541

Chatbot normalized exact match

CodingML systemsAlgorithms & data structuresEntry–Mid~12 min

You are scoring a chatbot's short answers against a reference answer key using normalized exact match. Given equal-length lists outputs and references, normalize each string by lowercasing it, trimming leading and trailing whitespace, and collapsing every internal run of whitespace to a single space. Return the number of positions where the normalized output equals the normalized reference. Example: outputs = [" Paris ", "london"], references = ["paris", "Berlin"] returns 1.

Implement
exact_match_count(outputs: list[str], references: list[str]) → int
Examples
in[[" Paris ","london"],["paris","Berlin"]]out1
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
[[" Paris ","london"],["paris","Berlin"]]1not run yetsample