Deep Sort Algorithm Javascript Interview