Driver Code
let R = 5 ; let arr = [ [ 1 , 2 ] , [ 2 , 3 ] , [ 4 , 5 ] , ] ; let queries = [ 2 , 4 , 1 , 3 ] ; let N = arr . length ; let M = queries . length ; findMaxValueOfSet ( arr , queries , R , N , M ) ;