You are given the root of a binary tree. You may install cameras on nodes, where each camera monitors:
Your task is to determine the minimum number of cameras required so that every node in the binary tree is monitored.
Return the minimum number of cameras needed.
Input: root = [0,0,null,0,0]
Output: 1
Explanation: A single camera placed on the second node can monitor all nodes in the tree.
Input: root = [0,0,null,0,null,0,null,null,0]
Output: 2
Explanation: At least two cameras are required to monitor every node in this skewed tree.
Input: root = [0]
Output: 1
Explanation: A single node needs one camera to be monitored.
Sign in to write, run, and submit your solution against the full test suite.