Rakuten Interview Question

it was a single coding question