Adchemy interview question

standard algorithmic questions