Google interview question

Simple DSA question, which could be seen from leetcode