IBM interview question

Random hackerrank questions, mostly was not hard.