Fortinet interview question

Several alogorithm problems, medium difficulty.