If a and b cannot be made equal with the given operation . Note that va [ 3 ] and vb [ 3 ] contain remaining numbers after repeated divisions with 2 , 3 and 7. If remaining numbers are not same then we cannot make them equal .
if ( va . get ( 3 ) != vb . get ( 3 ) ) { return - 1 ; }