Ecolab interview question

Explain the solutions you wrote for coding round