Pergunta de entrevista da empresa Wayfair

What is the big-O efficiency of the string comparing problem I had to write.