Driver Code
let N = 3 ; let A = [ 1 , 2 , 3 ] ; let B = [ 2 , 3 , 1 ] ; document . write ( commonSubarrays ( A , B , N ) ) ; document . write ( " " ) ; N = 5 ; let C = [ 1 , 2 , 3 , 4 , 5 ] ; let D = [ 2 , 3 , 1 , 4 , 5 ] ; document . write ( commonSubarrays ( C , D , N ) ) ;