Google Interview Question

How to code an array to order