Company: Josh Technology
Difficulty: medium
Find Bottom Left Tree Value Imagine you are looking at a family tree where each generation is represented by a row. Your task is to find the first person on the far left in the youngest generation (bottom-most row) of the family tree. Examples Example 1: 2 / \\ 1 3 Input: root = [2,1,3] Output: 1 Explanation: The first person on the far left in the youngest generation 1 Example 2: 1 / \\ 2 3 / / \\ 4 5 6 / 7 Input: root = [1,2,3,4,null,5,6,null,null,7] Output: 7 Explanation: The first person on the far left in the youngest generation 7 Constraints: Time Complexity: O(N) Space Complexity: O(1) Code Template: #include <iostream> #include <cstdlib> #include <string.h> using namespace std; class Node { public: int value; Node *left; Node *right; }; int findBottomLeftValue(Node *root) { // write your code here return -1; }