IBM interview question

one leetcode hard question and one easy