Help with problem

This was asked in CodeAgon 2021, can anyone help?