Left View of a Binary Tree Problem Statement

Given a binary tree, your task is to print the left view of the tree.

Example:

Input:
The input will be in level order form, with node values separated by a space. Use -1 to denote null nodes.
Output:
The Left View of the tree.
Explanation:
Consider the following tree structure:
Level 1: Root = 1
Level 2: Left = 2, Right = 3
Level 3: Left = 4 (of 2), Right = 5 (of 3), Right = 6 (of 3)
Level 4: Right = 7 (of 4)
The Left View of this tree is: 1 2 4 7

Constraints:

  • 0 <= N <= 105
  • 1 <= data <= 105
  • Time limit: 1 second
AnswerBot
4mo

Print the left view of a binary tree given in level order form.

  • Traverse the tree level by level and print the first node of each level (leftmost node).

  • Use a queue to keep track of nodes at each level....read more

Help your peers!
Select
Add answer anonymously...

Top Software Developer Intern Interview Questions Asked at Delhivery

Q. Maximum Value of Modulus Expression Problem You are provided with two arrays ARR...read more
Q. Trapping Rain Water Problem Statement You are given a long type array/list ARR o...read more
Q. 0-1 Knapsack Problem A thief is planning to rob a store and has a knapsack that ...read more
Software Developer Intern Interview Questions
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
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

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2025 Info Edge (India) Ltd.

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits