Snowflake interview question

Tree manipulation and splitting to minimize height