ecobee interview question

Write an algorithm