Compute left and right views once | Meta Interview Question