Initialize queue
let queue2 = [ ] ; queue2 . push ( [ n - 1 , 0 ] ) ; let dist1 = new Array ( n ) . fill ( 1e9 ) ; let ways2 = new Array ( n ) . fill ( 0 ) ; dist1 [ n - 1 ] = 0 ; ways2 [ n - 1 ] = 1 ;