Robbing a Tree
Asked at Zip · Coding Questions · Difficulty: Medium · Last asked Jul 15, 2026
In a village structured as a tree, each node represents a house containing certain wealth. The village is structured as a general tree and not a binary tree. Your task is to collect the maximum amount of wealth, but you cannot rob two directly connected houses. Write a function to calculate the maximum wealth that can be obtained from this tree.
Loading the problem…
More Zip interview questions
- Implement a Vending Machine with Bill Insertion and Change-Making (OOD)
- Implement an LRU Cache
- Implement Functions with AST and Find Tree Roots
- Reaching Far Along Buildings with Bricks and Ladders
- Maximum Profit from Repeated Stock Trades
- Maximum Sub Sentence Using Prefix Tree