Available question text
Compute the maximum depth (number of edges) from root 1 to any deepest node in the tree, then count assignments of weights {1,2} on that root-to-deepest-node path that make the total sum odd. Because parity depends only on the number of 1s, the answer is the number of length-m binary sequences with an odd number of 1s, i.e., 2^{m-1} modulo 1e9+7 (m = max depth).
Related questions
Continue with questions that share topics or the same question type.
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 3558. Number of Ways to Assign Edge Weights I
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source