IBM Interview Question

The OA asked two leetcode medium questions