Google interview question

DSA from leetcode and hackerrank