Ring Interview Question

Optimization problem, but cannot understand..