ZS Associates interview question

How I attempted the ML question asked in CBT