F5 interview question

basic algorithmic questions, nothing complicated