Fortinet Interview Question

Several alogorithm problems, medium difficulty.