Snowflake Interview Question

Tree manipulation and splitting to minimize height