Pregunta de entrevista de IBM

basic leetcode question you can see in easy/medium