Corelight interview question

Solve the given prompt text using DSA.