Pin Down a Vague HTML Parser Prompt, Build the Element Tree, and Query It with DFS

Quick Overview

A coding exercise in which the HTML parser prompt is deliberately vague, so the candidate must first pin down input, output and edge cases with concrete examples. It tests building a tree from nested markup in one pass, handling void and malformed tags, and answering a query with a depth-first traversal.

Pin Down a Vague HTML Parser Prompt, Build the Element Tree, and Query It with DFS

Company: Apple

Role: Software Engineer

Category: Software Engineering Fundamentals

Difficulty: medium

Interview Round: Onsite

Overview: A coding exercise in which the HTML parser prompt is deliberately vague, so the candidate must first pin down input, output and edge cases with concrete examples. It tests building a tree from nested markup in one pass, handling void and malformed tags, and answering a query with a depth-first traversal.

Read the full Apple Software Engineer interview experience this question came from

Apple logo
Apple
Aug 31, 2026
mediumSoftware EngineerOnsiteSoftware Engineering Fundamentals
2
0
Loading...