ServiceNow interview question

to Solve a DSA problem