Code RoomUnicode display name truncation spec
HardPrep Room Coding #4158

Unicode display name truncation spec

Vibe & agenticAlgorithms & data structuresSenior–Staff~20 min

You're directing an AI agent to write a Python function that enforces a 'max 30 characters' limit on a public display name and truncates longer ones for a UI, accepting names in any language including emoji and combining marks. Write the spec that makes 'length' and 'truncate' actually correct for human text. What unit of length, normalization, and edge cases do you mandate, and what acceptance criteria prove it? Then describe what a naive prompt ('limit the name to 30 characters and truncate') gets wrong.

Implement
truncate_to_graphemes(code_points: list[int], max_graphemes: int) → list[int]
Examples
in[[97,98,99],5]out[97,98,99]
in[[97,98,99],2]out[97,8230]
What a strong answer looks like

Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it (tests, edge cases, reading critically), and how you’d re-prompt or decompose to get it right.

0:00 of about 20 min

Vibe & agentic: describe the solution in plain language (or narrate it) and the coach grades your approach.

Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.