New
The Learning module is now live
See what's new
×
Question Bank
Learning
NEW
Pricing
Blog
Forum
HOT
JobRadar
Description
Solution
Discussion
Submissions
Ask AI
Question Bank
Coding Question
AI Insights
Quick Summary
Represent a forest where each node stores its direct parent index.
Remove a specified node along with all of its descendants.
Mark deleted entries as -1 in-place without shifting remaining indices.
What This Tests
Tree and graph traversal strategies
Transforming parent-pointer arrays into child-adjacency structures
In-place data modification and array indexing
Iterative versus recursive depth-first exploration
Common Patterns
Graph Traversal
DFS/BFS
Hashing
Collapse
Hint 1
Hint 2
What Interviewers May Ask Next
Accepted
494
/1.1k
Acceptance Rate
43.3%
Ask AI Assistant
Ask AI Assistant
Ask me anything about this coding question!
Qwen
Qwen3.6-Flash
0/2000
Auto
Debug
Run
Submit
Test Cases
Input
parentIndex =
target =
Output
Expected