IBM Interview Question

one leetcode hard question and one easy