Complete the code to declare a class property for the node's value.
class TreeNode { value: [1]; constructor(value: number) { this.value = value; } }
The node's value is a number, so the property type should be number.
Complete the code to declare the left child property of the binary tree node.
class TreeNode { left: [1]; constructor() { this.left = null; } }
The left child is either another TreeNode or null if no child exists.
Fix the error in the constructor to properly initialize the right child property.
class TreeNode { right: TreeNode | null; constructor() { this.right = [1]; } }
The right child should be initialized to null to indicate no child.
Fill both blanks to declare left and right children with correct types and initialize them to null.
class TreeNode { left: [1]; right: [2]; constructor() { this.left = null; this.right = null; } }
Both left and right children are either TreeNode or null.
Fill all three blanks to complete the TreeNode class with value, left, and right properties properly typed and initialized.
class TreeNode { value: [1]; left: [2]; right: [3]; constructor(value: number) { this.value = value; this.left = null; this.right = null; } }
The value is a number, and both left and right children are TreeNode or null.