XYZ interview question

string array dsa sql solving