IBM interview question

Just standard leetcode problems, easy difficulty.