Uber: Possible path in a binary tree

CppCodingZen
3 min readSep 4, 2020

--

Problem:

Given a binary tree and an integer k, return whether there exists a root-to-leaf path that sums up to k.

Approach:

Since this is the first problem on this blog, let’s go step-by-step, and work through the solution. This problem is categorized as “easy”, and hence the solution shouldn’t be more than 10–20 lines of code.

--

--

CppCodingZen

Solutions to programming interview questions at some of the top companies in the world: cppcodingzen.com