Leetcode 366. Find Leaves of Binary Tree
Given a binary tree, simulate the process of repeatedly removing all current leaf nodes and recording their values until the tree is empty. Return a list of lists where each inner list contains the leaf node values removed in that round. The key insight is that nodes can be grouped by their 'height from the bottom' (i.e., their removal round), which can be computed efficiently via a post-order traversal.
Asked at:
Oracle
Amazon
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Mid June, 2026
Oracle
Senior
Early April, 2026
Senior
Early March, 2026
Junior
Hello Interview Premium
Your account is free and you can post anonymously if you choose.