Problem 1541 is simulating tree rotation by array