HeyGen interview question

Standard leetcode question, probably medium difficulty