Alibaba

1 articles

dsa5 min read

Path Sum IV — LeetCode 666 Encoded Tree DFS

LeetCode 666 Path Sum IV reconstructs a tree from depth-position-value encoded integers and returns the sum of all root-to-leaf paths. Solve with hashmap DFS in O(n) — frequent at Amazon and Alibaba.

Read →