GE Interview Question

Codility OA - two very easy questions