TikTok Interview Question

It is a leetcode question.

Glassdoor | Glassdoor