leetcode-helper icon indicating copy to clipboard operation
leetcode-helper copied to clipboard

TreeNode.bfs()

Open tianxie opened this issue 6 years ago • 0 comments

https://github.com/helloShen/leetcode-helper/blob/56bc2efee89405e1270bce8174e127fa2eef040a/src/main/java/com/ciaoshen/leetcode/util/TreeNode.java#L84-L85

For cases like:

    1
   / \
null  2

I think the above two lines should be:

if (n != null) {
    res.add(line);
    break;
}

tianxie avatar Nov 03 '19 13:11 tianxie