EPAM Systems Interview Question

To solve the problem which was a logical problem