Delete and Compact a Forest Stored by Parent Indices

Quick Overview

Delete a target node and all descendants from a forest represented by parent indices. Support both tombstoning and compacting modes, preserve survivor order, rewrite parent references correctly, and keep every surviving root self-referential.

Delete and Compact a Forest Stored by Parent Indices

Company: Pinterest

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

Overview: Delete a target node and all descendants from a forest represented by parent indices. Support both tombstoning and compacting modes, preserve survivor order, rewrite parent references correctly, and keep every surviving root self-referential.

|Home/Coding & Algorithms/Pinterest
Pinterest logo
Pinterest
Aug 13, 2026
mediumSoftware EngineerTechnical ScreenCoding & Algorithms
11
0
Loading...

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...