The problem can be found at the following link: Question Link
My Recommendation
This is a pretty common Data Structures and Algorithms problem. I strongly recommend checking out this article for a clearer understanding of AVL trees, left and right rotations, and the balancing factor.
Writing an editorial for such a lengthy code isn't feasible here. Please take a look at the article mentioned above for more insights.
Time and Auxiliary Space Complexity
Time Complexity: O(log N), where N is the number of nodes in the AVL tree.
Auxiliary Space Complexity: O(log N), for the recursive call stack.
For discussions, questions, or doubts related to this solution, please visit our discussion section. We welcome your input and aim to foster a collaborative learning environment.
If you find this solution helpful, consider supporting us by giving a ⭐ star to the getlost01/gfg-potd repository.