Rakuten Interview Question

It were classic algorhytmic problems with a high difficulty level.