Meta Interview Question

The first question was an array question that was easily solved with 1 for loop