Skip to content

BFS-2 complete#1585

Open
rvuyyuru7 wants to merge 1 commit intosuper30admin:masterfrom
rvuyyuru7:master
Open

BFS-2 complete#1585
rvuyyuru7 wants to merge 1 commit intosuper30admin:masterfrom
rvuyyuru7:master

Conversation

@rvuyyuru7
Copy link
Copy Markdown

No description provided.

@super30admin
Copy link
Copy Markdown
Owner

Your solution for the "Right Side View" problem is correct and efficient. Well done! The BFS approach is implemented correctly, and the code is clean and easy to understand.

One minor suggestion: In the loop where you process each level, you are adding the node's value when i == levelSize - 1, which is the last node in the current level. This is correct. However, you could also consider using a deque or other data structures, but the current approach is standard and efficient.

Note: You have included an additional solution for "Cousins in Binary Tree" in the same file. It is important to submit only the solution for the problem you are solving. In a real coding interview or on platforms like LeetCode, you should only have the code for the specific problem. Make sure to separate solutions for different problems into their own files.

Overall, your solution for the "Right Side View" problem is excellent.

@super30admin
Copy link
Copy Markdown
Owner

Strengths:

  • The solution correctly implements the BFS approach for the right side view problem.
  • The code is clean, well-commented, and easy to understand.
  • Variable names are meaningful and enhance readability.

Areas for Improvement:

  • The submission includes an unrelated solution (for "Cousins in Binary Tree") in the same file. This should be avoided. Each problem should have its own separate file and solution.
  • While the code is correct, it is important to ensure that only the solution for the intended problem is submitted.

Overall, the solution for the "Right Side View" problem is correct and efficient. The inclusion of the extra code does not affect the correctness of the right side view solution, but it is a practice that should be avoided to prevent confusion.

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