solution to reversebinary