Build a Nested Rich-Text Structure from Indentation Levels

Problem

Implement read_rich_text. The input contains text fragments in document order, where each fragment is represented as (level, text):

  • level is a positive integer denoting the indent...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: