Binary Tree Cameras
Amazon interview questions · Hard · Coding round · 6 tests
You are given the root of a binary tree. Place the minimum number of cameras so that every node is monitored.
A camera placed on a node monitors:
- the node itself,
- its parent,
- its left child, and
- its right child.
Interface
Run your code with Ctrl+Enter to see results.