Skip to main content
Admissions guidance, study banks, and career tools — get started on Shalyam

House Robber III

Houses form a binary tree and the thief cannot rob two directly linked houses. Given the tree in level-order form (values are money), print the maximum amount that can be robbed.

Constraints

1 <= number of nodes <= 10^4 0 <= value <= 10^4

Discussion

No discussions yet.

Rewards · v2.1

Get Exclusive Insights with Every Issue

Join Shalyam Newsletter

Stay ahead in education, research, and innovation—straight to your inbox.