Maximum Product of Splitted Binary Tree
Solve this the way you would in the interview: out loud, on a timer, with an AI interviewer asking follow-ups while you code. You get a scored report at the end.
Practice this as a mock interviewFree to start, no account neededProblem
Given the root of a binary tree with at least two nodes, delete exactly one edge to split it into two trees. The value of a split is the product of the two trees' node-value sums.
Find the largest possible product over all edges, and return it **modulo** 10^9 + 7.
Maximize the true product first and only then take the remainder; do not compare products after reducing them.
Examples
Constraints
- 2 <= number of nodes <= 5 * 10^4
- 1 <= Node.val <= 10^4
What the interviewer grades
A correct solution is one of five scores. The report also grades problem understanding (did you clarify inputs and edge cases before coding), problem solving, communication while you work, code quality, and testing. See a sample report, or read up on the pattern in the lessons.