ans contains LCM of arr [ 0 ] [ 1 ] , . . arr [ i ] [ 1 ]
let ans = arr [ 0 ] [ 1 ] ; for ( let i = 1 ; i < size ; i ++ ) ans = Math . floor ( ( ( arr [ i ] [ 1 ] * ans ) ) / ( gcd ( arr [ i ] [ 1 ] , ans ) ) ) ;