Skip to content

BFS2-completed#1575

Open
sujaygijre wants to merge 2 commits intosuper30admin:masterfrom
sujaygijre:master
Open

BFS2-completed#1575
sujaygijre wants to merge 2 commits intosuper30admin:masterfrom
sujaygijre:master

Conversation

@sujaygijre
Copy link
Copy Markdown

No description provided.

@super30admin
Copy link
Copy Markdown
Owner

Your solution is well-implemented and correct. You have correctly used a queue to perform level order traversal and captured the last node of each level. This is the standard approach for this problem.

One minor suggestion: instead of using while (size--) and checking if (size == 0), you could use a for loop that iterates exactly size times and check when the index is size-1. This might make the intention slightly clearer, but your current approach is also acceptable.

Note that you included an unrelated file (cousingInBinaryTree.cpp) in your submission. Make sure to only submit the code for the problem you are solving.

Overall, great job!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants