Amazon Interview Question

Code a solution to a specific problem in a whiteboard and explain its complexity O(n)