Code RoomImage alt text audit
EasyPrep Room Coding #4767

Image alt text audit

CodingAlgorithms & data structuresEntry–Mid~15 min

A design system ships a component gallery, and the accessibility check runs over the images it renders. Each image arrives as one string: the source path, a vertical bar, then the alt text, and the first bar is the separator. Report an image as missing when its alt text is empty or only whitespace. Otherwise report it as redundant when the alt text says nothing more than the file name. To compare, take the last path segment, drop the final dot and everything after it to get the bare name, then flatten the alt text and the name alike: lowercase them, turn every hyphen and underscore into a space, and squeeze runs of whitespace to one space. A flattened alt equal to either the bare name or the whole segment including its extension is redundant. Clean images report nothing. Return one finding per faulty image, written as the source path, a bar, then missing or redundant, in input order.

Implement
audit_image_alts(images: list[str]) → list[str]
Examples
in[["assets/hero-banner.png|Hero Banner","img/team.jpg|Engineers at the 2026 offsite","logo.svg| "]]out["assets/hero-banner.png|redundant","logo.svg|missing"]
in[["docs/setup_guide.PNG|setup guide.png","docs/setup_guide.PNG|How to wire the sensor"]]out["docs/setup_guide.PNG|redundant"]
in[["img/quarterly_report.png|Quarterly Report","img/quarterly_report.png|Quarterly Report for 2026"]]out["img/quarterly_report.png|redundant"]
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 15 min
InputExpectedGot
[["assets/hero-banner.png|Hero Banner","img/team.jpg|Engineers at the 2026 offsite","logo.svg| "]]["assets/hero-banner.png|redundant","logo.svg|missing"]not run yetsample
[["docs/setup_guide.PNG|setup guide.png","docs/setup_guide.PNG|How to wire the sensor"]]["docs/setup_guide.PNG|redundant"]not run yetsample
[["img/quarterly_report.png|Quarterly Report","img/quarterly_report.png|Quarterly Report for 2026"]]["img/quarterly_report.png|redundant"]not run yetsample