TikTok Interview Question

It was a leetcode medium involving arrays