Microsoft Interview Question

Write a function to print all paths of a binary tree to a certain depth/length.

Interview Answer

Anonymous

Aug 22, 2014

Recursion, pass the root and the desired length initially, then call recursively children with length -1, return an array of string in the end.

1