WD interview question

A typical leetcode question about arrays