Ecolab Interview Question

Explain the solutions you wrote for coding round