Skip to content

Bug Report for binary-tree-right-side-view #4467

@NeilR9

Description

@NeilR9

Bug Report for https://neetcode.io/problems/binary-tree-right-side-view

Please describe the bug below and include any steps to reproduce the bug or screenshots if possible.
Given the problem test case [1,2]:

Image WHen looking at the array of the root. The tree structure actually looks like this: 1 / \ 2

since 2 appears right after 1 in the array, the Node with 2 actually appears to the left of 1, not the right of 1. Hence, when getting just the node of the right side of the tree, the root would only be included since that is the only element of the right side of the tree.
The expected output says[1,2], but that is incorrect because the node with 2 does not appear on the right side of the tree since it is to the left of the node containing the value 1.

Pleas review this error and fix it as soon as possible as this is not good to have when expressing a tree as an array, If 2 were to be the right node, it should've been [1, null, 2]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy