Driver progra + m to test above function
int main ( ) { bool arr1 [ ] = { 0 , 1 , 0 , 1 , 1 , 1 , 1 } ; bool arr2 [ ] = { 1 , 1 , 1 , 1 , 1 , 0 , 1 } ; int n = sizeof ( arr1 ) / sizeof ( arr1 [ 0 ] ) ; cout << longestCommonSum ( arr1 , arr2 , n ) ; return 0 ; }