File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -7,16 +7,16 @@ export default function shortestBridge(grid: number[][]): number {
7
7
] ;
8
8
9
9
let firstIsland : [ number , number ] [ ] = [ ] ;
10
- loop:
11
- for ( const [ i , a ] of grid . entries ( ) ) {
10
+ loop: for ( const [ i , a ] of grid . entries ( ) ) {
12
11
for ( const [ j , v ] of a . entries ( ) ) {
13
12
if ( v === 1 ) {
14
13
firstIsland . push ( [ i , j ] ) ;
15
14
16
15
for ( const [ x , y ] of firstIsland ) {
17
16
grid [ x ] [ y ] = 2 ;
18
17
for ( const [ q , w ] of directions ) {
19
- const [ e , r ] = [ x + q , y + w ] ;
18
+ const e = x + q ;
19
+ const r = y + w ;
20
20
if ( grid [ e ] ?. [ r ] === 1 ) {
21
21
firstIsland . push ( [ e , r ] ) ;
22
22
grid [ e ] [ r ] = 2 ;
@@ -34,7 +34,8 @@ export default function shortestBridge(grid: number[][]): number {
34
34
for ( const [ x , y ] of firstIsland ) {
35
35
grid [ x ] [ y ] = 2 ;
36
36
for ( const [ q , w ] of directions ) {
37
- const [ e , r ] = [ x + q , y + w ] ;
37
+ const e = x + q ;
38
+ const r = y + w ;
38
39
if ( grid [ e ] ?. [ r ] === 1 ) {
39
40
return step ;
40
41
}
You can’t perform that action at this time.
0 commit comments