Problem 545 · Medium

Boundary of Binary Tree

Return the values of the boundary of a binary tree in anti-clockwise order: the root, then the left boundary, then the leaves left-to-right, then the right boundary in reverse.

Open the interactive visualisation