Negative subtrees, a path that bends through any node, and a return value that differs from the answer you track: this problem packs three traps into one DFS. Here is the clean O(n) solution and the reasoning that survives follow-ups.
Unlock the other 750 answers · ₹2,000 / $25Your progress and mastery stay saved · 6 months · one payment · no auto-renew
