Driver program to test above
int main ( ) { int arr [ ] = { 5 , -2 , -1 , 3 , -4 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << " Length ▁ of ▁ longest ▁ subarray ▁ having ▁ maximum ▁ sum ▁ = ▁ " << lenLongSubarrWithMaxSum ( arr , n ) ; return 0 ; }