Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 655. Print Binary Tree
Given a binary tree, produce an m x n string matrix (m = height+1, n = 2^(height+1)-1) that visually represents the tree by placing the root in the center of the top row and placing each child at column offsets determined by the remaining height (empty cells contain ""). Compute the tree height and assign each node to the appropriate row/column (typically by using midpoints or a recursive/DFS placement) to construct the layout.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.