Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Leetcode 257. Binary Tree Paths
Return all root-to-leaf paths of a binary tree as strings like "1->2->5"; this requires a simple DFS/backtracking traversal to build each path from root to leaf.
Asked at:
justworks
Bloomberg
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Late July, 2025
justworks
Senior
Mid March, 2025
Bloomberg
Senior
Given a binary tree with distinct nodes(no two nodes have the same data values). The problem is to print the path from root to a given node x. If node x is not present then print “No Path”. Examples: Input : 1 / \ 2 3 / \ / \ 4 5 6 7 x = 5 Output : 1->2->5
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.