TikTok interview question

It was a leetcode medium involving arrays