Posts with tag 'bfs'

Top View of a Tree

less than 1 minute read

Given a binary tree root, return the top view of the tree, sorted left-to-right.

Sorting Mail

1 minute read

You are given a list of strings mailboxes. Each mailbox is a list of strings, where each string is either "junk", "personal", "work". Go through each mailbox...

Level Order Traversal

less than 1 minute read

Given a binary tree root return a level order traversal of the node values.

Level Order Alternating

less than 1 minute read

Given a binary tree root, return values of the nodes in each level, alternating from going left-to-right and right-to-left.

Leaves in Same Level

less than 1 minute read

Given a binary tree root, return whether all leaves are at the same level.

Back to top ↑