Amazon Interview Question

essentially code binary sort