Question
Given a binary tree encoded as a level-order array (None marks a missing child; values may be negative), return the maximum path sum. A path is any sequence of nodes connected by edges where each node appears at most once; it does not need to pass through the root and need not be root-to-leaf. Use a post-order pass where each node returns the best downward gain (max single-branch contribution, clamped at 0) while a global best tracks the best 'arch' (left gain + node + right gain). Return the maximum path sum.
max_path_sum(level: list) → int[[-10,9,20,null,null,15,7]]out42State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.