Determine the Left View of a Binary Tree
You are given a binary tree of integers. Your task is to determine the left view of the binary tree. The left view consists of nodes that are visible when the tree is viewed from the left side.
Example:
Input:
T = 1
Binary Tree Level Order Input: 1 2 3 4 -1 5 6 -1 7 -1 -1 -1 -1 -1 -1
Output:
1 2 4 7
Explanation:
The left view of the binary tree is 1, 2, 4, 7 as shown in the image below:
Constraints:
- 1 <= T <= 100
- 0 <= N <= 3000
- 1 <= data <= 105 and data ≠ -1
Note:
You do not need to handle any input/output operations; just implement the function to return the required result.

AnswerBot
4mo
The task is to determine the left view of a binary tree, which consists of nodes visible when viewed from the left side.
Traverse the binary tree level by level from left to right, keeping track of the...read more
Help your peers!
Add answer anonymously...
PolicyBazaar Software Developer interview questions & answers
A Software Developer was asked 6mo agoQ. Tell me about yourself.
A Software Developer was asked Q. Nth Fibonacci Number Problem Statement Calculate the Nth term in the Fibonacci s...read more
A Software Developer was asked Q. Right View of Binary Tree Given a binary tree of integers, your task is to outpu...read more
Popular interview questions of Software Developer
A Software Developer was asked 6mo agoQ1. Tell me about yourself.
A Software Developer was asked Q2. Nth Fibonacci Number Problem Statement Calculate the Nth term in the Fibonacci s...read more
A Software Developer was asked Q3. Right View of Binary Tree Given a binary tree of integers, your task is to outpu...read more
>
PolicyBazaar Software Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

