Rakuten Interview Question

question about algorithm and DS