Goldman Sachs interview question

Write a program in o(n) complexity