Check if it is possible to reach destination in even number of steps in an Infinite Matrix | Function to check destination can be reached from source in even number of steps ; Coordinates differences ; minimum number of steps required ; Minsteps is even ; Minsteps is odd ; Given Input ; Function Call
function IsEvenPath ( Source , Destination ) { let x_dif = Math . abs ( Source [ 0 ] - Destination [ 0 ] ) ; let y_dif = Math . abs ( Source [ 1 ] - Destination [ 1 ] ) ; let minsteps = x_dif + y_dif ; if ( minsteps % 2 == 0 ) document . write ( " " ) ; else document . write ( " " ) ; } let Source = [ 2 , 1 ] ; let Destination = [ 1 , 4 ] ; IsEvenPath ( Source , Destination ) ;