Morgan Stanley interview question

Write a runtime efficient loop in Java on the whiteboard