#1372 - Longest ZigZag Path in a Binary Tree
A ZigZag path starts at any node and alternates between going left and right (or right and left). The length is the number of edges traversed. Return the longest ZigZag path in the tree.
| Input | Output |
|---|---|
root = [1,null,1,1,1,null,null,1,1,null,1,null,null,null,1] | 3 |
root = [1,1,1,null,1,null,null,1,1,null,1] | 4 |
root = [1] | 0 |