Palo Alto Networks interview question

codility test with 2 questions