JavaScript program to implement the above approach
let row = 6 ; let col = 7 ; let vis = new Array ( row + 1 ) ; for ( var i = 0 ; i < vis . length ; i ++ ) { vis [ i ] = new Array ( 2 ) ; } let id = 0 ; let diameter = 0 , length = 0 ; let x = 0 , y = 0 ;