Code Room
CodingMediumcod-g1515
Subject Config parsingLevel Entry–Mid~14 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

Lint the indentation of a nested CI file. Rules: (a) leading indentation consists of spaces — if the first character after the leading spaces is a tab, the line is bad; (b) the space count must be even (level = spaces/2); (c) the first non-blank line must be at level 0; (d) compared with the previous non-blank line, a line may go deeper by at most ONE level, while any decrease is fine; (e) whitespace-only lines are invisible to all rules. Return true when every line passes, false at the first violation. An empty file is valid.

Implement
validate_indentation(lines: list[str]) → bool
Examples
in[["deploy:"," region: us-east"," "]]outtrue
in[["jobs:"," build: go"]]outfalse
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.

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.