solution for reversebinary