Pregunta de entrevista de ServiceNow

To write code in O(n) complexity.