This problem teaches you to combine a boolean check with height computation in a single traversal, avoiding the O(n²) naive approach.
Enable JavaScript for the full StreamPrep guide.