Google Interview Question

create an algorithm for a problem, optimize it, O - notation