Pregunta de entrevista de Rakuten

it was a single coding question