Tibra interview question

Some coding, and a similar triangle problem