Rakuten Interview Question

Simple problem that can be solved under 10 minutes