IBM interview question

Sort an array in meandering order.