Product Features40 minutes

Caption Layout

Build monospace line wrapping.

Task

Build a caption-layout feature that fits text into a fixed-width poster without overflowing its lines.

Requirements

  1. Return an array of lines, each at most columns characters. Columns must be an integer from 1 to 60; otherwise throw an Error.
  2. This renderer uses ASCII text in a fixed-width font: columns measures character cells, not proportional-font pixels.
  3. Collapse spaces and tabs within a paragraph. Preserve explicit newlines, including blank lines. Normalize Windows line endings.
  4. Place whole words where they fit. Split a word longer than columns into full-width chunks; its final chunk may share a line with the next word. Empty input returns [].
How you are graded
  • Decomposition 15%
  • Prompting the assistant 15%
  • Verification 20%
  • Judgment about AI output 15%
  • Correctness 25%
  • Communication 10%

Scores use evidence from your session. A short or incomplete session may not provide enough evidence for every skill. See a sample scorecard

Interview guidance

A poster renderer needs a line-layout function. You can use the AI assistant to write as much as you want. Before you accept anything, I would like you to work one tricky input through by hand, such as a word longer than the line, and compare it with what the code does.

  • AI is allowed and expected: your own Claude, OpenAI or Gemini key, or the free in-browser model.
  • You are graded on how you drive and check the AI, not on how much you prompt.
  • Run the checks; read what fails.
  • A new requirement will arrive partway through.
  • Too little AI use is reported as “not enough to grade”, never as a fail.
You will answer 7 debrief questions at the end
  • What did you delegate to the AI, and why?
  • Name one AI suggestion you rejected or changed, and why.
  • Choose one block the AI helped write. Explain what each line does and which test verifies it.
  • What is still risky, and what would you test or ship next?
  • Which input did you trace by hand, and did it match what the assistant's code produced?
  • Which input showed whether the assistant's hyphen search was off by one, and what did it return?
  • How would you keep the caption from running below a fixed-height image?