Google Interview Question

Asked about time and space complexity about tree paths question.