Accenture Interview Question

Water tank question in Java