Google Interview Question

Simple Algo question with Big O Complexity follow-ups