IBM Interview Question

2 medium leetcode questions in 45 minutes