Where it runs
1. The problem
Step 71 answered one question: is the whole tree balanced? It walked every node and checked its balance factor (the height of the left side minus the height of the right side). If even one node tilted by 2 or more, the answer was no. That tells you the tree is broken. It does not tell you how to fix it.
A node that tilts by 2 can get there in one of four shapes, and each shape needs its own repair. Before you straighten anything, you have to name which of the four shapes you are looking at. That is what this whole lesson does. There are no rotations here yet; the repairs come in the next lessons. Here you only make the diagnosis that picks the repair.
This step is part of the paid track
The first 33 steps are open to everyone: lesson, exercise and tests. This one opens with full access. Start with a free account and the free steps.
Create a free accountSee what is includedOn LeetCode
No LeetCode problem asks which of the four shapes an unbalanced node is in. LeetCode checks only that a tree is a valid search tree or that it is balanced, never how it got there. The full AVL tree comes together in lessons 76 and 77, and those lessons list the problems it solves.