Happen Bank interview question

Easy Leetcode during 1st round, and Onsite involves Medium to Hard.