Encode an N-ary tree as a string and decode it back to the identical tree

Quick Overview

Design a string format for rooted N-ary trees and implement serialize and deserialize so the decoded tree has the same values, shape and child order. It tests unambiguous encoding of variable child counts, linear-time parsing, iterative handling of very deep trees, and validation of malformed input.

Encode an N-ary tree as a string and decode it back to the identical tree

Company: Uber

Role: Software Engineer

Category: Software Engineering Fundamentals

Difficulty: medium

Interview Round: Onsite

Overview: Design a string format for rooted N-ary trees and implement serialize and deserialize so the decoded tree has the same values, shape and child order. It tests unambiguous encoding of variable child counts, linear-time parsing, iterative handling of very deep trees, and validation of malformed input.

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

Uber logo
Uber
mediumSoftware EngineerOnsiteSoftware Engineering Fundamentals
2
0
Loading...