Heading outline faults
Your task
A documentation site audits the heading outline of a page before publishing it. You receive the heading levels in reading order, 1 meaning h1 through 6 meaning h6, and the visible title of each heading in the same order. A heading is reported when its level is more than one deeper than the level of the heading immediately before it, which also makes any first heading below level 1 a fault, or when its title is empty or only whitespace. Compare every heading with the heading physically before it even when that one was itself reported, and treat a blank heading as a real heading for that comparison. A heading that breaks both rules is reported once. Return the 1-based positions of the reported headings in ascending order.
Examples
heading_outline_faults(levels: list[int], titles: list[str]) -> list[int]Example 1
Input
heading_outline_faults([1, 2, 3, 2, 1], ["Getting started", "Install", "Requirements", "Configure", "Reference"])Output
[]Example 2
Input
heading_outline_faults([1, 3, 2], ["Overview", "Rate limits", "Errors"])Output
[2]Example 3
Input
heading_outline_faults([1, 2], ["Billing", " "])Output
[2]