How to solve problem ZERO from Dream Code 2.0?

Can anyone share their approach for solving [ZERO] from Dream Code 2.0 contest? (CodeChef: Practical coding for everyone)