GE Interview Question

puzzle loop sort thing I think