Tencent interview question

some leetcode-style coding problems, mainly about array