SEGMENTATION FAULT IN THE PROBLEM

While solving the particular problem
https://practice.geeksforgeeks.org/contest-problem/left-view-of-binary-tree-1590744604/1/
,i am facing segmentation fault.Here is the link to my solution


What i have done here is that i have inserted the nodes level wise and then printed the first element of every level which is the left most element.This code is running successfully on the test cases given on the link but on submission it is giving segmentation fault.

hello @TusHar-AroRa-2294450460870717
the link u shared is locked (not accessible to me)

.

https://practice.geeksforgeeks.org/problems/left-view-of-binary-tree/1 here is the link if the above one is not getting opened

dry run ur code for case when u r having one node in ur tree.

It is working for that case

Problem is that when i am submitting it on gfg link,it is showing segmentation fault.