Morgan Stanley Interview Question

Write a runtime efficient loop in Java on the whiteboard