Question 1: Write a function to determine the height of a binary tree. The height is defined as the number of edges between the root and the furthest leaf.
- The root node of the binary tree.
- The height of the tree.
Binary Tree:
3
/ \
2 5
/ / \
1 4 6
Question 2: Implement a function to perform a level order traversal (breadth-first traversal) on a binary tree.
- The root node of the binary tree.
- The values of the nodes in level order.
Binary Tree:
3
/ \
9 20
/ \
15 7
- Create a React component called ButtonClicker that displays a button. When clicked, the button should change its text from "Click me" to "Clicked!".
- Create a React component called LikeButton that displays a button labeled "Like". When clicked, it should increment a count displayed next to the button indicating how many times it's been clicked.
- Create a React component called TrafficLight that displays a traffic light with three colors: Red, Yellow, and Green. Implement a button that toggles the state of the traffic light (Red -> Green -> Yellow -> Red).