Egnyte Interview Question

2 questions on arrays. It was leetcode medium level