Panda Guru LogoPanda
Guru

Uber | Senior security engineer | Amsterdam

Round 1

Questions: Given an N-ary tree, print the nodes seen by a person when walking from bottom left to bottom right in an arc via root node.

Examples:

4 / \ 5 7 / \ / \ 12 1 a 8

Output: 12, 5, 4, 7, 8

We need to store the left most and right most element of each level and BFS traversal should solve. I took a lot of time to get this logic.

Follow-up Question

Candidate's Approach

I implemented a BFS traversal to capture the leftmost and rightmost nodes at each level of the N-ary tree. I faced challenges in ensuring that I correctly identified the nodes at the appropriate levels and added them to the result list in the correct order. I was unable to complete the solution due to time constraints but provided a partial implementation.

Interviewer's Feedback

No feedback provided.