Left Side View

Problem

Intution

If we carefully observe the above picture, we can understand that, the left view of binary tree is the left most node or first node at every level

Perform regular BFS traversal and update the list only if the current element that is being processed is the first element in the level

Time Complexity

O(V+E) -> Standard BFS time complexity

Space Complexity

O(1)

Auxillary space complexity

Code

Last updated