HP Inc. Interview Question

I was asked easy leetcode problems