Rakuten interview question

it was a single coding question