Vericast interview question

it's a easy Leetcode question.