ServiceNow interview question

Easy algorithms. They don't care a lot about syntax