Google Interview Question

A leetcode easy level problem.