Google interview question

Leetcode problem coding just asked to solve problem