Where it runs
1. The problem
In the last lesson the left rotation fixed a tree that leaned to the right. You get that shape from data that comes in increasing order, like 1, 2, 3: every new value goes to the right. This lesson is the mirror image. Feed the tree data in decreasing order: 3, 2, 1, dates from newest to oldest, or IDs that count down. Every value goes to the left, and the tree leans the other way. One node becomes left-heavy with a balance factor of +2 (the left height minus the right height, so the left side is two levels taller). Search slows down for the same reason as before. The fix is the exact mirror of the left rotation: a single right rotation. The whole lesson is about this one move.
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 for a right rotation on its own. It is the mirror of lesson 73 and one part of the AVL insert and delete. The full AVL tree comes together in lessons 76 and 77, and those lessons list the problems it solves.