Google Cloud interview question

Frog leap problem similar to leetcode