IBM interview question

Leetcode type questions that were hard