Pre initializing for dp [ 0 ] & dp [ 1 ]
dp [ 0 ] = max ( arr1 [ 0 ] , arr2 [ 0 ] ) ; dp [ 1 ] = max ( max ( arr1 [ 1 ] , arr2 [ 1 ] ) , max ( arr1 [ 0 ] , arr2 [ 0 ] ) ) ; int index = 2 ; while ( index < length ) {