Question bank › Recursion
Dsa Recursion Easy

Binary Search Tree Paths

Given a binary tree, return all root-to-leaf paths in the form of a list of strings, where each string represents the path from the root to that leaf node. Please write a function that reads input as described below and outputs the result as specified. The input will consist of a series of integers indicating the values of the nodes in a level-order traversal format (use -1 to indicate a null node). The output should be a list of strings representing the paths. For example: Input: 1 2 3 -1 5 -1 -1 Output: ["1->2->5", "1->3"]

Key concepts

recursiontreesdepth-first search

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of Praxari's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.