Retool Interview Question

It's an array question on leetcode