ByteDance / TikTok logoByteDance / TikTok
Coding·60 minMembers

N-ary Tree Path Sum Count

Members only

Count target-sum paths in a tree, with the binary-tree version generalized to an N-ary tree. The expected optimal solution uses DFS plus a prefix-sum counter rather than checking every ancestor path.

SWE
tree
dfs
prefix-sum
hashmap
medium
Frequency
Single report
Last asked
2026-05-29
Stage
phone-screen

Log in to continue reading the full content

Comments

Sign in to join the discussion
Loading...