Code Room
CodingMediumcod-g299
Subject Tree traversalLevel Mid–Senior~30 minCommon in Concurrency · Algorithms & data structures interviewsIndustries Software development

Question

Given a binary tree encoded as a level-order list (None marks a missing child; children of None are omitted), return its inorder traversal as a list of node values. Implement Morris traversal (threaded binary tree) using O(1) extra space beyond the output — do NOT use a stack or recursion. The first element is the root; an empty list or [None] means an empty tree.

Implement
morris_inorder(level: list) → list[int]
Examples
in[[1,null,2,3]]out[1,3,2]
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.