Triangle interview problem