FastPrepSimplified XML Validator
Problems/Simplified XML Validator

Simplified XML Validator

Airbnb logoAirbnb● MediumFULLTIMEINTERNOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report fully gives the simplified nesting rules and the examples. It leaves out which characters a tag name can use and what to do with empty input.

Our version is about 97% the same as the reported question.

Given an ASCII string text, return whether it is valid under this simplified XML format.

The string consists of ordinary content and tags:

  • Ordinary content may contain any ASCII character except < and >.
  • An opening tag has the form <name>.
  • A closing tag has the form </name>.
  • A tag name is a non-empty sequence of visible ASCII characters that contains none of <, >, or /.
  • Opening and closing tags must be correctly nested, with none missing or overlapping.

Text is allowed before, after, and between complete tag pairs, so the input does not need one outer root tag. The empty string is valid.

Function

isValidSimplifiedXml(text: String) → boolean

Examples

Example 1

text = "text<a>more text</a>"return = true

The opening and closing a tags match, and ordinary text is allowed outside and inside the pair.

Example 2

text = "<a>text<b>other text</a></b>"return = false

The closing tags overlap: b must close before a.

Example 3

text = "<invalid<>text</invalid>"return = false

The opening tag contains another < before it closes.

Constraints

  • 0 <= text.length <= 10^5.
  • text contains ASCII characters only.

More Airbnb Online Assessment questions

  • In-Memory File SystemOA · Seen Nov 2026
  • Task Management SystemOA · Seen Nov 2026
  • Recipe Management SystemOA · Seen Nov 2026
  • Progressive Banking SystemOA · Seen Nov 2026
  • Credit Accounts with Scheduled TransfersOA · Seen Oct 2026
  • Parcel Attribute Store with TTLOA · Seen Oct 2026
  • Parcel Event TrackingOA · Seen Oct 2026
  • Median Home Price by CityOA · Seen Sep 2026
  • Worker Management (Promotion Track), Part 4: Full-Shift Double PayOA · Seen Sep 2026
  • Worker Management (Promotion Track), Part 3: Promotions and SalaryOA · Seen Sep 2026

Similar questions at other companies

  • Create New VersionCisco · OACisco interview questions
  • Smallest Value for a Linear Expression ModuloIntel · OA
  • Most Frequent Call Path From Function Trace LogsRoblox · PHONE SCREEN · ONSITE INTERVIEWRoblox interview questions
  • Single-Pass S-Expression ParserBaseten · ONSITE INTERVIEWBaseten interview questions
  • Remove Parentheses from a Plus-Minus ExpressionOracle · PHONE SCREENOracle interview questions
  • Decode StringCompass International Holdings · PHONE SCREENCompass International Holdings interview questions
  • Flatten a Mixed JSON ListNike, Inc. · ONSITE INTERVIEWNike, Inc. interview questions
  • Molecular Weight of a Grouped FormulaAgoda · ONSITE INTERVIEWAgoda interview questions
  • Calculate a Token-List ExpressionCollege Vine · ONSITE INTERVIEW
  • Rich Text Parser Part 3 (Depth Tokens)Figma · PHONE SCREEN · ONSITE INTERVIEWFigma interview questions

Interview reports that mention this question

  • Airbnb Intern OA, Diplomacy Game: 19 Experiences (Part 4 of 7)
  • Airbnb Intern OA, Halloween Candy: 22 Experiences (Part 3 of 7)
  • Airbnb SWE Intern OA / Interviews: 122 Experiences (Part 1 of 7)

Airbnb interview experiences

  • Airbnb OA · November 2026
  • Airbnb Campus and Full-Time SWE OA / Interviews: 9 Experiences
  • Airbnb Intern Phone Interviews: 21 Experiences (Part 7 of 7)
All Airbnb interview questionsSee Airbnb hiring insights
Saved
class Solution {
    public boolean isValidSimplifiedXml(String text) {
      // Write your code here.
    }
}
Checking account…