Centene interview question

Solve simple problems from leetcode