Element accessibility names
An audit walks the accessibility tree of a settings page. Every element arrives as one string of five fields separated by a vertical bar: the element id, its role, its own text, its aria-label, and the id its aria-labelledby points at. The id and the role are always present, and any of the other three fields may be empty. Only the roles button, link, checkbox and textbox are audited, and every other role is left alone. An audited element takes its name from the labelledby target first, but only when that id appears in the list and the target's own text is not blank. Failing that it takes its aria-label when that is not blank, and failing that its own text. A value that is only whitespace counts as blank. Return the ids of the audited elements that end up with no name, in input order.
unnamed_controls(elements: list[str]) → list[str][["b1|button|Save||","b2|button|||","h1|heading|Settings||"]]out["b2"][["lbl|text|Email address||","in1|textbox|||lbl","in2|textbox|||missing"]]out["in2"][["a1|link| |Open docs|","c1|checkbox| | |"]]out["c1"]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.
[["b1|button|Save||","b2|button|||","h1|heading|Settings||"]]["b2"]not run yetsample[["lbl|text|Email address||","in1|textbox|||lbl","in2|textbox|||missing"]]["in2"]not run yetsample[["a1|link| |Open docs|","c1|checkbox| | |"]]["c1"]not run yetsample