Company: Josh Technology
Difficulty: medium
Find Bottom Left Tree Value Picture an organization chart where each level of management occupies its own row. Scanning the lowest row of the chart from left to right, report the value held by the very first box you encounter. Examples Example 1: 2 / \\ 1 3 Input: root = [2,1,3] Output: 1 Explanation: Row 2 is the deepest row, and its leftmost box holds the value 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: Row 4 is the deepest row in this chart, and the leftmost box there holds the value 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; }