Loop Health interview question

Leetcode Easy/Medium based in arrays