Borealis AI interview question

a simple algorithm question