MEDIUMasked at 4 companies

Path Sum III

A medium-tier problem at 46% community acceptance, tagged with Tree, Depth-First Search, Binary Tree. Reported in interviews at Zepto and 3 others.

Founder's read

Path Sum III hits your screen and looks straightforward: count paths in a binary tree that sum to a target. Zepto, Flipkart, NetApp, and Salesforce all ask it. The trap is thinking you need leaf-to-root paths. You don't. The real trick is that paths can start and end anywhere, and most candidates waste time building prefix sums when a simpler DFS approach works faster. If you blank on the pattern during your live OA, StealthCoder surfaces a working solution in seconds while you stay invisible to the proctor.

Companies asking
4
Difficulty
MEDIUM
Acceptance
46%

Companies that ask "Path Sum III"

If this hits your live OA

Path Sum III is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Built by a senior engineer who knows the OA is theater. This is the script.

Get StealthCoder
What this means

The core insight: at each node, you're hunting for a path that ends at that node and sums to target. A naive brute-force explores every node-to-node pair, which gets expensive. The faster pattern uses depth-first search with a running sum. As you traverse down the tree, track the cumulative sum from root to current node. At each step, check if (current_sum minus target) exists earlier in the path. That difference tells you whether a valid sub-path exists. Most failures happen because candidates try to force a bottom-up DP approach or overthink the recursion. The acceptance rate sits at 46 percent because the path-ending-anywhere constraint breaks intuition. Tree and Binary Tree topics matter here because the structure lets you prune entire subtrees. When you hit this live and the brute-force feels slow, StealthCoder gives you the hashmap-plus-DFS solution instantly.

Pattern tags

The honest play

You know the problem. Make sure you actually pass it.

Path Sum III recycles across companies for a reason. It's medium-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Built by a senior engineer who knows the OA is theater. This is the script. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Path Sum III interview FAQ

Do paths have to go from root to leaf?+

No. Paths can start and end at any node in the tree, even internal nodes. This is why the problem trips up candidates who assume the standard root-to-leaf constraint. The lack of boundary makes brute-force expensive but also opens up the hashmap optimization.

Why is the acceptance rate so low?+

At 46 percent, most failures come from misunderstanding the path rules or implementing a brute-force solution that times out. The tree can have hundreds of nodes, and checking every pair without optimization becomes O(n^2) or worse per node, which fails on large inputs.

Is this still asked at Zepto and Flipkart?+

Yes. Both companies appear in the live data, along with NetApp and Salesforce. It's a stable medium-difficulty tree problem, so expect it in full-cycle rounds and online assessments for backend and infrastructure roles.

What's the difference between this and classic path sum problems?+

Classic versions ask for a single specific path or leaf sum. Path Sum III removes those constraints. That freedom means you can't use simple greedy techniques or early termination. You need to track cumulative state and search for valid sub-ranges, which is why DFS plus a hashmap is the standard weapon.

If I see this live and panic, how much time can I lose?+

Implementing brute-force costs you 10-15 minutes and then fails on test cases. Recognizing the prefix-sum pattern takes 5 minutes tops. If you blank on the pattern during the assessment, StealthCoder gives you a clean, working solution so you don't burn time debugging a half-baked approach.

Want the actual problem statement? View "Path Sum III" on LeetCode →

Frequency and company-tag data sourced from public community-maintained interview-report repos. Problem, description, and trademark © LeetCode. StealthCoder is not affiliated with LeetCode.