Company: Goldman sachs_27july
Difficulty: medium
Satellite Communication Network Problem Description You are designing a communication network for satellites orbiting Earth. Each satellite has a unique identification number (a positive integer) that determines its position in the network hierarchy. The network is formed by the first satellite launched becoming the primary hub. Subsequent satellites connect to the network based on their ID: if the new satellite's ID is less than the previous satellite's ID, it connects to the satellite from the left subspace. If greater, it connects to the satellite from the right subspace. The communication network should be balanced at all times, as an unbalanced network increases signal latency resulting in poor communication. The network is deemed unbalanced if any satellite's subspace height difference exceeds 1. Therefore, to maintain optimal performance, the network should automatically rebalance as per the below operations. Rebalancing Operations: Orbit Adjustment A (Right Rotation): When the