if position not visited add to queue and mark visited
q . push ( [ s + d1 , stp + 1 ] ) ; visited . add ( s + d1 ) ; } if ( ! visited . has ( s + d2 ) ) { q . push ( [ s + d2 , stp + 1 ] ) ; visited . add ( s + d2 ) ; } if ( ! visited . has ( s - d1 ) ) { q . push ( [ s - d1 , stp + 1 ] ) ; visited . add ( s - d1 ) ; } if ( ! visited . has ( s - d2 ) ) { q . push ( [ s - d2 , stp + 1 ] ) ; visited . add ( s - d2 ) ; } } return Number . MIN_VALUE ; }