1 && -1 === $map[$pos - $bit -1]){ $move = $pos - $bit; $map[$move -1 ] = $step +1; $queue[] = $move; } } echo ($n != 1? $map[$n -1 ]: 0) . PHP_EOL;