Borealis AI Interview Question

a simple algorithm question