Left view of the binary tree
- Left view is nothing but first element if we traverse level wise.
- last element would fall in right view category.
Code
```cpp
vector leftView(Node *root){
if (root == nullptr) return {};
vector ans;
queue<Node*> qu;
qu.push(root);
while (!qu.empty()) {
int Size = qu.size();
vector temp;
for (int i = 0; i < Size; i++) {
auto root = qu.front();
qu.pop();
temp.push_back(root -> data);
if (root -> left) qu.push(root -> left);
if (root -> right) qu.push(root -> right);
}
if (!temp.empty()) ans.push_back(temp.front());
}
return ans;
}
```
</details>